Difference between revisions of "NetMan - nmap"
Line 3: | Line 3: | ||
==Some useful nmap scans== | ==Some useful nmap scans== | ||
− | === Using nmap to inventory a network === | + | ===Using nmap to inventory a network=== |
The following command with ''nmap'' with ''root'' privilegies (or using ''sudo''): | The following command with ''nmap'' with ''root'' privilegies (or using ''sudo''): | ||
− | <code>sudo nmap -sP 192.168.0.0/24 | awk '/Nmap scan report | + | <code>sudo nmap -n -sP 192.168.0.0/24 | awk '/Nmap scan report/{printf $5;printf "\t";printf $6;printf "\t";getline;getline;print $3;}' | awk '{printf $2;printf " ---> ";printf $1;printf "\n";}'</code> |
results in: | results in: | ||
− | 192.168.0. | + | 00:10:18:5D:B0:10 ---> 192.168.0.1 |
− | + | 28:C6:8E:F9:B8:BF ---> 192.168.0.2 | |
− | + | 28:C6:8E:29:9D:30 ---> 192.168.0.3 | |
... | ... | ||
− | |||
− | |||
− | |||
− | |||
(Good luck typing that in by hand...) | (Good luck typing that in by hand...) | ||
Revision as of 03:02, 19 December 2020
Some useful nmap scans
Using nmap to inventory a network
The following command with nmap with root privilegies (or using sudo):
sudo nmap -n -sP 192.168.0.0/24 | awk '/Nmap scan report/{printf $5;printf "\t";printf $6;printf "\t";getline;getline;print $3;}' | awk '{printf $2;printf " ---> ";printf $1;printf "\n";}'
results in:
00:10:18:5D:B0:10 ---> 192.168.0.1 28:C6:8E:F9:B8:BF ---> 192.168.0.2 28:C6:8E:29:9D:30 ---> 192.168.0.3 ...
(Good luck typing that in by hand...)
Want DNS?:
sudo nmap -sP 192.168.0.0/24 | awk '/Nmap scan report/{printf $5;printf "\t";printf $6;printf "\t";getline;getline;print $3;}' | awk '{printf $3;printf " ---> ";printf $1;printf "\n";}'
or both name & address?:
sudo nmap -sP 192.168.0.0/24 | awk '/Nmap scan report/{printf $5;printf "\t";printf $6;printf "\t";getline;getline;print $3;}' | awk '{printf $3;printf " ---> ";printf $2;printf "\t";printf $1;printf "\n";}'
But, for some reason, lack of a name causes odd formatting. And, nmap seems to fail to give the mac address of the machine doing the scan.