Nmap, short for Network Mapper, emerges as a command-line tool capable of scanning networks by sending packets and analyzing the responses. It’s particularly adept at identifying open ports and services running on a target system.
Scanning TCP Ports
Nmap’s TCP port scanning is robust. For instance, scanning ports 1 to 100 on a target:
nmap -p 1-100 <target>
To focus on specific ports, say 80, 443, and 8080:
nmap -p 80,443,8080 <target>
Or a comprehensive scan across all TCP ports (1 to 65535):
nmap -p- <target>
Scanning UDP Ports
UDP port scanning differs due to the protocol’s connectionless nature. Scanning UDP ports 1 to 100:
nmap -sU -p 1-100 <target>
For specific UDP ports, e.g., 53 and 161:
nmap -sU -p 53,161 <target>
Scanning Both TCP & UDP ports
nmap -sU -sT -p 53 <target>
or
`
nmap -sUT -p 53 <target>
`