forked from leebaird/discover
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generateTargets.sh
executable file
·187 lines (151 loc) · 3.27 KB
/
generateTargets.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
#!/bin/bash
f_sub(){
clear
f_banner
echo -e "${BLUE}SCANNING${NC}"
echo
echo "1. Local area network"
echo "2. NetBIOS"
echo "3. netdiscover"
echo "4. Ping sweep"
echo "5. Previous menu"
echo
echo -n "Choice: "
read choice
case $choice in
1) echo
echo -n "Interface to scan: "
read interface
# Check for no answer
if [[ -z $interface ]]; then
f_error
fi
arp-scan -l -I $interface | egrep -v '(arp-scan|DUP:|Interface|packets)' > tmp
sed '/^$/d' tmp | sort -k3 > $home/data/arp-scan.txt
awk '{print $1}' tmp | $sip | sed '/^$/d' > $home/data/host-arp-scan.txt
rm tmp
echo
echo $medium
echo
echo "***Scan complete.***"
echo
echo
echo -e "The new report is located at ${YELLOW}$home/data/hosts-arp.txt${NC}\n"
echo
echo
exit
;;
2) f_netbios;;
3) f_netdiscover;;
4) f_pingsweep;;
5) f_main;;
*) f_error;;
esac
}
###############################################################################################################################
f_netbios(){
clear
f_banner
echo -e "${BLUE}Type of input:${NC}"
echo
echo "1. List containing IPs."
echo "2. CIDR"
echo
echo -n "Choice: "
read choice
case $choice in
1)
f_location
echo
echo $medium
echo
nbtscan -f $location
echo
echo
exit
;;
2)
echo
echo -n "Enter your CIDR: "
read cidr
# Check for no answer
if [[ -z $cidr ]]; then
f_error
fi
echo
echo $medium
echo
nbtscan -r $cidr
echo
echo
exit
;;
*) f_error;;
esac
}
###############################################################################################################################
f_netdiscover(){
echo $interface
echo $ip
echo $range
netdiscover -r $range -f -P | grep ':' | awk '{print $1}' > $home/data/netdiscover.txt
echo
echo $medium
echo
echo "***Scan complete.***"
echo
echo
echo -e "The new report is located at ${YELLOW}$home/data/netdiscover.txt${NC}\n"
echo
echo
exit
}
###############################################################################################################################
f_pingsweep(){
clear
f_banner
f_typeofscan
echo -e "${BLUE}Type of input:${NC}"
echo
echo "1. List containing IPs, ranges and/or CIDRs."
echo "2. Manual"
echo
echo -n "Choice: "
read choice
case $choice in
1)
f_location
echo
echo "Running an Nmap ping sweep for live hosts."
sudo nmap -sn -PS -PE --stats-every 10s -g $sourceport -iL $location > tmp
;;
2)
echo
echo -n "Enter your targets: "
read manual
# Check for no answer
if [[ -z $manual ]]; then
f_error
fi
echo
echo "Running an Nmap ping sweep for live hosts."
nmap -sn -PS -PE --stats-every 10s -g $sourceport $manual > tmp
;;
*) f_error;;
esac
cat tmp | grep 'report' | awk '{print $5}' > tmp2
mv tmp2 $home/data/hosts-ping.txt
rm tmp
echo
echo $medium
echo
echo "***Scan complete.***"
echo
echo
echo -e "The new report is located at ${YELLOW}$home/data/hosts-ping.txt${NC}\n"
echo
echo
exit
}
###############################################################################################################################
while true; do f_sub; done