From aa64d685c9e3c413bb2cdaa91015fc1c38bf8817 Mon Sep 17 00:00:00 2001 From: egieb <93350544+beigeworm@users.noreply.github.com> Date: Mon, 3 Jun 2024 21:43:26 +0000 Subject: [PATCH] Update main.ps1 --- Windows-Idiot-Prank/main.ps1 | 47 +++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/Windows-Idiot-Prank/main.ps1 b/Windows-Idiot-Prank/main.ps1 index c7de35c..6b0d7aa 100644 --- a/Windows-Idiot-Prank/main.ps1 +++ b/Windows-Idiot-Prank/main.ps1 @@ -12,6 +12,7 @@ stop in task manager (when console is hidden) Add-Type -AssemblyName System.Drawing Add-Type -AssemblyName System.Windows.Forms + # Hide the Powershell console $hide = 1 if ($hide -eq 1){ @@ -30,13 +31,15 @@ if ($hide -eq 1){ } } + # Download sounds and images iwr -Uri 'https://i.ibb.co/RpFpd34/wh.png' -OutFile "$env:TEMP\white.png" iwr -Uri 'https://i.ibb.co/Nx16b06/bl.png' -OutFile "$env:TEMP\black.png" iwr -Uri 'https://github.com/beigeworm/assets/raw/main/idiot.wav' -OutFile "$env:TEMP\sound.wav" sleep 1 -# Loop sound +Function SpawnImage{ + $job1 = { while ($true){ @@ -46,7 +49,6 @@ $job1 = { } -# Loop images $job2 = { Add-Type -AssemblyName System.Drawing Add-Type -AssemblyName System.Windows.Forms @@ -58,11 +60,11 @@ $job2 = { $desktopHandle = [System.IntPtr]::Zero $graphics = [System.Drawing.Graphics]::FromHwnd($desktopHandle) $random = New-Object System.Random - $x = 0 - $y = 200 - $dx = 15 + $x = $random.Next(10, 400) + $y = $random.Next(10, 400) + $dx = $random.Next(10, 25) $dy = $random.Next(10, 25) - $imageSize = 400 + $imageSize = 250 $i = 1 while ($true) { @@ -85,19 +87,26 @@ $job2 = { } } -# Volume up repeatedly -$job3 = { - $wshell = New-Object -ComObject wscript.shell - while ($true){ - $wshell.SendKeys([char]175) - sleep -m 10 +Start-Job -ScriptBlock $job1 +Start-Job -ScriptBlock $job2 + +} + +function MouseState { + $previousState = [Windows.Forms.Control]::MouseButtons + while ($true) { + $currentState = [Windows.Forms.Control]::MouseButtons + if ($previousState -ne $currentState) { + Write-Host "Mouse Click Detected!" + $previousState = $currentState + SpawnImage + break + } + Start-Sleep -Milliseconds 50 } } -# Start jobs -Start-Job -ScriptBlock $job1 -Start-Job -ScriptBlock $job2 -Start-Job -ScriptBlock $job3 -sleep 17 -Start-Job -ScriptBlock $job2 -pause +while ($true){ + MouseState + Start-Sleep -Milliseconds 500 +}