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

Skip to content

Commit 53e25a9

Browse files
authored
Create get_hosts.sh
1 parent 95814b6 commit 53e25a9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

get_hosts.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# ./get_hosts.sh 192.168.0.0/24
4+
5+
SS="$1"
6+
FF=`echo $SS | tr '/' '-'`
7+
sudo nmap -p22,139,445,80,443 -T5 $SS -oG "$FF"_nmap_NP -Pn -vv
8+
sudo nmap -v -sn $SS -T5 -oN "$FF"_nmap_PS -vv
9+
grep -i "host is up" -B1 "$FF"_nmap_PS.nmap | grep report | rev | cut -d' ' -f1 | tr -d '()' | rev >> "$FF"_up.ip.tmp
10+
grep /open/ "$FF"_nmap_NP.gnmap | cut -d' ' -f2 >> "$FF"_up.ip.tmp
11+
cat "$FF"_up.ip.tmp | sort -u > "$FF"_up.ip

0 commit comments

Comments
 (0)