A lightweight multithreaded port scanner written in Python that detects open ports on a target host. This project was made to gain a better understanding of core networking concepts and techniques such as sockets, port scanning, and multithreaded execution.
- Scan a range of TCP ports on a target IP address
- Detect open ports using Python sockets
- Multithreaded execution for quicker execution time
- Detailed output logs of scan results
- Config file for easy customization
- Easy to use CLI arguments
Enter target IP address: 192.168.1.1
Enter lowest port to scan (Default: 1): 1
Enter highest port to scan (Default: 1024): 1024
Enter output filename (Default: 'logs/port_scan_log.txt'): logs/log01.txtScanning for open ports [1 - 1024] on '192.168.1.1'...
Scan completed in 0:00:02.022091 seconds.
Found 1 open port(s). Wrote output to 'logs/log01.txt'.
Clone the repository:
git clone https://github.com/aivy23cloud/python-port-scanner.git
Navigate to the project folder:
cd python-port-scanner
You can provide the target IP, port range, and output filename directly.
python main.py --ip 192.168.1.1 --ports 1-1024 --out logs/log01.txt
--ip: Target IP address--ports: Port range in the formlow-high--out: Output filename--use-defaults: Use the defaults from the config file where applicable
Any argument omitted without the --use-defaults flag will result in additional prompting.
python main.py
Answer prompted questions unless a default is stated
This project was built to strengthen my understanding of:
- Basic python syntax and usage
- Utilization of multithreading for improved performance
- Basic networking concepts such as sockets and ports
- Secure input validation and error handling
- Implement banner grabbing and service detection
This tool is strictly intended for learning purposes on systems you are permitted to test or own.