-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmultitool.sh
486 lines (399 loc) · 15.7 KB
/
multitool.sh
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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
#!/bin/bash
#TODO: Check if user input contains unwanted characters
# Make sure only the root user can run our script
# Or it is run with sudo
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root." 1>&2
exit 1
fi
# Test an IP address for validity:
function valid_ip() {
local ip=$1
local stat=1
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
OIFS=$IFS
IFS='.'
ip=($ip)
IFS=$OIFS
[[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
&& ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
stat=$?
fi
return $stat
}
function victimSSH_tunnel() {
#>ssh -p $jumpSSHport -o ServerAliveInterval=60 -o TCPKeepAlive=yes -R 5022:localhost:22 $jumpUser@$jumpHostComp
#|>run this from the session or device you have planted inside - to your jump box
#|>will forward remote (jump box) port 5022 to insider port 22
#TODO: enable user to customize all ports
echo 'Please enter the username of the for the jumpbox.'
echo ''
read -p "User name: " jumpUser
echo ''
echo "Please specify the SSH keyfile to use for user $jumpUser"
echo ''
read -p "Enter the full path: " jumpSSHkey
echo ''
echo 'Please enter the hostname or IP of the jumpbox.'
echo ''
read -p "IP or hostname: " jumpHostComp
echo ''
echo "Please enter the remote port to connect to."
echo ''
read -p "Enter the remote SSH port: " jumpSSHport
echo ''
echo 'Connecting to the jumpbox...'
echo ''
ssh -p $jumpSSHport -i $jumpSSHkey -o ServerAliveInterval=60 -o TCPKeepAlive=yes -R 5022:localhost:22 $jumpUser@$jumpHostComp
}
function jumpBoxSSH_tunnel() {
#|>ssh -p 5022 $insiderUser@$insiderHost
#|>run this from the jump box, sends traffic to port 5022 local (jump box) to insider port 22 through https tunnel
}
function monitorMode_on() {
#TODO: Verify functionality and add safety checks
#airmon-ng check kill #<|This seems to break things...enable only if needed
airmon-ng start $1
iwconfig | grep $1mon
echo "$1 is now in monitor mode! Please check the above output to verify."
}
function monitorMode_off() {
#TODO: managed mode off
airmon-ng stop $1mon
service NetworkManager start #or service networking start
echo "$1 is back in managed mode."
}
function connect_wifi() {
ESSID=$1
WPA_PASS=$2
bash -c 'wpa_passphrase $ESSID $WPA_PASS >> /etc/wpa_supplicant/wpa_supplicant.conf'
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
function aircrack_wpa() {
#TODO: add aircrack capability
pcap=$1
wordlist=#TODO: add a wordlist
aircrack-ng $pcap -w $wordlist
#grep KEY FOUND! to verify key is found
}
function create_wordMangles() {
#TODO: add most common word mangles / -f c -k c etc. / -r OneRuleToRuleThemAll.rule /
#input a wordlist, then apply all mangles to it and output to another file
}
function hashCrack() {
#TODO: use hashcat to crack passwords
}
while [ true ]
do
echo ''#Font=Big https://www.coolgenerator.com/ascii-text-generator
echo ' _ _ _ __ __ _ _ _ _ _'
echo ' / \ __| |_ __ ___ (_)_ __ | \/ |_ _| | |_(_) |_ ___ ___ | |'
echo ' / _ \ / _` | |_ ` _ \| | |_ \ | |\/| | | | | | __| | __/ _ \ / _ \| |'
echo ' / ___ \ (_| | | | | | | | | | | | | | | |_| | | |_| | || (_) | (_) | |'
echo '/_/ \_\__,_|_| |_| |_|_|_| |_| |_| |_|\__,_|_|\__|_|\__\___/ \___/|_|'
echo ''
#Menu with 6 options:
echo "Please select an option:"
echo ""
echo "1) Add a user"
echo "2) Change your SSH Port"
echo "3) Set a static IP."
echo "4) Change your MAC address (WIP)."
echo "5) Create a folder."
echo "6) Do a ping sweep of a network."
echo "7) Put a wireless card in monitor/managed mode. (WIP)"
echo "8) Monitor wifi. (WIP)"
echo "9) Setup a reverse SSH Tunnel. (WIP)"
echo "10) Create mangled wordlist. (WIP)"
echo "11) Crack passwords with hashcat. (WIP)"
echo "12) Exit"
echo ""
#TODO: add wireless tool options
#|>airmon-ng, airodump-ng, aireplay, etc
#TODO: add reverse ssh tunnel options, from both ends - combine with screen for persistent sessions
#|>ssh -p 443 -o ServerAliveInterval=60 -o TCPKeepAlive=yes -R 5022:localhost:22 <jumpUser>@<jumpHostComp>
#|>run this from the session or device you have planted inside - to your jump box
#|>will forward remote (jump box) port 5022 to insider port 22
#|>ssh -p 5022 <insiderUser>@<insiderHost>
#|>run this from the jump box, sends traffic to port 5022 local (jump box) to insider port 22 through https tunnel
#TODO: add capability to restart all networking services
#|>NetworkManager
#|>wpa_supplicant
#|>dhclient
#Get user input
read selection
case "$selection" in
1)
#add user
echo ' _ _ _'
echo ' / \ __| | __| | __ _ _ _ ___ ___ _ __ _'
echo ' / _ \ / _` |/ _` | / _` | | | | / __|/ _ \ |__(_)'
echo ' / ___ \ (_| | (_| | | (_| | | |_| \__ \ __/ | _'
echo ' /_/ \_\__,_|\__,_| \__,_| \__,_|___/\___|_| (_)'
echo''
#get user gecos information
echo "Please enter the GECOS information for your new user: "
echo "The format is: "
echo "Name,Office,Office-Phone,Home-Phone,Other-contact"
echo "Feel free to leave any fields blank."
echo "If you want to add a user without GECOS information only type the username."
read gecos
username=$(echo $gecos | cut -d"," -f1)
adduser $username --gecos $gecos
echo ""
;;
2)
#change your SSH port
echo ' ____ _ ____ ____ _ _ ____ _'
echo ' / ___| |__ __ _ _ __ __ _ ___ / ___/ ___|| | | | | _ \ ___ _ __| |_ _'
echo ' | | | |_ \ / _` | |_ \ / _| |/ _ \ \___ \___ \| |_| | | |_) / _ \| |__| __(_)'
echo ' | |___| | | | (_| | | | | (_| | __/ ___) |__) | _ | | __/ (_) | | | |_ _'
echo ' \____|_| |_|\__,_|_| |_|\__, |\___| |____/____/|_| |_| |_| \___/|_| \__(_)'
echo ' |___/'
echo ''
echo "Please enter the custom SSH port you would like to use:"
#take user input
#Check if user input a valid integer
read -p "Port #: " sshport
until [[ $sshport =~ ^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ ]]
do
echo "Please enter a valid port number: "
read -p "[1-65535]: " sshport
done
#TODO: check if the script can write to this file
#Script must be run with sudo so all files are readable...
sed -i "s/^#*Port.*/Port $sshport/" /etc/ssh/sshd_config
echo "Restarting the SSH service..."
service ssh restart
echo ""
service ssh status
echo ""
;;
3)
#set a static IP address; ask if user wants to change MAC as well
echo ' ____ _ _ _ _ ___ ____'
echo ' / ___| ___| |_ ___| |_ __ _| |_(_) ___ |_ _| _ \ _'
echo ' \___ \ / _ \ __| / __| __/ _` | __| |/ __| | || |_) (_)'
echo ' ___) | __/ |_ \__ \ || (_| | |_| | (__ | || __/ _'
echo ' |____/ \___|\__| |___/\__\__,_|\__|_|\___| |___|_| (_)'
echo ''
#need to get interface, IP, and subnet mask
#will take the selected interface down, change the information, then put it up again
#echo "Please enter the IP you would like to use: "
#get user's input for interface
echo "Which interface would you like to change the IP for?"
echo ''
ip a
echo ''
read -p "Interface name: " iface
echo ''
#Get user input for the IP to set
#Check to make sure IP is in the correct format ###.###.###.### (make sure regex allows for only single, double, or triple digits, 0-255)
echo "Please enter the IP address you want to use (in dotted decimal format):"
read -p "Enter IP: " staticIP
until valid_ip "$staticIP"
do
echo "Please enter a valid IP address."
read -p "Enter IP: " staticIP
done
echo ''
#Get user input for the network mask
#Check to make sure the netmask is in the correct format (same as above)
echo "Please enter the network mask (in dotted decimal format): "
read -p "Enter netmask: " Netmask
until valid_ip "$Netmask"
do
echo "Please enter a valid IP address."
read -p "Enter IP: " Netmask
done
echo ''
echo "Taking the interface down..."
echo ''
ifconfig $iface down
#TODO: Check if interface is actually down...
echo "Interface $iface is down."
echo ''
ifconfig $iface $staticIP netmask $Netmask up
echo ''
#TODO: Validate that the information has been changed
echo "The information has been changed."
echo ''
echo "Bringing the interface back up..."
ifconfig $iface up
echo "The interface should be back up. Check the output below to see if you have the selected IP."
ifconfig $iface
echo ""
;;
4)
echo ""
echo ' _____ _ __ __ _____ _ _'
echo ' / ____| | | \/ | /\ / ____| /\ | | | | _'
echo ' | | | |__ __ _ _ __ __ _ ___ | \ / | / \ | | / \ __| | __| |_ __ ___ ___ ___(_)'
echo ' | | | |_ \ / _` | |_ \ / _` |/ _ \ | |\/| | / /\ \| | / /\ \ / _` |/ _` | |__/ _ \/ __/ __|'
echo ' | |____| | | | (_| | | | | (_| | __/ | | | |/ ____ \ |____ / ____ \ (_| | (_| | | | __/\__ \__ \_'
echo ' \_____|_| |_|\__,_|_| |_|\__, |\___| |_| |_/_/ \_\_____| /_/ \_\__,_|\__,_|_| \___||___/___(_)'
echo ' __/ |'
echo ' |___/'
echo ""
echo "Would you like to change your MAC address?"
#take user input if they would like to change MAC or not
read -p "y/n: " changeMAC
if [ $changeMAC = 'y' ]
#TODO: check if user wants to set a MAC manually or randomly; add menu; add ASCII art
then
echo ''
#menu with x# of options
echo "Please make a selection: "
echo "1) Get a random address of the same type."
echo "2) Get a completely random address."
echo "3) Set a random address (Keeping same OUI)."
echo "4) Set a user-defined address (Full address)."
echo "5) Reset the MAC address to its default permanent address."
echo ''
#take user's input for macchanger selection
read -p "[1-5]: " choice2
echo ''
case "$choice2" in
1)
echo "Setting a random MAC address of the same device type."
option="a"
;;
2)
echo "Setting a completely random MAC address."
option="r"
;;
3)
echo "Setting a random MAC address (keeping the same OUI)."
option="e"
;;
4)
#TODO: make this work...keeps skipping code here somehow when I select option 4
echo "Please enter the MAC address you would like to use: "
read -p "[XX:XX:XX:XX:XX:XX]: " userMAC
option="m"
echo "Taking the interface down..."
ifconfig $iface down
#TODO: Check if interface is actually down...
echo "Interface $iface is down."
macchanger -$option $userMAC $iface
echo "Your MAC has been changed"
echo "Bringing the interface back up..."
ifconfig $iface up
echo "The interface should be back up. Check the output below to see if you have the selected IP."
ifconfig $iface
echo ""
break
;;
5)
echo "Resetting the address to its default permanent address..."
option="p"
;;
esac
echo ''
echo "Taking the interface down..."
ifconfig $iface down
#TODO: Check if interface is actually down...
echo "Interface $iface is down."
macchanger -$option $userMAC $iface
echo "Your MAC has been changed"
fi
echo "Bringing the interface back up..."
ifconfig $iface up
echo "The interface should be back up. Check the output below to see if you have the selected MAC."
ifconfig $iface
echo ""
;;
5)
#create a folder; ask user for name and location
echo ' ____ _ __ _ _'
echo ' / ___|_ __ ___ __ _| |_ ___ _ __ _____ __ / _| ___ | | __| | ___ _ __ _'
echo ' | | | |__/ _ \/ _` | __/ _ \ | |_ \ / _ \ \ /\ / / | |_ / _ \| |/ _` |/ _ \ |__(_)'
echo ' | |___| | | __/ (_| | || __/ | | | | __/\ V V / | _| (_) | | (_| | __/ | _'
echo ' \____|_| \___|\__,_|\__\___| |_| |_|\___| \_/\_/ |_| \___/|_|\__,_|\___|_| (_)'
echo''
echo "Please enter the name of the folder you want to create:"
#Get user input for folder to create
read -p "Folder name: " folder_name
#Get user input for folder location
echo "Please enter the location where you want this folder:"
echo "Hit enter if you want it in the current folder."
read -p "Folder absolute path: " folder_location
#create the folder
echo "Creating your folder..."
mkdir "$folder_location/$folder"
echo "Your folder has been created in $folder_location/$folder"
echo ""
;;
6)
#ping sweep (from oneliner)
echo ' ____ _'
echo ' | _ \(_)_ __ __ _ _____ _____ ___ _ __ _'
echo ' | |_) | | |_ \ / _` | / __\ \ /\ / / _ \/ _ \ |_ (_)'
echo ' | __/| | | | | (_| | \__ \\ V V / __/ __/ |_) |'
echo ' |_| |_|_| |_|\__, | |___/ \_/\_/ \___|\___| .__(_)'
echo ' |___/ |_|'
echo ''
echo "Please enter the IP of the network you want to scan:"
#Get user input for IP of network to scan
read -p "IP address of network: " networkIP
until valid_ip "$networkIP"
do
echo "Please enter a valid IP address."
read -p "Enter IP: " networkIP
done
#Get CIDR for network to scan
echo "Please enter the CIDR notation for the network: "
read -p "CIDR: (/##)" cidr
until [[ $cidr =~ ^\/([0-9]|[1-2][0-9]|3[0-2])$ ]]
do
echo "Please enter a valid port number: "
read -p "[/<num>]: " cidr
done
#TODO: add timing information to slow down scan (use -i<#>) default=25ms; figure out how to add short date to filename
fping -g $networkIP$cidr > "$networkIP.txt"
echo ""
;;
7)
#put the wireless card in monitor or managed mode
;;
11)
echo ' _____ _ _____ _ '
echo ' / ____| | | | __ \ | | _ '
echo ' | | _ __ __ _ ___| | __ | |__) |_ _ ___ _____ _____ _ __ __| |___(_)'
echo ' | | | |__/ _` |/ __| |/ / | ___/ _` / __/ __\ \ /\ / / _ \| |__/ _` / __| '
echo ' | |____| | | (_| | (__| < | | | (_| \__ \__ \\ V V / (_) | | | (_| \__ \_ '
echo ' \_____|_| \__,_|\___|_|\_\ |_| \__,_|___/___/ \_/\_/ \___/|_| \__,_|___(_)'
echo ''
#crack passwords with hashcat
#get user input for attack type - make attack type listing with numeric selections;
#get user input for hash type
read -p "Hash type: > " hash_selection
hashcat --help | grep -i $hash_selection
#|>then prompt user to input the hash type # identifier;
#Get user input for file with hashes to crack
#|>Check if hashlist includes usernames (in format username:hash)
#|>if so add --username to hashcat syntax
#Get user input for password list to use for cracking
#Ask user if they want to apply any mangling rules or a mask
#|>if mask is chosen display a short help screen of default mask types
#|>as well as describe -1 and -2 user masks
#|>make sure character escapes work properly and don't cause problems below
echo '\?l = abcdefghijklmnopqrstuvwxyz'
echo '\?u = ABCDEFGHIJKLMNOPQRSTUVWXYZ'
echo '\?d = 0123456789'
echo "\?s = \!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\]\^\_\`\{\|\}\~"
echo '\?a = \?l\?u\?d\?s'
echo '\?b = 0x00 - 0xff'
#basic execution syntax:
hashcat -D1,2 -O --force -a $attack_type -m $hash_id $hash_list $pass_list
#find out if hashcat has problems with blank variables
#|>if not then add variables for the proper flags + user input for mangling/masks
#|>ex: rules="-r $user_rules"
;;
12)
#exit
break
;;
esac
done
echo "All done here! Quitting..."
exit 0