forked from leebaird/discover
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generateTargets.sh
executable file
·110 lines (89 loc) · 2.08 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
#!/usr/bin/bash
f_targets(){
clear
f_banner
echo -e "${BLUE}SCANNING${NC}"
echo
echo "1. ARP scan"
echo "2. Ping sweep"
echo "3. Previous menu"
echo
echo -n "Choice: "
read choice
case $choice in
1) f_arpscan;;
2) f_pingsweep;;
3) f_main;;
*) f_error;;
esac
}
###############################################################################################################################
f_arpscan(){
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/targets-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/targets-arp-scan.txt${NC}\n"
echo
echo
exit
}
###############################################################################################################################
f_pingsweep(){
echo
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."
nmap -sn -PS -PE --stats-every 10s -iL $location > tmp
;;
2)
echo
echo -n "Enter a CIDR or range: "
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 $manual > tmp
;;
*) f_error;;
esac
grep -oE '\b([0-9]{1,3}\.){3}[0-9]{1,3}\b' tmp > $home/data/targets-pingsweep.txt
rm tmp
echo
echo $medium
echo
echo "***Scan complete.***"
echo
echo
echo -e "The new report is located at ${YELLOW}$home/data/targets-pingsweep.txt${NC}\n"
echo
echo
exit
}
###############################################################################################################################
while true; do f_targets; done