-
Notifications
You must be signed in to change notification settings - Fork 1
/
nmap-auto
90 lines (87 loc) · 2.01 KB
/
nmap-auto
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
#!/bin/bash
ip=$1
function whatweb_func {
pid=$1
echo "WHATWEB - PID: $pid"
while true
do
if [[ $(kill -s 0 $pid 2> /dev/null) ]]
then
echo "============================================"
echo " WHATWEB"
echo "============================================"
cat whatweb.save
echo ""
break
fi
done
}
function nikto_func {
pid=$1
echo "NIKTO - PID: $pid"
while true
do
if [[ $(kill -s 0 $pid 2> /dev/null) ]]
then
echo "============================================"
echo " DIRB"
echo "============================================"
cat dirb.save
echo ""
break
fi
done
}
function dirb_func {
pid=$1
echo "DIRB - PID: $pid"
while true
do
if [[ $(kill -s 0 $pid 2> /dev/null) ]]
then
echo "============================================"
echo " NIKTO"
echo "============================================"
cat nikto.txt
echo ""
break
fi
done
}
command="nmap -Pn -p- --min-rate=1000 -T4 $ip"
echo "============================================"
echo "$command"
echo "============================================"
$command &> nmap.save
cat nmap.save
ports=$(cat nmap.save | grep ^[0-9] | cut -d '/' -f 1 | tr '\n' ',' | sed s/,$//)
command="nmap -Pn -sC -sV -p$ports $ip"
output=$($command)
echo "$output" &>> nmap.save
echo "============================================"
echo "$command"
echo "============================================"
echo "$output"
output=$(echo "$output" | sed '/https:\/\/nmap.org/d')
echo "$output"
#if [[ "$output" == *"https"* ]]
#then
#echo "[+] Found HTTPS in output"
# url="https://$1"
# whatweb $url > whatweb.save &
# whatweb_func $! &
# nikto -host $url -output nikto.txt &
# nikto_func $! &
# dirb $url -w -S -o dirb.save &
# dirb_func $! &
#elif [[ "$output" == *"http"* ]]
#then
#echo "[+] Found HTTP in output"
# url="http://$1"
# whatweb $url > whatweb.save &
# whatweb_func $! &
# nikto -host $url -output nikto.txt &
# nikto_func $! &
# dirb $url -w -S -o dirb.save &
# dirb_func $! &
#fi