A lightweight, multithreaded port scanner built in Python — inspired by Nmap. Built as part of a cybersecurity learning portfolio.
- ⚡ Multithreaded TCP Connect Scan (100 threads by default)
- 🏷️ Service & Banner Detection
- 🖥️ OS Fingerprinting via ICMP TTL
- 📁 Export results to JSON or CSV
# Scan common ports
python port_scanner.py scanme.nmap.org
# Scan port range
python port_scanner.py 192.168.1.1 -p 1-1024
# Export to JSON
python port_scanner.py scanme.nmap.org --export json| Flag | Description | Default |
|---|---|---|
-p |
Port range (1-1024, 80,443, common) |
common |
-t |
Timeout per port (seconds) | 1.0 |
--threads |
Number of parallel threads | 100 |
--export |
Export format: json or csv |
None |
--output |
Output filename | scan_results.* |
- TCP Connect Scan — performs a full 3-way handshake to check if a port is open
- Banner Grabbing — reads the service's greeting message to identify version
- OS Fingerprinting — analyses ICMP TTL value to guess the operating system
- Threading — uses Python's
ThreadPoolExecutorto scan ports in parallel
Only scan systems you own or have explicit permission to scan. Unauthorized port scanning may be illegal in your jurisdiction.
- Python 3.x
socket— TCP connections and raw ICMPconcurrent.futures— multithreadingargparse— CLI interfacejson/csv— result export