NMAP — The Network Enumerator

Network-Mapper (nmap), is the most famous port scanning tool used by penetration testers. Nmap is also showed in movies or series like The Matrix and Mr. Robot . In this article, we will look at the various features of Nmap along with a few useful commands.

What is Nmap?

Nmap is the short form for Network Mapper. It is an open-source Linux command-line tool that is used to scan IP addresses and ports in a network and to detect installed applications. Nmap allows network admins to find out the devices running on their network, discover open ports and services, and detect vulnerabilities.

NMAP Command Syntax

nmap [ <Scan Type> ] [ <Options> ] { <target specification> }
man nmap

Common Nmap scan types:

Nmap have various scan types according to your needs. Common ones are SYN scan (-sS),TCP connect scan(-sT), UDP scan(-sU). Note that the SYN scan and TCP scan utilizes the three-way handshake:

Common Nmap options:

Nmap has tons of options depending what you need for your scan. On a basic level, you should be using the following:

Common Nmap target specification:

Nmap allows various target specifications, but can simple be divided into 2 parts: port and IP/host.

+--------+---------------------------+---------------------------+
| Switch | Description | Example |
+--------+---------------------------+---------------------------+
| -p | Port or port range. | nmap -p 22-80 10.10.224.1 |
+--------+---------------------------+---------------------------+
| -p- | Scan all ports. | nmap -p- 10.10.224.145 |
+--------+---------------------------+---------------------------+
| -F | Fast port scan. (top 100) | nmap -F 10.10.224.145 |
+--------+---------------------------+---------------------------+
+--------+---------------------------+---------------------------+
| Description | Example |
+--------+---------------------------+---------------------------+
| Scanning a specific hostname | nmap target.domain.com |
+--------+---------------------------+---------------------------+
| Scanning a specific IP address | nmap 10.10.224.145 |
+--------+---------------------------+---------------------------+
| Scanning a network range | nmap 10.10.224.1-254 |
+--------+---------------------------+---------------------------+

Commonly used Scan Combinations

nmap -sC -sV -oA <file_name> <ip or target>

Nmap Scripting Engine

When we talk about nmap we can’t forget NSE . NSE scripts is the thing that make nmap so powerful . Nmap Scripting Engine (NSE) is an incredibly powerful tool that you can use to write scripts and automate numerous networking features. You can find plenty of scripts distributed across Nmap, or write your own script based on your requirements. You can even modify existing scripts using the Lua programming language.

Zenmap

Zenmap is Graphical user interface for Nmap.

Conclusion

Nmap is a very useful tool not only for security professionals but for IT practitioners because of its versatility and it’s clear like a sky that NMAP is “SWISS ARMY KNIFE” of networking.

References

  1. https://nmap.org/book/man-port-scanning-techniques.html
  2. https://nmap.org/book/toc.html
  3. man nmap