-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSW-Menu.ps1
More file actions
351 lines (350 loc) · 10.3 KB
/
SW-Menu.ps1
File metadata and controls
351 lines (350 loc) · 10.3 KB
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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
$SW_Config_Menu_Load = {
}
$NewSWIP_Click = {
. $PSScriptRoot\NewIPPopup\NewIP.ps1
}
$Apply_Click = {
Function SSHConnect {
if (echo $CurrentPassword -eq "null") {
$CurrentPassword = Read-Host -Prompt 'Enter the current password. (eg. password)'
} if (echo $AdminName -eq "null") {
$AdminName = Read-Host -Prompt 'Enter the current admin username'
Start-Sleep -s 2
$SSHPassword = ConvertTo-SecureString $CurrentPassword -AsPlainText -Force
$sshcreds = New-Object System.Management.Automation.PSCredential($AdminName, $SSHPassword)
$session = New-SSHSession -ComputerName $SonicwallIP -Credential $sshcreds -AcceptKey:$true
#Starts the SSH Stream session required by SonicWALL
$SSHStream = New-SSHShellStream -SessionID $session.sessionID
$SSHstream = $session.Session.CreateShellStream("Sonic",0,0,0,0,1024)
#Pulls each line out of the config file and submits it to the SSH session established to the firewall
foreach($line in Get-Content $Config) {
$SSHStream.WriteLine($line)
Start-Sleep -s 1
}
#Can show progress of commands with this
$SSHStream.read()
} else {
continue
}
}
SSHConnect #This runs the function when using the menu
}
$ClearSSH_Click = {
Function ClearSSH {
#This just clears the SSH Session ID if the script was used already
if ($True) {
Start-Sleep -s 1
if ($session.SessionID -ne 'null'){
Remove-SSHSession -SessionId $session.SessionId
} else {
continue
}
}
} ClearSSH
}
$ClearVar_Click = {
Function ClearVariable {
Remove-Variable * -ErrorAction SilentlyContinue
}
ClearVariable #This runs the function when using the menu
}
$CapATP_Click = {
Function capture {
$captureatp = (
"conf t
capture-atp
enable
location cloud
no local-name-or-ip
file-type exe
file-type pdf
file-type office
file-type officex
file-type archives
file-size default
await-verdict allow
no exclude address for-capture-atp
exit"
)
$Config = "$home\Downloads\$SiteCode-catp.txt"
Write-Output ($captureatp) >> $Config
}
capture #This runs the function when using the menu
$wshell = New-Object -ComObject Wscript.Shell
$wshell.Popup("Check your Downloads folder to verify output.", 0, "Done", 0x1)
}
$Geo_Click = {
Function geo
{
$NKorea = ("'Korea, Democratic People's Republic of'")
$Cote = ('"' + "Cote d'Ivoire" + '"')
$Lao = ('"' + "Lao People's Democratic Republic" + '"')
$geoip = (
'conf t
geo-ip
block country "Anonymous Proxy/Private IP"
block country "Satellite Provider"
block country Andorra
block country "United Arab Emirates"
block country Afghanistan
block country "Antigua and Barbuda"
block country Anguilla
block country Albania
block country Armenia
block country "Netherlands Antilles"
block country Angola
block country "Asia/Pacific Region"
block country Antarctica
block country Argentina
block country "American Samoa"
block country Austria
block country Aruba
block country "Aland Islands"
block country Azerbaijan
block country "Bosnia and Herzegovina"
block country Barbados
block country Bangladesh
block country Belgium
block country "Burkina Faso"
block country Bulgaria
block country Bahrain
block country Burundi
block country Benin
block country Bermuda
block country "Brunei Darussalam"
block country Bolivia
block country Brazil
block country Bahamas
block country Bhutan
block country "Bouvet Island"
block country Botswana
block country Belarus
block country Belize
block country "Cocos (Keeling) Islands"
block country "Congo, The Democratic Republic of the"
block country "Central African Republic"
block country Congo
block country "Cook Islands"
block country Chile
block country Cameroon
block country China
block country Colombia
block country "Costa Rica"
block country Cuba
block country "Cape Verde"
block country "Christmas Island"
block country Cyprus
block country "Czech Republic"
block country Djibouti
block country Dominica
block country "Dominican Republic"
block country Algeria
block country Ecuador
block country Estonia
block country Egypt
block country "Western Sahara"
block country Eritrea
block country Spain
block country Ethiopia
block country Fiji
block country "Falkland Islands (Malvinas)"
block country "Micronesia, Federated States of"
block country "Faroe Islands"
block country Gabon
block country Grenada
block country Georgia
block country "French Guiana"
block country Guernsey
block country Ghana
block country Gibraltar
block country Gambia
block country Guinea
block country Guadeloupe
block country "Equatorial Guinea"
block country "South Georgia and the South Sandwich Islands"
block country Guatemala
block country Guam
block country Guinea-Bissau
block country Guyana
block country "Hong Kong"
block country "Heard Island and McDonald Islands"
block country Honduras
block country Croatia
block country Haiti
block country Hungary
block country Indonesia
block country Ireland
block country "Isle of Man"
block country India
block country "British Indian Ocean Territory"
block country Iraq
block country "Iran, Islamic Republic of"
block country Italy
block country Jersey
block country Jamaica
block country Jordan
block country Kenya
block country Kyrgyzstan
block country Cambodia
block country Kiribati
block country Comoros
block country "Saint Kitts and Nevis"
block country "Korea, Republic of"
block country Kuwait
block country "Cayman Islands"
block country Kazakhstan
block country Lebanon
block country "Saint Lucia"
block country "Sri Lanka"
block country Liberia
block country Lesotho
block country Lithuania
block country Luxembourg
block country Latvia
block country "Libyan Arab Jamahiriya"
block country Morocco
block country Monaco
block country "Moldova, Republic of"
block country Montenegro
block country Madagascar
block country "Marshall Islands"
block country Macedonia
block country Mali
block country Myanmar
block country Mongolia
block country Macao
block country "Northern Mariana Islands"
block country Mauritania
block country Montserrat
block country Malta
block country Mauritius
block country Maldives
block country Malawi
block country Mexico
block country Malaysia
block country Mozambique
block country Namibia
block country "New Caledonia"
block country Niger
block country "Norfolk Island"
block country Nigeria
block country Nicaragua
block country Nepal
block country Nauru
block country Niue
block country "Other Country"
block country Oman
block country Panama
block country Peru
block country "French Polynesia"
block country "Papua New Guinea"
block country Philippines
block country Pakistan
block country Poland
block country "Saint Pierre and Miquelon"
block country "Puerto Rico"
block country "Palestinian Territory"
block country Portugal
block country Palau
block country Paraguay
block country Qatar
block country Reunion
block country Romania
block country Serbia
block country "Russian Federation"
block country Rwanda
block country "Saudi Arabia"
block country "Solomon Islands"
block country Seychelles
block country Sudan
block country Singapore
block country "Saint Helena"
block country Slovenia
block country "Svalbard and Jan Mayen"
block country Slovakia
block country "Sierra Leone"
block country "San Marino"
block country Senegal
block country Somalia
block country Suriname
block country "Sao Tome and Principe"
block country "El Salvador"
block country "Syrian Arab Republic"
block country Swaziland
block country "Turks and Caicos Islands"
block country Chad
block country "French Southern Territories"
block country Togo
block country Thailand
block country Tajikistan
block country Tokelau
block country Turkmenistan
block country Tunisia
block country Tonga
block country Turkey
block country "Trinidad and Tobago"
block country Tuvalu
block country Taiwan
block country "Tanzania, United Republic of"
block country Ukraine
block country Uganda
block country Uruguay
block country Uzbekistan
block country "Holy See (Vatican City State)"
block country "Saint Vincent and the Grenadines"
block country Venezuela
block country "Virgin Islands, British"
block country "Virgin Islands, U.S."
block country Vietnam
block country Vanuatu
block country "Wallis and Futuna"
block country Samoa
block country Yemen
block country Mayotte
block country "South Africa"
block country Zambia
block country Zimbabwe
block country "Saint Martin"
block country Pitcairn
block country Timor-Leste
block country Curacao
block country "Sint Maarten"
block country "Bonaire, Saint Eustatius and Saba"') + "`nblock country $cote`nblock country $NKorea`nblock country $Lao`nexit`ncommit"
$Config = "$home\Downloads\$SiteCode-geo.txt"
Write-Output ($geoip) >> $Config
}
geo #This runs the function when using the menu
$wshell = New-Object -ComObject Wscript.Shell
$wshell.Popup("Check your Downloads folder to verify output.", 0, "Done", 0x1)
}
$Init_Setup_Click = {
. $PSScriptRoot\Initial_Configuration\Initial_Configuration.ps1
}
$WAN_Click = {
. $PSScriptRoot\Configure_WAN\ConfigWAN.ps1
}
$LAN_Click = {
. $PSScriptRoot\Configure_LAN\Configure_LAN.ps1
}
$Quit_Click = {
Function QuitMenu {
pause
if ($True) {
write-host("Have a good one.")
#Removes the variables and closes the SSH session
if ($session.SessionID -ne 'null'){
Remove-SSHSession -SessionId $session.SessionId -ErrorAction SilentlyContinue
Start-Sleep -s 2
Remove-Variable * -ErrorAction SilentlyContinue
} else {
continue
}
}
}
}
$Admin_Click = {
. $PSScriptRoot\Administration\Administration-Form.ps1
}
Add-Type -AssemblyName System.Windows.Forms
. (Join-Path $PSScriptRoot 'sw-menu.designer.ps1')
$SW_Config_Menu.ShowDialog()