Port Scanner

A Python network scanner that finds open ports, identifies services and their versions, checks them against known vulnerabilities (CVEs), guesses the operating system and tracks what changes between scans.

PythonSockets & threadingScapyNIST NVD API FlaskTkinterCyber security

Interactive demo

The web dashboard from the project, replaying a real recorded scan.

This page replays recorded results; it does not scan anything. A public website that scans networks could be used to attack people, so the real scanner runs on your own computer (see how to run it).
$ python port_scanner.py 127.0.0.1 -p 22,23,80,443,2222,3306,6379,8765 --udp --os --cve
Ready
0
Open ports
0
UDP open|filtered
0
Risky services
0
Known CVEs
0
Critical CVEs (CVSS 9+)

Results

HostPortStateServiceBanner / softwareRisk & CVEs
Press "Run demo scan".

Operating system

Shown when the scan finishes.

Changes since last scan of this target

Shown when the scan finishes.

Scan log


    

Features

Each part is a separate module under scanner/.

TCP connect scan

Multithreaded full-handshake scan. 1,024 ports in under a second on localhost.

SYN (half-open) scan

Raw packets with scapy: SYN, SYN-ACK, RST. The connection is never completed. Needs root.

UDP scan

Real DNS, NTP, SNMP, NetBIOS and SSDP probes, so silent services still answer.

Banner grabbing

Reads service greetings and HTTP Server: headers to identify software versions.

CVE lookup

Maps versions to CPE names, queries the NIST NVD and ranks CVEs by CVSS score.

OS fingerprinting

Combines ping TTL, TCP window size and banners, and shows the evidence for its guess.

Scan comparison

Saves every scan and reports new, closed or changed ports, as attack-surface monitoring does.

Three interfaces

Command line, Tkinter desktop GUI and a Flask web dashboard, all sharing one engine.

Run it yourself

Needs Python 3.8 or later. Only scan systems you own or have permission to test.

git clone https://github.com/naga52141/port-scanner.git
cd port-scanner
python3 -m venv .venv
source .venv/bin/activate            # Windows: .venv\Scripts\activate
pip install -r requirements.txt

python port_scanner.py 127.0.0.1 -p top -A   # command line, all checks
python gui.py                                # desktop GUI
python web_app.py                            # dashboard at http://127.0.0.1:5050

How OS fingerprinting works

Every OS starts packets with a default TTL, and each router on the way subtracts 1.

Initial TTLOS family
64Linux, macOS, Android, BSD
128Windows
255Routers and switches, Solaris

A reply with TTL 116 most likely came from Windows (128), about 12 hops away. Banners such as OpenSSH_8.2p1 Ubuntu are stronger evidence, so they override the TTL guess. The scanner reports its confidence and the evidence it used.