forked from purpl3f0xsecur1ty/useful_random_stuff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scan-range.sh
21 lines (20 loc) · 849 Bytes
/
scan-range.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# For this script, make sure targets are in CIDR notation:
# 192.168.0.0/24
for cidr in `cat targets.txt`; do
echo ${cidr}
netblock=`echo ${cidr} | cut -f 1 -d '/'`
echo ${netblock}
# CHANGE ME!!
mkdir -p /home/<YOUR USER HERE>/${netblock}
# CHANGE ME!!
cd /home/<YOUR USER HERE>/${netblock}
masscan --rate=5000 -p1- -oG ${netblock}-masscan.grep ${cidr}
cat ${netblock}-masscan.grep | grep "Host:" | grep Timestamp | cut -f 3 -d " " | sort -u > living-hosts
cat ${netblock}-masscan.grep | grep "Host:" | grep Timestamp | cut -f 5 -d " " | cut -f 1 -d '/' | sort -u > portlist
for i in `cat portlist`; do
echo -n ${i},
done > portlist-commas
nmap -A -sS -sV -p $(cat portlist-commas | sed -e 's/,$//') -iL living-hosts -oA living-hosts -v -T3
# CHANGE ME!!
cd /home/<YOUR USER HERE>
done