From be2a8ecf15ae467f36b5f3dea6b1b673d97d92a9 Mon Sep 17 00:00:00 2001 From: Matt Graeber Date: Thu, 10 Mar 2016 18:00:43 -0800 Subject: Get-TimedScreenshot enhancement. Issue #114 Get-TimedScreenshot now captures the entire screen. The screen resolution is obtained via WMI. If for some reason that fails, it will fall back to the old, less ideal method. --- Exfiltration/Get-TimedScreenshot.ps1 | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Exfiltration/Get-TimedScreenshot.ps1 b/Exfiltration/Get-TimedScreenshot.ps1 index e1ca823..89eceb0 100644 --- a/Exfiltration/Get-TimedScreenshot.ps1 +++ b/Exfiltration/Get-TimedScreenshot.ps1 @@ -52,9 +52,25 @@ https://github.com/mattifestation/PowerSploit/blob/master/Exfiltration/Get-Timed #Define helper function that generates and saves screenshot Function Get-Screenshot { $ScreenBounds = [Windows.Forms.SystemInformation]::VirtualScreen - $ScreenshotObject = New-Object Drawing.Bitmap $ScreenBounds.Width, $ScreenBounds.Height + + $VideoController = Get-WmiObject -Query 'SELECT VideoModeDescription FROM Win32_VideoController' + + if ($VideoController.VideoModeDescription -and $VideoController.VideoModeDescription -match '(?^\d+) x (?\d+) x .*$') { + $Width = [Int] $Matches['ScreenWidth'] + $Height = [Int] $Matches['ScreenHeight'] + } else { + $ScreenBounds = [Windows.Forms.SystemInformation]::VirtualScreen + + $Width = $ScreenBounds.Width + $Height = $ScreenBounds.Height + } + + $Size = New-Object System.Drawing.Size($Width, $Height) + $Point = New-Object System.Drawing.Point(0, 0) + + $ScreenshotObject = New-Object Drawing.Bitmap $Width, $Height $DrawingGraphics = [Drawing.Graphics]::FromImage($ScreenshotObject) - $DrawingGraphics.CopyFromScreen( $ScreenBounds.Location, [Drawing.Point]::Empty, $ScreenBounds.Size) + $DrawingGraphics.CopyFromScreen($Point, [Drawing.Point]::Empty, $Size) $DrawingGraphics.Dispose() $ScreenshotObject.Save($FilePath) $ScreenshotObject.Dispose() -- cgit v1.2.3