Nmap, also known as Network Mapper, is a versatile tool for network discovery and security auditing. It was designed to rapidly scan large networks, though it also works well against single hosts. Nmap enables users to identify available hosts on a network, ports that are open on those hosts, services that those hosts are offering, and the operating systems that they are running. To use Nmap from a command prompt, you must first ensure you have it installed on your computer.
The basic syntax for the Nmap command is as follows: `nmap [Scan Type] [Options] {target specification}` (Nmap, n.d.). The `Scan Type`, `Options`, and `target specification` fields can all be modified according to the type of network scan you want to perform.
Before beginning an Nmap scan, it is necessary to open a command prompt. On Windows, this can be done by typing `cmd` in the search bar or by pressing `Win+R` and then typing `cmd`. On Unix-like systems such as Linux or macOS, you can open a terminal.
A simple command to use to begin learning Nmap from the command line may be something like: `nmap target_IP`, where `target_IP` is the IP address of the host you want to scan. This simple scan can tell you if the target host is online and what ports are open.
Different scanning techniques can be used with nmap, such as the TCP connect scan `-sT`, the SYN scan `-sS`, the UDP scan `-sU` and many more. For instance, the command `nmap -sT target_IP` will perform a full TCP connect scan.
If you want to check what version of the services are running on the target, you can use the `-sV` command as follows: `nmap -sV target_IP`.
It is also possible to detect which operating system a host is using through the `-O` flag: `nmap -O target_IP`.
The `-p` flag allows the scan of specific ports or range of ports: `nmap -p80, 8080, 22-25 target_IP`.
Remember that some Nmap commands require root privileges, so in Unix-like systems, you may need to add `sudo` before the nmap command.
A full list of commands and their functions can be found in the official Nmap documentation (Nmap, n.d.).
Remember that while Nmap is a powerful tool, it should only be used responsibly and legally. Unauthorized scanning of networks may be considered illegal in certain jurisdictions.
Sources:
- Nmap Network Scanning. (n.d.). Retrieved from https://nmap.org/book/man.html
- Krebs, B. (2018, May 29). Basic guide to Nmap. Retrieved from https://krebsonsecurity.com/2018/05/a-basic-guide-to-nmap/.
- Nmap Tutorial: from the Basics to Advanced Tips. (2020, March 20). Retrieved from https://www.guru99.com/nmap-tutorial.html.
Please note that Nmap commands can vary depending on the system where they are being run. The commands listed above may not work on all systems.