Skip to content
Back to projects
Cover
PERSONAL PROJECT

Network Scanner (FastAPI + React)

Network Scanner (FastAPI + React)

Real-time network scanner — FastAPI backend + WebSocket + React/Vite UI

Context

Personal network security project: a full-stack local network scanner capable of identifying live hosts and open ports on a LAN segment, streaming results in real time via WebSocket, and classifying each service by risk level. Built in two layers: a Python FastAPI backend with concurrent threads, and a React/Vite frontend displaying results live.

Features Built

  • Host discovery: local subnet resolution and ping sweep to list all live hosts
  • Concurrent port scanning via ThreadPoolExecutor — all top ports probed in parallel per host
  • 45-service detection table (HTTP, SSH, RDP, MSSQL, Redis, MongoDB, Docker, K8s...)
  • Risk classification (high / medium / low) per port via RISK_MAP (Telnet, RDP, exposed DBs...)
  • Real-time WebSocket streaming — results pushed to frontend as each host completes
  • React/Vite frontend: live host cards, risk-colour-coded port badges, scan progress indicator

Stack & Technologies

  • Python 3 + FastAPI — REST API and WebSocket backend
  • uvicorn — ASGI server for FastAPI
  • ThreadPoolExecutor — Concurrent port scanning (stdlib concurrent.futures)
  • WebSockets — Real-time backend → frontend streaming
  • React 18 + Vite — Live-updating SPA frontend
  • CORS middleware — Cross-origin backend/frontend integration

How It Works

  1. 1
    Host discovery
    Backend resolves the local subnet and pings each IP to build the list of live hosts.
  2. 2
    Concurrent port scan
    For each live host, a ThreadPoolExecutor probes the TOP_PORTS list in parallel — open ports and service names collected.
  3. 3
    Risk classification
    Each open port is looked up in RISK_MAP and tagged high / medium / low based on known exposure risk.
  4. 4
    WebSocket streaming
    Results pushed to frontend in real time as each host finishes scanning — no need to wait for the full scan.
  5. 5
    React rendering
    Frontend receives JSON events via WebSocket and renders host cards with colour-coded port badges on the fly.

Technical Highlights

Transport
WebSocket (FastAPI + uvicorn)(Real-time streaming)
Concurrency
ThreadPoolExecutor(Parallel port probing per host)
Port coverage
45 services(KNOWN_SERVICES dict)
Risk levels
3 levels(High / Medium / Low via RISK_MAP)
Dependencies
Minimal(fastapi, uvicorn, websockets + React/Vite)

Screenshots

Screenshot 1