Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Port Scanner (Python)

A minimal, threaded TCP port scanner with host resolution and service detection.

Features

  • Resolve hostname to IP and reverse DNS lookup
  • Validate IPv4/IPv6 addresses
  • Threaded TCP connect scans: open/closed/filtered
  • Basic service detection via well-known ports and getservbyport

Requirements

  • Python 3.8+
  • No external dependencies
  • Tests use pytest

Setup

# optional: create & activate a virtual environment
python -m venv .venv
# Windows PowerShell
. .venv/Scripts/Activate.ps1
# or Git Bash
source .venv/Scripts/activate

# install test dependency (optional if you only run the script)
pip install -U pytest

Usage

# Run a simple scan (defaults inside scanner.py)
python scanner.py

By default, it resolves and scans the first 1024 TCP ports of scanme.nmap.org using 50 threads. To change the target, edit the target variable in scanner.py.

Running Tests

pytest -q

A pytest.ini is included so the project root is on the import path.

Project Structure

port-scanner/
├─ scanner.py             # main scanner module & CLI entry
├─ pytest.ini             # ensures project root on PYTHONPATH for tests
├─ tests/                 # unit tests
└─ README.md              # this file

Notes

  • Scan only hosts you have permission to test.
  • Adjust timeouts/threads carefully to avoid false "filtered" or network overload.

About

threaded TCP port scanner with host resolution and service detection

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages