A lightweight, multithreaded port scanner built in Python. Scan a target host (IP or domain) for open TCP ports and identify known services.
- Scans a specified range of TCP ports
- Resolves hostnames to IP addresses
- Identifies known services for open ports
- Multithreaded for fast scanning
- Optional output to file
All dependencies used are part of the Python standard library (no additional packages required).
python port_scanner.py <target> [options]##🔧 Options
| Option | Description | Default |
|---|---|---|
-p, --ports |
Port range to scan (e.g. 1-1024) |
1-1024 |
-t, --threads |
Number of threads to use for scanning | 100 |
-o, --output |
Save results to a file | None |
Basic scan of default ports (1-1024):
python port_scanner.py example.comScan ports 20 to 80 with 50 threads:
python port_scanner.py example.com -p 20-80 -t 50Scan and save results to scan_results.txt:
python port_scanner.py 127.0.0.1 -o scan_results.txtThis tool is intended for educational and authorized use only. Scanning networks without permission is illegal and unethical.