How saugat-sapkota-2/python-port-scanner. works
This is a TCP port-scanning application with two user-facing workflows: a Flask web interface and a Textual terminal UI. Each accepts a target and port range, runs a scan, enriches open ports with banners and optional OS fingerprinting, then generates a JSON report. The web workflow also exposes scan status and report downloads. The main orchestrators are shown separately from the scanner modules they invoke; the TUI excerpt omits some worker code, so only visible or indexed relationships are included.
Main entry points: app.py Flask App · tui.py Terminal UI · tcp_scanner.py TCP Scanner · banner_grabber.py Banner Grabber
Components 13
User Interfaces
- Web Page
templates/index.html - Terminal UI
tui.py
Scan Workflows
- Flask App
app.py - Scan State
app.py
Scan Analysis
- TCP Scanner
scanner/tcp_scanner.py - Banner Grabber
scanner/banner_grabber.py - OS Fingerprinting
scanner/os_fingerprint.py
Reports
- Report Generator
scanner/report.py - JSON Report Files
Other components
- Web User
- Terminal User
- Nmap
- Target System
Connections 17
- Web User → Flask App: starts scan
app.py - Flask App → Web Page: renders
app.py - Flask App → Scan State: updates state
app.py - Flask App → TCP Scanner: scans ports
app.py - Flask App → Banner Grabber: grabs banners
app.py - Flask App → OS Fingerprinting: detects OS
app.py - Flask App → Report Generator: generates report
app.py - Flask App → JSON Report Files: serves download
app.py - Terminal User → Terminal UI: starts scan
tui.py - Terminal UI → TCP Scanner: scans ports
tui.py - Terminal UI → Banner Grabber: grabs banners
tui.py - Terminal UI → OS Fingerprinting: detects OS
tui.py - Terminal UI → Report Generator: generates report
tui.py - OS Fingerprinting → Nmap: runs detection
scanner/os_fingerprint.py - TCP Scanner → Target System: checks ports
scanner/tcp_scanner.py - Banner Grabber → Target System: reads banners
scanner/banner_grabber.py - Report Generator → JSON Report Files: writes JSON
scanner/report.py