Port Scanning Tools
Port scanning is a technique used in network security to identify open ports, discover accessible services, and understand the network exposure of a target system. Ethical hackers and penetration testers use port scanning to assess systems within an authorized scope.
What You'll Learn
- Understand TCP and UDP ports.
- Learn the difference between open, closed, and filtered ports.
- Discover listening services on authorized systems.
- Perform TCP and UDP port scans.
- Identify service versions and potential security risks.
- Interpret scan results and document findings.
Tools Covered
| Tool | Description |
|---|---|
Nmap | Discover hosts, scan ports, identify services, and perform supported OS detection. |
Masscan | Perform high-speed port scanning across large address ranges when appropriately configured. |
RustScan | Quickly discover open ports and integrate with Nmap for further analysis. |
Unicornscan | Perform asynchronous TCP and UDP network scanning. |
Netcat | Test connectivity to specific TCP or UDP ports. |
Naabu | Perform fast port discovery using configurable scanning methods. |
ZMap | Scan large network address spaces for specific ports or services under controlled conditions. |
Types of Port Scanning
1. TCP Connect Scan
Establishes a full TCP connection to determine whether a port is accessible.
2. SYN Scan
Sends TCP SYN packets to examine port states without completing a full TCP connection in the usual case.
3. UDP Scan
Checks UDP ports. Results can be ambiguous because many UDP services do not respond to unexpected probes.
4. Service and Version Detection
Attempts to identify the service and its version running on an accessible port.
5. Operating System Detection
Uses network response characteristics to estimate the target operating system. Results are not always definitive.
Learning Path
- Port Fundamentals — Understand TCP, UDP, and common service ports.
- Basic Scanning — Start with Nmap on a local lab.
- Scan Types — Explore TCP connect, SYN, and UDP scanning.
- Service Detection — Learn to identify services and versions.
- Fast Port Discovery — Understand tools such as RustScan and Naabu.
- Result Analysis — Document exposed services and investigate security implications.
Basic Examples
Use these examples only on systems you own or have explicit permission to test.
Scan a Local Lab Host
nmap 192.168.1.10
Scan Specific Ports
nmap -p 22,80,443 192.168.1.10
Scan All TCP Ports
nmap -p- 192.168.1.10
Detect Services and Versions
nmap -sV 192.168.1.10
Perform a TCP Connect Scan
nmap -sT 192.168.1.10
Check a Specific Port with Netcat
nc -vz 192.168.1.10 80
Replace 192.168.1.10 with your own lab machine's IP address. Scan duration and results depend on network conditions, firewall rules, and the target's configuration.
Understanding Port States
| State | Meaning |
|---|---|
Open | An application is accepting connections or responding as an active service. |
Closed | The host is reachable, but no service is listening on that port. |
Filtered | A firewall or network obstacle prevents Nmap from determining whether the port is open. |
| `Open | Filtered` |
| `Closed | Filtered` |
Prerequisites
- Basic networking knowledge.
- Understanding of TCP, UDP, IP addresses, and common ports.
- Familiarity with Linux terminal commands.
- A local virtual machine or authorized practice lab.
Practice and Safety
Port scanning can generate network traffic and trigger security alerts. Scan only authorized systems and stay within the agreed scope. Avoid scanning public IP ranges or third-party infrastructure without explicit permission.
Next Steps
After learning port scanning, continue to:
- Web Enumeration — Discover web directories, endpoints, and application resources.
- Web Testing — Assess web applications for security vulnerabilities.
- Exploitation — Study how validated vulnerabilities may affect systems in controlled labs.
Ugenz Academy — Learn • Build • Protect • Grow.