PYTHON / TCP PORTS

PortScope

Inspect the TCP ports within your scope.

PortScope is a lightweight multithreaded TCP port scanner written in Python. It resolves a hostname or IPv4 address, checks a specified port range and reports open ports with their standard service names. The command-line interface exposes the range, socket timeout and worker count.

Runs on
Python 3.10+
Repository created
View source on GitHub
README example
$ python3 main.py 127.0.0.1 --start 20 --end 100
# Target: local loopback address
# Scope: TCP ports 20 through 100
# Open-port results depend on the local system
Documented README command. The notes describe its scope; they are not scan output. Read the original example on GitHub, opens in a new tab.

What it does

  • Resolve a target hostname or IPv4 address.
  • Check TCP ports concurrently with ThreadPoolExecutor.
  • Choose a port range, socket timeout and number of workers.
  • Display open ports alongside standard service names when available.

Run the documented example

Run the example from the repository root to check ports 20 through 100 on the local loopback address. The README also documents python3 main.py localhost --start 1 --end 1000 for hostname-based input. Options such as --timeout 0.5 --workers 50 adjust the socket timeout and concurrency. Select settings that suit the system and network you are authorized to assess.

Interpret the scan carefully

A port scan is a view of connection behavior at the time of the check. A standard service name is a conventional association with a port number, not proof of the application actually listening there. An open port alone does not establish a vulnerability. PortScope is intended for education, security labs and systems you own or have explicit permission to test. It uses only the Python standard library.

Inside the code

The repository separates target resolution, scanning, service lookup and CLI orchestration. Unit tests cover the scanner, service lookup and target handling. Reviewing those modules is useful for understanding how concurrent socket checks are organized and how the terminal report is assembled. Full usage examples and test commands are available in the GitHub README.