forked from g0tmi1k/os-scripts
-
Notifications
You must be signed in to change notification settings - Fork 7
/
flash.sh
executable file
·236 lines (184 loc) · 6.81 KB
/
flash.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
#!/bin/bash
SPEED=
ENUM=
PORTS=
XPLOIT=
TARGET=
while getopts ":s:e:p:x:t:" OPTIONS
do
case $OPTIONS in
s) SPEED=$OPTARG;;
e) ENUM=$OPTARG;;
p) PORTS=$OPTARG;;
x) XPLOIT=$OPTARG;;
t) TARGET=$OPTARG;;
?) printf "Invalid option: -$OPTARG\n" $0
exit 2;;
esac
done
SPEED=${SPEED:=NULL}
ENUM=${ENUM:=NULL}
PORTS=${PORTS:=NULL}
XPLOIT=${XPLOIT:=NULL}
TARGET=${TARGET:=NULL}
##################
# ~~~ Menu ~~~ #
##################
if [ $SPEED = NULL ] || [ $ENUM = NULL ] || [ $PORTS = NULL ] || [ $TARGET = NULL ] || [ $XPLOIT = NULL ]; then
echo "--------------------------------------------------------------------"
echo "| Fl@sh v1.5 ~ b33f |"
echo "| -Scanned Before you know it- |"
echo "--------------------------------------------------------------------"
echo "| USAGE: ./flash.sh -s [pps] -e [N/A/B] -p [A/D] -x [Y/N] -t [IP] |"
echo "| |"
echo "| REQUIRED |"
echo "| -s Packets per second [recommended less than 400]. |"
echo "| -e Pipe output into N (nmap), A (amap), B (both). |"
echo "| -p A (full 65k), D (default port list). |"
echo "| -x Parse keywords in searchsploit (Y/N). |"
echo "| -t Target IP. |"
echo "| |"
echo "| DETAILS |"
echo "| (1) When the open ports are passed to nmap or amap |"
echo "| or both, the results will be saved to nmap-output.txt |"
echo "| and/or amap-output.txt in the parent directory... |"
echo "| |"
echo "| (2) When using the -x you should bear in mind that you |"
echo "| you should update the the local version of exploit-db |"
echo "| browse to '/pentest/exploits/exploitdb/platforms' and |"
echo "| issue 'svn up'... |"
echo "--------------------------------------------------------------------"
######################
# ~~~ Scanning ~~~ #
######################
##########################
# unicornscan full range #
##########################
elif [ $PORTS = A ]; then
echo ""
echo "[*] Scanning Full TCP port range, be patient..."
unicornscan -mT -R2 -p1-65535 -r $SPEED $TARGET &>/dev/null >> /tmp/TCP_Ports.txt &wait
echo "[>] TCP Ports:"
cat /tmp/TCP_Ports.txt
echo ""
echo "[*] Scanning Full UDP port range, be patient..."
unicornscan -mU -R2 -p1-65535 -r $SPEED $TARGET &>/dev/null >> /tmp/UDP_Ports.txt &wait
echo "[>] UDP Ports:"
cat /tmp/UDP_Ports.txt
####################################
# Prepping output for amap && nmap #
####################################
########
# amap #
########
cat /tmp/TCP_Ports.txt |cut -d"[" -f2 |cut -d"]" -f1 |sed -e 's/^[ \t]*//' >> /tmp/amap_list.txt
cat /tmp/UDP_Ports.txt |cut -d"[" -f2 |cut -d"]" -f1 |sed -e 's/^[ \t]*//' >> /tmp/amap_list.txt
########
# nmap #
########
cat /tmp/TCP_Ports.txt |cut -d"[" -f2 |cut -d"]" -f1 |sed -e 's/^[ \t]*//' |sed 's/$/,/' |tr -d '\n' >> /tmp/nmap_list.txt
cat /tmp/UDP_Ports.txt |cut -d"[" -f2 |cut -d"]" -f1 |sed -e 's/^[ \t]*//' |sed 's/$/,/' |tr -d '\n' >> /tmp/nmap_list.txt
rm /tmp/TCP_Ports.txt
rm /tmp/UDP_Ports.txt
#############################
# unicornscan default range #
#############################
elif [ $PORTS = D ]; then
echo ""
echo "[*] Scanning Default TCP port range, be patient..."
unicornscan -mT -R2 -r $SPEED $TARGET &>/dev/null >> /tmp/TCP_Ports.txt &wait
echo "[>] TCP Ports:"
cat /tmp/TCP_Ports.txt
echo ""
echo "[*] Scanning Default UDP port range, be patient..."
unicornscan -mU -R2 -r $SPEED $TARGET &>/dev/null >> /tmp/UDP_Ports.txt &wait
echo "[>] UDP Ports:"
cat /tmp/UDP_Ports.txt
####################################
# Prepping output for amap && nmap #
####################################
########
# amap #
########
cat /tmp/TCP_Ports.txt |cut -d"[" -f2 |cut -d"]" -f1 |sed -e 's/^[ \t]*//' >> /tmp/amap_list.txt
cat /tmp/UDP_Ports.txt |cut -d"[" -f2 |cut -d"]" -f1 |sed -e 's/^[ \t]*//' >> /tmp/amap_list.txt
########
# nmap #
########
cat /tmp/TCP_Ports.txt |cut -d"[" -f2 |cut -d"]" -f1 |sed -e 's/^[ \t]*//' |sed 's/$/,/' |tr -d '\n' >> /tmp/nmap_list.txt
cat /tmp/UDP_Ports.txt |cut -d"[" -f2 |cut -d"]" -f1 |sed -e 's/^[ \t]*//' |sed 's/$/,/' |tr -d '\n' >> /tmp/nmap_list.txt
rm /tmp/TCP_Ports.txt
rm /tmp/UDP_Ports.txt
fi
###########################################
# ~~~ Passing Ports to amap && nmap ~~~ #
###########################################
########
# nmap #
########
if [ $ENUM = N ]; then
echo ""
echo "[*] Passing Ports to Nmap..."
for DARK in $(cat /tmp/nmap_list.txt); do
nmap -sS -sV -p $DARK $TARGET >> nmap-output.txt; done
echo ""
echo "[>] Done!! Check out nmap-output.txt..."
########
# amap #
########
elif [ $ENUM = A ]; then
echo ""
echo "[*] Passing Ports to Amap..."
for SHARK in $(cat /tmp/amap_list.txt); do
amap -Adbqv -1 -b $TARGET $SHARK >> amap-output.txt; done
echo ""
echo "[>] Done!! Check out amap-output.txt..."
################
# amap && nmap #
################
elif [ $ENUM = B ]; then
echo ""
echo "[*] Passing Ports to Nmap & Amap..."
for DARK in $(cat /tmp/nmap_list.txt); do
nmap -sS -sV -p $DARK $TARGET >> nmap-output.txt; done
for SHARK in $(cat /tmp/amap_list.txt); do
amap -Adbqv -1 -b $TARGET $SHARK >> amap-output.txt; done
echo ""
echo "[>] Done!! Check out nmap-output.txt and amap-output.txt..."
fi
######################################
# ~~~ Clean up temporary files ~~~ #
######################################
rm /tmp/amap_list.txt &>/dev/null
rm /tmp/nmap_list.txt &>/dev/null
##############################################
# ~~~ Parsing Keywords in Searchsploit ~~~ #
##############################################
####################
# searchsploit = y #
####################
if [ $XPLOIT = Y ]; then
echo ""
echo "[*] Searching in searchsploit"
echo "[Take some time to go through the output files and group together"
echo " keywords seperated by comma's and all in lower-case see the"
echo " following example => freebsd local, sendmail 8.*]"
echo ""
echo -n "[>] Input search-string: "
read -e SEARCH
echo ""
echo $SEARCH |tr ',' '\n' |sed -e 's/^[ \t]*//' >> /tmp/search.txt
while IFS= read -r line; do
/pentest/exploits/exploitdb/searchsploit $line
done < /tmp/search.txt
rm /tmp/search.txt
echo ""
echo "[>] Done!!"
####################
# searchsploit = n #
####################
elif [ $XPLOIT = N ]; then
echo ""
echo "[>] Done!! No searchsploit parsing to do..."
fi
exit