Skip to content

Commit d081c8c

Browse files
committed
adding nmap helper
1 parent 837448c commit d081c8c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

scripts/tonmap.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
3+
TARGETSFILE="$1"
4+
PORTSFILE="$2"
5+
6+
if [ -z "$1" ]
7+
then
8+
TARGETSFILE="naabu_output_targets.txt"
9+
fi
10+
if [ -z "$2" ]
11+
then
12+
PORTSFILE="naabu_output_ports.txt"
13+
fi
14+
15+
16+
# truncate files
17+
truncate -s 0 $TARGETSFILE
18+
truncate -s 0 $PORTSFILE
19+
20+
while IFS=: read ip port; do
21+
echo $ip>>$TARGETSFILE
22+
echo $port>>$PORTSFILE
23+
done
24+
25+
# sort output
26+
sort -u -o $TARGETSFILE $TARGETSFILE
27+
sort -u -o $PORTSFILE $PORTSFILE
28+
29+
# in ports replace newline with comma
30+
ports=`cat $PORTSFILE | tr '\n' ','`
31+
32+
# parse and prepare nmap command
33+
echo "nmap -iL $TARGETSFILE -p ${ports:0:-1} -sV"

0 commit comments

Comments
 (0)