Nmap ("Network Mapper") is a free and open source (license) utility for network exploration or security auditing. Many systems and network administrators also find it useful for tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime. Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. It was designed to rapidly scan large networks, but works fine against single hosts. Nmap runs on all major computer operating systems, and official binary packages are available for Linux, Windows, and Mac OS X. In addition to the classic command-line Nmap executable, the Nmap suite includes an advanced GUI and results viewer (Zenmap).
I would like to share few very good and handy features of Nmap which can help a system and network administrator very much in daily life.
Get list of servers with a specific port open
nmap -sT -p 80 -oG – 192.168.1.* | grep open
Find all active IP addresses in a network
nmap -sP 192.168.1.0/24
Ping a range of IP addresses
nmap -sP 192.168.1.100-200
nmap -F -O 192.168.1.1-255 | grep “Running: " > /tmp/os; echo “$(cat /tmp/os | grep Linux | wc -l) Linux device(s)"; echo “$(cat /tmp/os | grep Windows | wc -l) Window(s) devices"
Scan for the Conficker virus on your LAN ect.
nmap -PN -T4 -p139,445 -n -v –script=smb-check-vulns –script-args safe=1 192.168.1.1-254
There are many more and you don’t need to remember all these commands, to save yourself from remembering these command download the latest GUI Zenmap and choose the appropriate command to execute.