Port Scanning Methods
Introduction to Port Scanning
Port scanning is a critical technique in network reconnaissance and security assessment. It helps identify open ports, potential vulnerabilities, and network service configurations.
Basic Scanning Techniques
1. TCP Connect Scanning
TCP Connect scanning establishes a full TCP connection to each port:
## Basic TCP connect scan using nmap
nmap -sT 192.168.1.100
2. SYN Stealth Scanning
SYN scanning is more stealthy and doesn't complete the full connection:
## SYN stealth scan (requires root privileges)
sudo nmap -sS 192.168.1.100
Scanning Methods Comparison
Scan Type |
Connection |
Stealth Level |
Privileges Required |
TCP Connect |
Full Connection |
Low |
Normal User |
SYN Stealth |
Partial Connection |
High |
Root/Admin |
UDP Scan |
Connectionless |
Medium |
Root/Admin |
Advanced Scanning Techniques
graph TD
A[Port Scanning Methods] --> B[TCP Scanning]
A --> C[UDP Scanning]
A --> D[Advanced Techniques]
D --> E[Idle Scan]
D --> F[Window Scan]
D --> G[Fragmentation Scan]
Practical Scanning Example
A comprehensive port scan with multiple techniques:
## Comprehensive nmap scan
sudo nmap -sS -sV -p- 192.168.1.100
Scan Options Explained:
-sS
: SYN stealth scan
-sV
: Version detection
-p-
: Scan all ports
Ethical Considerations
LabEx emphasizes the importance of obtaining proper authorization before conducting port scans. Unauthorized scanning can be considered a cyber attack.
Best Practices
- Always get explicit permission
- Use scanning tools responsibly
- Understand legal implications
- Protect network infrastructure
- Nmap: Most popular port scanning tool
- Masscan: High-speed port scanner
- Zmap: Large network scanning utility
Security Implications
Port scanning helps:
- Identify open network services
- Detect potential security vulnerabilities
- Assess network configuration
- Prepare for penetration testing