Nmap (Network Mapper) is a popular and versatile network scanning tool used for network discovery, security auditing and more. It comes pre-installed in Kali Linux, a penetration testing and ethical hacking Linux distribution. Using Nmap is easy in Kali Linux, allowing you to scan networks and systems effectively.
Introduction to Nmap
Nmap allows scanning single hosts, subnets, whole networks or even entire countries using raw IP packets. It determines which hosts are up, what services they offer, the operating system they run etc without requiring agent software.
Some key uses of Nmap include:
Network Inventory
Managing service upgrade schedules
Monitoring host or service uptime
Detecting open ports & vulnerabilities
Security auditing
Installing Nmap in Kali Linux
Nmap comes pre-installed in Kali Linux. To confirm, open a terminal and type:
nmap
This will display the Nmap help output, confirming it is installed and ready to use.
If Nmap is not already installed for any reason, use:
apt-get install nmap
Using Nmap in Kali Linux
Nmap is very simple to use in Kali Linux. Some useful basic scans include:
Ping Scan
This scans whether hosts are online and reachable:
nmap -sn 192.168.1.1/24
Port Scan
Scans open ports on the target:
nmap 192.168.1.1
Operating System Detection
Tries detecting which OS the target is running:
nmap -O 192.168.1.1
More Advanced Scans
Nmap offers many more scan types such as UDP scans, IP protocol scans, FTP bounce scans etc for advanced discovery and vulnerability detection.
Some useful examples:
nmap -sU -p 53 192.168.1.1/24 # UDP scan
nmap -sO 192.168.1.1 # IP protocol scan
nmap --script vuln 192.168.1.1 # Detect vulnerabilities
There are many more options covered in detail in the official Nmap guide.
Using Nmap Scripts
Nmap offers scripts for more advanced functionality such as:
Vulnerability detection
Backdoor detection
Reconnaissance etc
Scripts are easy to use. For example:
nmap --script ftp-brute 192.168.1.1
Many scripts come bundled with Kali Linux and Nmap. You can find these in /usr/share/nmap/scripts
.
More scripts can also be downloaded from the Nmap script page and added to this folder.
Automating Nmap
Instead of interactively using Nmap, you can write scripts to automate scanning. Useful for:
Periodic network monitoring
Testing new vulnerabilities
Batch vulnerability assessments
Some options to automate Nmap:
This makes Nmap easy to schedule and integrate into other tools.
Conclusion
Nmap is a versatile network and security scanner pre-installed in Kali Linux. It can be used for basic ping/port scans, detecting vulnerabilities and automating security tests. Kali Linux makes it very easy to get started with Nmap. Consider using some of the scans and scripts outlined here next time you are assessing a network!