-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPortableScrollingScreenShotZFP.ps1
82 lines (70 loc) · 3.6 KB
/
PortableScrollingScreenShotZFP.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<#
.SYNOPSIS
Temporarily installs a screenshot tool capable of scrolling capture - automatic cleanup for zero footprint.
Why and How Blog Post: https://cloudywindows.com/post/BLOG_URL_HERE
.DESCRIPTION
CloudyWindows.io Escalation Toolkit: https://github.com/DarwinJS/CloudyWindows.ioEscalationToolkit
Capturing evidence of breakage and evidence that fixes are effective is a fundamental part of ensuring escalations
iex (iwr 'https://raw.githubusercontent.com/DarwinJS/WindowsEscalationToolkit/master/PortableScrollingScreenShotZFP.ps1')
iwr https://raw.githubusercontent.com/DarwinJS/WindowsEscalationToolkit/master/PortableScrollingScreenShotZFP.ps1' -outfile $env:public\PortableScrollingScreenShotZFP.ps1 ; & $env:public\PortableScrollingScreenShotZFP.ps1 -CloudyWindowsToolsSuppressCleanUp -CloudyWindowsToolsRoot "c:\users\public\test"
.COMPONENT
CloudyWindows.io
.ROLE
Escalation Toolkit (Zero Footprint)
#>
Param (
[String]$CloudyWindowsToolsRoot = "$(If ("$env:CloudyWindowsToolsRoot") {"$env:CloudyWindowsToolsRoot"} else {"$env:public\CloudyWindows.io_EscalationTools"})",
[String]$CloudyWindowsToolsSuppressCleanUp = $(If ("$env:CloudyWindowsToolsSuppressCleanUp" -and ("$env:CloudyWindowsToolsSuppressCleanUp" -ilike '*true*')) {"True"} else {"False"}),
[String]$Name = "PicPick ScreenShot",
[String]$Description = "Free, Portable, with screenshots of scrolling windows",
[String]$EXE = 'picpick.exe',
[String]$URL = 'http://ngwin.com/download/latest/picpick_portable.zip',
[String]$SubFolder = 'picpick'
)
$LastSegment = (("$URL") -split '/') | select -last 1
$CloudyWindowsToolFolder = "$CloudyWindowsToolsRoot\$SubFolder"
If ($CloudyWindowsToolsSuppressCleanUp -ilike '*true*') {[Bool]$BoolCloudyWindowsToolsSuppressCleanUp=$True} Else {[Bool]$BoolCloudyWindowsToolsSuppressCleanUp=$False}
If (@(Get-process $exe.replace('.exe','') -EA 0).count -gt 0) {Write-warning "`"$Name`" is already running, exiting..."; exit 0}
write-host "`$CloudyWindowsToolsSuppressCleanUp is $CloudyWindowsToolsSuppressCleanUp"
$ToolBanner = @"
*****************************************************
* CloudyWindows.io Escalation Toolkit:
* $Name - $Description
"*****************************************************
"@
Write-Host $ToolBanner
If (!(Test-Path "$CloudyWindowsToolFolder")) { New-Item -ItemType Directory -Path "$CloudyWindowsToolFolder" -Force | Out-Null}
If (!(Test-Path "$CloudyWindowsToolFolder\$EXE"))
{
Write-Host "Fetching `"$URL`" to `"$CloudyWindowsToolFolder\$LastSegment`""
Invoke-WebRequest -Uri "$URL" -outfile "$CloudyWindowsToolFolder\$LastSegment"
If ($LastSegment.endswith(".zip"))
{
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::ExtractToDirectory("$CloudyWindowsToolFolder\$LastSegment","$CloudyWindowsToolFolder")
}
}
$WaitParam=$False
If (!$BoolCloudyWindowsToolsSuppressCleanUp)
{
Write-Warning "Waiting for $CloudyWindowsToolFolder\$EXE to exit (Check for a tray item if programs does not appear to exit as expected)"
$WaitParam = $True
}
else
{
Write-Warning "Please wait while $name is launched..."
}
$processhandle = start-process -PassThru -FilePath "$CloudyWindowsToolFolder\$EXE" -wait:$WaitParam
If (!$BoolCloudyWindowsToolsSuppressCleanUp)
{
While (!$processhandle.HasExited)
{
Write-host "Waiting for $EXE to exit"
}
Write-Host "Zero Footprint cleanup, use switch -CloudyWindowsToolsSuppressCleanUp or Environment Variable CloudyWindowsToolsSuppressCleanUp = True"
Remove-Item "$CloudyWindowsToolFolder" -Recurse -Force
}
else
{
Write-Host "`"$Name`" is available for reuse in folder `"$CloudyWindowsToolFolder`""
}