Kaustubh2512/Port-Scanner
GitHub: Kaustubh2512/Port-Scanner
Stars: 0 | Forks: 0
# PortScanner
A lightweight, multi-threaded TCP port scanner written in Python.
## Usage
python port_scanner.py
### Examples
Scan common ports on a local machine:
python port_scanner.py 127.0.0.1 1 1024
Scan a remote host:
python port_scanner.py example.com 20 100
## How it works
1. Resolves the target hostname to an IP address
2. Spawns one thread per port in the specified range
3. Each thread attempts a TCP connection to the target IP on its assigned port
4. If the connection succeeds (port is open), the port number is recorded
5. After all threads finish, sorted open ports are displayed
## Requirements
- Python 3.x
- No external dependencies (uses only the standard library)
## Output
==================================================
Target : 127.0.0.1
Ports : 1 - 1024
Started : 2026-05-26 12:00:00
==================================================
Scan complete. 3 open port(s) found.
[OPEN] Port 80
[OPEN] Port 443
[OPEN] Port 3306