Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 070f632

Browse files
authored
Update autoscan.sh
1 parent 5f8023c commit 070f632

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

autoscan.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ stages=($stage0 $stage1 $stage2 $stage3 $stage4 $stage5 $stage6 $stage7 $stage8
3333
mkdir machines 2>/dev/null
3434
mkdir general 2>/dev/null
3535
mkdir tmp 2>/dev/null
36-
echo '' > ./tmp/doneips_autoscan
36+
echo '' > ./tmp/specific_ips
3737
ip4=$(ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
3838
echo "$ipv4" >> ./exc.txt
3939

@@ -91,25 +91,27 @@ do
9191

9292
# very fast option
9393
# nmap -p ${stages[$X]} --min-rate 5000 --max-rtt-timeout 1250ms --min-rtt-timeout 100ms --initial-rtt-timeout 500ms --max-retries 1 -sS -Pn -n -sU -vv -iL ./targets.txt -oA general/stage$X-quick
94+
95+
echo "STARTING SPECIFIC IPs STAGE $X" >> ./tmp/stage
9496

9597
grep -h /open/ general/stage$X-*-quick.gnmap | cut -d' ' -f2 | sort -u > general/up.ip
9698

9799
for IP in `cat general/up.ip`
98100
do
99101
PP=$(cat general/stage$X-*-quick.gnmap | grep $IP | grep -oP '\d{1,5}/open/[tcpud]{3}' | awk '{if($3 =="tcp")print "T:"$1;else if($3 =="udp")print "U:"$1}' FS='/' | sort -u | xargs | tr ' ' ',')
100-
if grep -q "specific $IP" ./tmp/doneips_autoscan
102+
if grep -q "specific $IP" ./tmp/specific_ips
101103
then
102-
if grep -q "DONE specific $IP" ./tmp/doneips_autoscan
104+
if grep -q "DONE specific $IP" ./tmp/specific_ips
103105
then
104106
continue
105107
else
106108
nmap --resume machines/$IP-stage$X-open.xml
107109
fi
108110
else
109-
echo "STARTING specific $IP" >> ./tmp/doneips_autoscan
111+
echo "STARTING specific $IP" >> ./tmp/specific_ips
110112
nmap -p$PP $IP -A -sS -sC -sU -oA machines/$IP-stage$X-open -vv -Pn
111113
fi
112-
echo "DONE specific $IP" >> ./tmp/doneips_autoscan
114+
echo "DONE specific $IP" >> ./tmp/specific_ips
113115
done
114116
echo "ENDING STAGE $X" >> ./tmp/stage
115117
done

0 commit comments

Comments
 (0)