Updated - Automatic Mouse Mover
This commit is contained in:
@@ -63,22 +63,25 @@ cls
|
|||||||
echo Starting Mouse Mover...
|
echo Starting Mouse Mover...
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
REM Create PowerShell script
|
REM Create PowerShell script with proper escaping
|
||||||
(
|
(
|
||||||
echo $code = @"
|
echo Add-Type -TypeDefinition @"
|
||||||
echo using System;
|
echo using System;
|
||||||
echo using System.Runtime.InteropServices;
|
echo using System.Runtime.InteropServices;
|
||||||
echo public class MouseMover {
|
echo public class MouseMover {
|
||||||
echo [DllImport("user32.dll")]
|
echo [DllImport^("user32.dll"^)]
|
||||||
echo public static extern bool GetCursorPos(out POINT lpPoint^);
|
echo public static extern bool GetCursorPos^(out POINT lpPoint^);
|
||||||
echo [DllImport("user32.dll")]
|
echo.
|
||||||
echo public static extern uint SendInput(uint nInputs, INPUT[] pInputs, int cbSize^);
|
echo [DllImport^("user32.dll"^)]
|
||||||
echo [StructLayout(LayoutKind.Sequential)]
|
echo public static extern uint SendInput^(uint nInputs, INPUT[] pInputs, int cbSize^);
|
||||||
|
echo.
|
||||||
|
echo [StructLayout^(LayoutKind.Sequential^)]
|
||||||
echo public struct INPUT {
|
echo public struct INPUT {
|
||||||
echo public uint type;
|
echo public uint type;
|
||||||
echo public MOUSEINPUT mi;
|
echo public MOUSEINPUT mi;
|
||||||
echo }
|
echo }
|
||||||
echo [StructLayout(LayoutKind.Sequential)]
|
echo.
|
||||||
|
echo [StructLayout^(LayoutKind.Sequential^)]
|
||||||
echo public struct MOUSEINPUT {
|
echo public struct MOUSEINPUT {
|
||||||
echo public int dx;
|
echo public int dx;
|
||||||
echo public int dy;
|
echo public int dy;
|
||||||
@@ -87,20 +90,23 @@ echo public uint dwFlags;
|
|||||||
echo public uint time;
|
echo public uint time;
|
||||||
echo public IntPtr dwExtraInfo;
|
echo public IntPtr dwExtraInfo;
|
||||||
echo }
|
echo }
|
||||||
|
echo.
|
||||||
echo public struct POINT {
|
echo public struct POINT {
|
||||||
echo public int X;
|
echo public int X;
|
||||||
echo public int Y;
|
echo public int Y;
|
||||||
echo }
|
echo }
|
||||||
|
echo.
|
||||||
echo public const uint INPUT_MOUSE = 0;
|
echo public const uint INPUT_MOUSE = 0;
|
||||||
echo public const uint MOUSEEVENTF_MOVE = 0x0001;
|
echo public const uint MOUSEEVENTF_MOVE = 0x0001;
|
||||||
echo }
|
echo }
|
||||||
echo "@
|
echo "@
|
||||||
echo Add-Type -TypeDefinition $code
|
echo.
|
||||||
echo $interval = %INTERVAL%
|
echo $interval = %INTERVAL%
|
||||||
echo $durationMinutes = %DURATION_MINUTES%
|
echo $durationMinutes = %DURATION_MINUTES%
|
||||||
echo $random = New-Object System.Random
|
echo $random = New-Object System.Random
|
||||||
echo $startTime = Get-Date
|
echo $startTime = Get-Date
|
||||||
echo $moveCount = 0
|
echo $moveCount = 0
|
||||||
|
echo.
|
||||||
echo Write-Host ""
|
echo Write-Host ""
|
||||||
echo Write-Host "========================================" -ForegroundColor Green
|
echo Write-Host "========================================" -ForegroundColor Green
|
||||||
echo Write-Host "Mouse Mover Active (Hardware Simulation)" -ForegroundColor Green
|
echo Write-Host "Mouse Mover Active (Hardware Simulation)" -ForegroundColor Green
|
||||||
@@ -109,28 +115,34 @@ echo Write-Host ""
|
|||||||
echo Write-Host "Monitoring mouse movement..."
|
echo Write-Host "Monitoring mouse movement..."
|
||||||
echo Write-Host "Press Ctrl+C to stop"
|
echo Write-Host "Press Ctrl+C to stop"
|
||||||
echo Write-Host ""
|
echo Write-Host ""
|
||||||
|
echo.
|
||||||
echo $lastPos = New-Object MouseMover+POINT
|
echo $lastPos = New-Object MouseMover+POINT
|
||||||
echo [void][MouseMover]::GetCursorPos([ref]$lastPos^)
|
echo [void][MouseMover]::GetCursorPos^([ref]$lastPos^)
|
||||||
echo while ($true^) {
|
echo.
|
||||||
echo if ($durationMinutes -gt 0^) {
|
echo while ^($true^) {
|
||||||
echo $elapsed = ((Get-Date^) - $startTime^).TotalMinutes
|
echo if ^($durationMinutes -gt 0^) {
|
||||||
echo if ($elapsed -ge $durationMinutes^) {
|
echo $elapsed = ^(^(Get-Date^) - $startTime^).TotalMinutes
|
||||||
|
echo if ^($elapsed -ge $durationMinutes^) {
|
||||||
echo Write-Host ""
|
echo Write-Host ""
|
||||||
echo Write-Host "Duration reached. Stopping..." -ForegroundColor Yellow
|
echo Write-Host "Duration reached. Stopping..." -ForegroundColor Yellow
|
||||||
echo break
|
echo break
|
||||||
echo }
|
echo }
|
||||||
echo }
|
echo }
|
||||||
|
echo.
|
||||||
echo $currentPos = New-Object MouseMover+POINT
|
echo $currentPos = New-Object MouseMover+POINT
|
||||||
echo [void][MouseMover]::GetCursorPos([ref]$currentPos^)
|
echo [void][MouseMover]::GetCursorPos^([ref]$currentPos^)
|
||||||
echo if ($currentPos.X -ne $lastPos.X -or $currentPos.Y -ne $lastPos.Y^) {
|
echo.
|
||||||
|
echo if ^($currentPos.X -ne $lastPos.X -or $currentPos.Y -ne $lastPos.Y^) {
|
||||||
echo $lastPos = $currentPos
|
echo $lastPos = $currentPos
|
||||||
echo $time = Get-Date -Format 'HH:mm:ss'
|
echo $time = Get-Date -Format 'HH:mm:ss'
|
||||||
echo Write-Host "[$time] User moved mouse - Paused" -ForegroundColor Cyan
|
echo Write-Host "[$time] User moved mouse - Paused" -ForegroundColor Cyan
|
||||||
echo Start-Sleep -Seconds $interval
|
echo Start-Sleep -Seconds $interval
|
||||||
echo continue
|
echo continue
|
||||||
echo }
|
echo }
|
||||||
echo $moveX = $random.Next(-5, 6^)
|
echo.
|
||||||
echo $moveY = $random.Next(-5, 6^)
|
echo $moveX = $random.Next^(-5, 6^)
|
||||||
|
echo $moveY = $random.Next^(-5, 6^)
|
||||||
|
echo.
|
||||||
echo $input = New-Object MouseMover+INPUT
|
echo $input = New-Object MouseMover+INPUT
|
||||||
echo $input.type = [MouseMover]::INPUT_MOUSE
|
echo $input.type = [MouseMover]::INPUT_MOUSE
|
||||||
echo $input.mi.dx = $moveX
|
echo $input.mi.dx = $moveX
|
||||||
@@ -138,14 +150,19 @@ echo $input.mi.dy = $moveY
|
|||||||
echo $input.mi.dwFlags = [MouseMover]::MOUSEEVENTF_MOVE
|
echo $input.mi.dwFlags = [MouseMover]::MOUSEEVENTF_MOVE
|
||||||
echo $input.mi.time = 0
|
echo $input.mi.time = 0
|
||||||
echo $input.mi.dwExtraInfo = [IntPtr]::Zero
|
echo $input.mi.dwExtraInfo = [IntPtr]::Zero
|
||||||
echo $inputs = @($input^)
|
echo.
|
||||||
echo [void][MouseMover]::SendInput(1, $inputs, [System.Runtime.InteropServices.Marshal]::SizeOf($input^)^)
|
echo $inputs = @^($input^)
|
||||||
|
echo [void][MouseMover]::SendInput^(1, $inputs, [System.Runtime.InteropServices.Marshal]::SizeOf^($input^)^)
|
||||||
echo $moveCount++
|
echo $moveCount++
|
||||||
|
echo.
|
||||||
echo $time = Get-Date -Format 'HH:mm:ss'
|
echo $time = Get-Date -Format 'HH:mm:ss'
|
||||||
echo Write-Host "[$time] Auto-moved mouse ($moveCount moves)" -ForegroundColor Green
|
echo Write-Host "[$time] Auto-moved mouse ($moveCount moves)" -ForegroundColor Green
|
||||||
echo [void][MouseMover]::GetCursorPos([ref]$lastPos^)
|
echo.
|
||||||
|
echo [void][MouseMover]::GetCursorPos^([ref]$lastPos^)
|
||||||
|
echo.
|
||||||
echo Start-Sleep -Seconds $interval
|
echo Start-Sleep -Seconds $interval
|
||||||
echo }
|
echo }
|
||||||
|
echo.
|
||||||
echo Write-Host ""
|
echo Write-Host ""
|
||||||
echo Write-Host "========================================" -ForegroundColor Yellow
|
echo Write-Host "========================================" -ForegroundColor Yellow
|
||||||
echo Write-Host "Mouse Mover Stopped" -ForegroundColor Yellow
|
echo Write-Host "Mouse Mover Stopped" -ForegroundColor Yellow
|
||||||
|
|||||||
Reference in New Issue
Block a user