-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoenum.sh
229 lines (211 loc) · 9.3 KB
/
autoenum.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
#!/bin/bash
#########################################
# The Auto Enumeration Toolkit (AET) #
# Written by: Ahmed Samir #
#########################################
#
# this is tool used to automate the enumeration phase for one host or multihosts
echo "*****************************************************"
echo "* _ ____ ________ *"
echo "* / \ | __| |__ __| *"
echo "* / _ \ | |__ | | *"
echo "* / /_\ \ | __| | | *"
echo "* / _____ \ | |__ | | *"
echo "* \/ \/ |____| |__| *"
echo "* *"
echo "* AET Auto Enumeration Toolkit Ver. 1.0 *"
echo "* used to scan open ports and services version *"
echo "* and get the available exploits for the vulnerable *"
echo "* services in your hosts and list the directories *"
echo "* in your web services *"
echo "* Coded by Ahmed Samir *"
echo "* Cyber Security Trainee *"
echo "* Supervised by Sameh El-Hakim *"
echo "*****************************************************"
PS3="please choose one from the above options:"
select opt1 in "single IP address" "list of IP addresses" "exit"
do
case $REPLY in
1)echo "enter the project name:"
read project
echo "enter the IP address:"
read host
mkdir -p ./$project/$host #making directory for files result
mkdir -p ./$project/$host/screenshots #making directory for screenshots
echo "*****************************************************"
echo "* The Open Ports in the remote host *"
echo "*****************************************************"
nmap -n -sS -p 1-32343 $host
scrot ./$project/$host/screenshots/portscan.png
nmap -n -sS -p 1-32343 $host > ./$project/$host/portscan #port scan results
nmap -n -sV -p 1-32343 $host > ./$project/$host/version #version scan results
echo "*****************************************************"
echo "* The Operating System Details *"
echo "*****************************************************"
nmap -n -O $host|tail -8|head -4 #operating system details
#the number of hosted web services and working port number
scrot ./$project/$host/screenshots/osdetails.png
echo "*****************************************************"
echo "* The Services Version in the remote host *"
echo "*****************************************************"
nmap -n -sV -p 1-32343 $host -oX ./$project/$host/nmapxml #nmap output xml file format
scrot ./$project/$host/screenshots/serviceversion.png
web=`cat ./$project/$host/version |grep Apache |wc -l`
#echo "*****************************************************"
#echo "* The number of hosted web services and its ports *"
#echo "*****************************************************"
#echo $web
scrot ./$project/$host/screenshots/web.png
echo "*****************************************************"
echo "* The available exploits for vulnerable services *"
echo "*****************************************************"
for line1 in `cat ./$project/$host/nmapxml|tr '<' '\n'|grep cpe:|cut -d: -f 3,5|uniq`
do
service=`echo $line1 | tr ':' ' '`
screenshot=`echo $line1 | tr ':' '-'`
num=`echo $service |wc -w`
#echo $num
if [ $num -gt 1 ]
then
echo "*****************************************************"
echo "* The available exploits for $service *"
echo "*****************************************************"
searchsploit $service |uniq
fi
scrot ./$project/$host/screenshots/$screenshot.png
done
if [ $web -ge 1 ]
then
echo "*****************************************************"
echo "* There are $web web services hosted in this host *"
echo "*****************************************************"
#for x in `cat ./$project/$host/version|grep Apache|tr -s " "|cut -d " " -f6`
#do
#searchsploit Apache $x
#done
else
echo "there is no web service in this host"
fi
#port number in a list to loop
for ports in `cat ./$project/$host/version|grep Apache |cut -d / -f1`
do
echo "*****************************************************"
echo "* The web service port is: $ports *"
echo "*****************************************************"
echo "*****************************************************"
echo "* The Directories of the web service *"
echo "*****************************************************"
dirb http://$host:$ports/ #list directories in the web server
scrot ./$project/$host/screenshots/directories$ports.png
echo "*****************************************************"
echo "* The Vulnerabilities of the web service *"
echo "*****************************************************"
nikto -host http://$host/ -port $ports
scrot ./$project/$host/screenshots/webvuln$ports.png
done
#for services in `nmap -n -sV 10.0.0.204 |tr -s " "|cut -d " " -f 4,5,6,7,8`
#do
#echo "the service version is: $services"
#done
echo "*******************************************************************"
echo "* The Enumeration results exist in ./$project/$host directory *"
echo "*******************************************************************"
;;
2)echo "enter the project name:"
read project
echo "enter the file path which contains list of IP adresses:"
read path
#nmap -n -sS -p 1-32343 -iL $path #port scan list of ips from file
#nmap -n -sV -p 1-32343 -iL $path #version scan list of ips from file
let i=0
for host in `cat $path`
do
echo $host
let i=$i+1
mkdir -p ./$project/$host #making directory for files result
mkdir ./$project/$host/screenshots #making directory for screenshots
echo "*****************************************************"
echo "* The Open Ports in the remote host *"
echo "*****************************************************"
nmap -n -sS -p 1-32343 $host
scrot ./$project/$host/screenshots/portscan.png
nmap -n -sS -p 1-32343 $host > ./$project/$host/portscan #port scan results
nmap -n -sV -p 1-32343 $host > ./$project/$host/version #version scan results
echo "*****************************************************"
echo "* The Operating System Details *"
echo "*****************************************************"
nmap -n -O $host|tail -8|head -4 > ./$project/$host/osdetails#operating system details
#the number of hosted web services and working port number
scrot ./$project/$host/screenshots/osdetails.png
echo "*****************************************************"
echo "* The Services Version in the remote host *"
echo "*****************************************************"
nmap -n -sV -p 1-32343 $host -oX ./$project/$host/nmapxml #nmap output xml file format
scrot ./$project/$host/screenshots/serviceversion.png
web=`cat ./$project/$host/version |grep Apache |wc -l`
#echo "*****************************************************"
#echo "* The number of hosted web services and its ports *"
#echo "*****************************************************"
#echo $web
scrot ./$project/$host/screenshots/web.png
echo "*****************************************************"
echo "* The available exploits for vulnerable services *"
echo "*****************************************************"
for line1 in `cat ./$project/$host/nmapxml|tr '<' '\n'|grep cpe:|cut -d: -f 3,5|uniq`
do
service=`echo $line1 | tr ':' ' '`
screenshot=`echo $line1 | tr ':' '-'`
num=`echo $service |wc -w`
#echo $num
if [ $num -gt 1 ]
then
echo "*****************************************************"
echo "* The available exploits for $service *"
echo "*****************************************************"
searchsploit $service |uniq > ./$project/$host/exploits
fi
scrot ./$project/$host/screenshots/$screenshot.png
done
if [ $web -ge 1 ]
then
echo "*****************************************************"
echo "* There are $web web services hosted in this host *"
echo "*****************************************************"
#for x in `cat ./$project/$host/version|grep Apache|tr -s " "|cut -d " " -f6`
#do
#searchsploit Apache $x
#done
else
echo "there is no web service in this host"
fi
#port number in a list to loop
for ports in `cat ./$project/$host/version|grep Apache |cut -d / -f1`
do
echo "*****************************************************"
echo "* The web service port is: $ports *"
echo "*****************************************************"
echo "*****************************************************"
echo "* The Directories of the web service *"
echo "*****************************************************"
dirb http://$host:$ports/ -o ./$project/$host/directories #list directories in the web server
scrot ./$project/$host/screenshots/directories$ports.png
echo "*****************************************************"
echo "* The Vulnerabilities of the web service *"
echo "*****************************************************"
nikto -host http://$host/ -port $ports
scrot ./$project/$host/screenshots/webvuln$ports.png
done
#for services in `nmap -n -sV 10.0.0.204 |tr -s " "|cut -d " " -f 4,5,6,7,8`
#do
#echo "the service version is: $services"
#done
echo "*******************************************************************"
echo "* The Enumeration results exist in ./$project/$host directory *"
echo "*******************************************************************"
#echo $i
done
;;
3)exit
;;
esac
done