-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnmapScanTCPPn.sh
More file actions
executable file
·34 lines (22 loc) · 920 Bytes
/
nmapScanTCPPn.sh
File metadata and controls
executable file
·34 lines (22 loc) · 920 Bytes
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
#!/usr/bin/env bash
#sample usage
echo "USAGE: $0 <inputip> <outputfile>"
echo ""
if [ $# -ne 2 ]; then
echo "the script requires exactly 2 arguments please check the usage"
echo ""
exit
fi
#for displaying the number of arguments suplied
#echo "$#"
#ports=$(nmap -p- --min-rate=1000 -T4 $1 | grep ^[0-9] | cut -d '/' -f1 | tr '\n' ',' | sed s/,$//)
ports=$(nmap -sT -Pn -p0-65535 --min-rate=1000 -T4 $1 | grep ^[0-9] | cut -d '/' -f1 | tr '\n' ',' | sed s/,$//)
#ports=$(nmap -sU -sT -p0-65535 --min-rate=1000 -T4 -iL $1 | grep ^[0-9] | cut -d '/' -f1 | tr '\n' ',' | sed s/,$//)
echo "the ports found are: $ports"
# use -PN if nmap probes do not detect a host
# nmap -PN -sC -sV -p$ports $1 -oN $2
echo $2
nmap -A -v -Pn -p$ports $1 -oA $2
#_____________________ to run from a file_____________________________
#nmap -A -v -p$ports -iL $1 -oN $2
#nmap -A -sS -v -p$ports $1 -oN $2