Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.

Commit 2f28a29

Browse files
committed
Update Get-TimedScreenshot.ps1
Fix error handling and various style problems
1 parent 321e53e commit 2f28a29

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Exfiltration/Get-TimedScreenshot.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ https://github.com/mattifestation/PowerSploit/blob/master/Exfiltration/Get-Timed
5050
)
5151

5252
#Define helper function that generates and saves screenshot
53-
Function GenScreenshot {
53+
Function Get-Screenshot {
5454
$ScreenBounds = [Windows.Forms.SystemInformation]::VirtualScreen
5555
$ScreenshotObject = New-Object Drawing.Bitmap $ScreenBounds.Width, $ScreenBounds.Height
5656
$DrawingGraphics = [Drawing.Graphics]::FromImage($ScreenshotObject)
@@ -86,16 +86,16 @@ https://github.com/mattifestation/PowerSploit/blob/master/Exfiltration/Get-Timed
8686
[String] $FilePath = (Join-Path $Path $FileName)
8787

8888
#run screenshot function
89-
GenScreenshot
89+
Get-Screenshot
9090

9191
Write-Verbose "Saved screenshot to $FilePath. Sleeping for $Interval seconds"
9292

9393
Start-Sleep -Seconds $Interval
9494
}
9595

9696
#note that this will run once regardless if the specified time as passed
97-
While ((Get-Date -Format HH:%m) -lt $EndTime)
97+
While ((Get-Date -Format HH:mm) -lt $EndTime)
9898
}
9999

100-
Catch {Write-Warning "$Error[0].ToString() + $Error[0].InvocationInfo.PositionMessage"}
101-
}
100+
Catch {Write-Error $Error[0].ToString() + $Error[0].InvocationInfo.PositionMessage}
101+
}

0 commit comments

Comments
 (0)