-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.ps1
323 lines (235 loc) · 11.7 KB
/
menu.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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
## JOIN-INITIAL
function Join-Initial
{
## BOXSTARTER
function Install-BoxStarter
{
$PathBoxStarter = "C:\ProgramData\Boxstarter"
$InstallBoxStarter = $true
Write-Debug "[+] Comprobando si Boxstarter esta instalado en el sistema"
if ($InstallBoxStarter -and (-not (Test-Path $PathBoxStarter))) {
try {
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://boxstarter.org/bootstrapper.ps1')); get-boxstarter -Force
return $true
Write-Host "Boxstarter Instalado!!" -ForegroundColor Green
continue
} catch {
}
try {
Add-Type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
} catch {
Write-Debug "Failed to add new type"
}
try {
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
} catch {
Write-Debug "Failed to find SSL type...1"
}
try {
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls'
} catch {
Write-Debug "Failed to find SSL type...2"
}
$prevSecProtocol = [System.Net.ServicePointManager]::SecurityProtocol
$prevCertPolicy = [System.Net.ServicePointManager]::CertificatePolicy
Write-Host "Instalando Boxstarter" -ForegroundColor Green
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://boxstarter.org/bootstrapper.ps1')); get-boxstarter -Force
[System.Net.ServicePointManager]::SecurityProtocol = $prevSecProtocol
[System.Net.ServicePointManager]::CertificatePolicy = $prevCertPolicy
return $true
Write-Host " Boxstarter Instalado!!" -ForegroundColor Green
continue
}else {
Write-Warning " Boxstarter ya esta instalado en el sistema"
}
}
## $PROFILE
Function Test-PSProfile
{
$CreatePowershellProfile = $true
Write-Output "[+] Comprobando si existe Powershell Profile..."
if ($CreatePowershellProfile -and (-not (Test-Path $PROFILE))) {
Write-Host " Creando Powershell Profile" -ForegroundColor Green
New-Item -path $PROFILE -type File -Force | Out-Null
}else{
Write-Warning ' El perfil ya esta creado ($PROFILE)'
}
}
## PRIVILEGE
function Test-AdminExecution
{
Write-Host "[+] Comprobando que el script se esta ejecuntado como administrador.."
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal( [Security.Principal.WindowsIdentity]::GetCurrent() )
if (-Not $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host " [ERR] Por favor ejecuta el script como administrador`n" -ForegroundColor Red -NoNewline
Write-Host "`n Parando`n" -ForegroundColor Red -NoNewline
Read-Host "Pulsa cualquier tecla para continuar"
exit
} else {
Start-Sleep -Milliseconds 500
Write-Host " Eres Administrador " -ForegroundColor Green
Start-Sleep -Milliseconds 500
}
}
## COMPATIBILITY
function Test-HostSupported
{
Write-Host "[+] Comprobando compatibilidad del sistema operativo"
if ((Get-WmiObject -class Win32_OperatingSystem).Version -eq "6.1.7601"){
Write-Host "Windows 7 no esta soportado. ¿Deseas continuar? S/N" -ForegroundColor Yellow
$response = Read-Host
if ($response -ne "S"){
exit
}
}
$osversion = (Get-WmiObject -class Win32_OperatingSystem).BuildNumber
if (-Not (($osversion -eq 18363) -or ($osversion -eq 18361) -or ($osversion -eq 17763) -or ($osversion -eq 17134) -or ($osversion -eq 19041) )){
Write-Host " [ERR] La version $osversion podría dar problemas" -ForegroundColor Yellow
Write-Host "[-] ¿Quieres continuar? S/N " -ForegroundColor Yellow
$response = Read-Host
if ($response -ne "S"){
exit
}
} else {
Write-Host " Esta version de Windows esta soportada $osversion" -ForegroundColor Green
}
}
## TAMPER
Function Test-TamperProtection
{
if (-not(Test-Path "$env:LOCALAPPDATA\RELATIVITY\TWEAKS")) {
$tamperTrue = Get-MpComputerStatus | Select-Object IsTamperProtected | Where-Object {$_.IsTamperProtected -eq $true} -ErrorAction SilentlyContinue
if($tamperTrue -eq $null){
Write-Host "`tTamper Protection is off, looks good." -ForegroundColor Green
}else{
Write-Host "[!] Por favor deshabilita la Proteccion contra alteraciones de Windows Defender (Tamper Protection) e intentalo de nuevo." -ForegroundColor Red
Write-Host "`t[+] Hint: https://www.tenforums.com/tutorials/123792-turn-off-tamper-protection-windows-defender-antivirus.html" -ForegroundColor Yellow
exit
}
}else{}
}
## MODULO
function Install-Module{
New-Item -ItemType Directory -Path "$env:LOCALAPPDATA\RELATIVITY" -ErrorAction SilentlyContinue | Out-Null
Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/Relativity-Environment/Relativity_Scripts/master/MODULE/module.psm1" -Outfile "$env:LOCALAPPDATA\RELATIVITY\module.psm1" -ErrorAction SilentlyContinue
Import-Module "$env:LOCALAPPDATA\RELATIVITY\module.psm1"
}
function Test-PowershellExecution{
Set-ExecutionPolicy Unrestricted | Out-Null
}
## CALL FUNCTIONS
Test-AdminExecution;
Test-PowershellExecution;
Test-TamperProtection;
Test-HostSupported;
Test-PSProfile;
Install-Module;
Install-BoxStarter;
Add-InstallFolders
} #<<<<<<< Final Join-Initial
## INSTALLATION PACKAGES
$pentest = "https://raw.githubusercontent.com/Relativity-Environment/Relativity_Scripts/master/PENTEST.TOOLS/install.pentest.ps1"
#$reversing = "https://raw.githubusercontent.com/Relativity-Environment/Relativity_Scripts/master/REVERSING.TOOLS/install.reverse.ps1"
function Install-Pentest{
Join-Initial
if (-not(Test-Path "$env:LOCALAPPDATA\RELATIVITY\Install-Pentest")) {
Test-DiskSpace "Install-Pentest"
New-Item -ItemType file -Path "$env:LOCALAPPDATA\RELATIVITY" -Name "Install-Pentest"
}
if (-not(Test-Path "$env:LOCALAPPDATA\RELATIVITY\TWEAKS")) {Get-Tweaks}
Write-Host "[+] Instalando Pentest Tools..." -ForegroundColor Green
$cred=Get-Credential
Install-BoxstarterPackage -PackageName $pentest -Credential $cred
}
function Install-Reversing{
#TODO
}
function Install-Wifi{
#TODO
}
# RESTORE COMPUTER
Function Restore-Point{
if(Test-Path "$env:LOCALAPPDATA\RELATIVITY\TWEAKS")
{
Write-Warning "[!] Atencion has elegido restaurar el sistema"
Get-ComputerRestorePoint
$num = Read-Host "Elige el id del punto de restauracion y pulsa enter:"
Restore-Computer -RestorePoint $num -Confirm
}else{
Write-Warning "Aun no has instalado ninguna herramienta"
}
}
### Menu Instalador
function menu {
Write-Host "`n"
Write-Host " __________________________________________________________________________________________________ " -ForegroundColor Green
Write-Host " | |" -ForegroundColor Green
Write-Host " | Created by Victor M. Gil |" -ForegroundColor Green
Write-Host " | |" -ForegroundColor Green
Write-Host " | |" -ForegroundColor Green
Write-Host " | RELATIVITY - Security Tools for Windows Environment |" -ForegroundColor Green
Write-Host " | |" -ForegroundColor Green
Write-Host " | |" -ForegroundColor Green
Write-Host " |__________________________________________________________________________________________________|" -ForegroundColor Green
Write-Host " |__________________________________________________________________________________________________|" -ForegroundColor Green
Write-Host " | |" -ForegroundColor Green
Write-Host " | |" -ForegroundColor Green
Write-Host " | [+] INSTALL MENU |" -ForegroundColor Green
Write-Host " | |" -ForegroundColor Green
Write-Host " | 10. PENTEST TOOLS |" -ForegroundColor Green
Write-Host " | 20. REVERSING TOOLS (Unavalaible) |" -ForegroundColor Green
Write-Host " | 30. WIFI TOOLS (Unavalaible) |" -ForegroundColor Green
Write-Host " | |" -ForegroundColor Green
Write-Host " |__________________________________________________________________________________________________|" -ForegroundColor Green
Write-Host " |__________________________________________________________________________________________________|" -ForegroundColor Green
Write-Host " | |" -ForegroundColor Green
Write-Host " | " -ForegroundColor Green -NoNewLine; Write-Host " BACK. Restaurar el sistema" -ForegroundColor Yellow -NoNewLine; Write-Host " |" -ForegroundColor Green
Write-Host " | |" -ForegroundColor Green
Write-Host " | [-] SALIR Ctrl + C |" -ForegroundColor Green
Write-Host " | |" -ForegroundColor Green
Write-Host " | |" -ForegroundColor Green
Write-Host " |__________________________________________________________________________________________________|" -ForegroundColor Green
Write-Host ""
while(($inp = Read-Host -Prompt "Select an option") ){
switch($inp){
10 {
Clear-Host;
Install-Pentest;
pause;
menu;
break
}
20 {
Clear-Host;
#Install-Reversing;
Write-Host "No disponible"
pause;
menu;
break
}
BACK {
Clear-Host;
Restore-Point;
pause;
menu;
break
}
C{"Exit"; exit}
default {Write-Host -ForegroundColor red -BackgroundColor white "Opcion invalida, escoge otra opcion"; menu; pause}
}
}
?>
}menu