A fast, lightweight and simple TCP port scanner written in Python
Blogposts:
Make sure you have python >= 3.10 installed.
- Clone the repo & navigate to the directory:
git clone https://github.com/snowlock-dev/pyScan.git
cd pyScan-
Install the dependencies (
pip install -r requirements.txt) -
Launch the interactive script:
python pyscan.py
You will be prompted to enter:
- Host IP / Name (Default: 127.0.0.1)
- Start Port (Default: 1)
- End Port (Default: 1024)
Unit tests are located in the tests/ directory and use pytest with unittest.mock to simulate network connections without requiring real network traffic.
The test suite verifies:
- Single open port detection
- Closed port handling
- Concurrent range scanning across multiple ports
- And edge cases
To run the tests locally:
python -m pytest- [x]
Add Github CI/CD tests - Swapping full TCP connections for raw SYN (half-open) packet crafting using Scapy
- Probing open ports to read service headers and automatically identify running software
- Benchmarking Python's single-threaded
asyncioevent loop againstThreadPoolExecutorto see which handles high concurrency better - Adding
argparsesupport for custom port ranges and outputting scan results directly to JSON