Skip to content

bazokhan/port-dashboard

Repository files navigation

Port Process Dashboard

A lightweight Windows dashboard for monitoring and managing processes that hold network ports. Built with FastAPI and served locally, it gives you a real-time view of every port-holding process on your machine with one-click kill controls and built-in system process protection.

Features

  • Real-time process list — auto-refreshes via Server-Sent Events every 5 seconds
  • Per-process details — PID, name, ports, protocol (TCP/UDP), CPU %, memory, uptime, user, parent process
  • Safe kill controls — single-process kill, bulk kill by name pattern, or kill all non-critical at once
  • 4-layer critical process protection — prevents accidental termination of Windows system processes
    • Hardcoded Windows system process names
    • System account ownership (NT AUTHORITY\SYSTEM, etc.)
    • System path detection (System32, SysWOW64, etc.)
    • User-defined never_kill.json overrides
  • User-configurable allowlistssafe_to_kill.json and never_kill.json let you tune what's protected
  • Admin elevation helper — re-launches with UAC elevation when access-denied errors appear
  • Confirmation modals — preview what will be killed before committing bulk operations

Requirements

  • Windows 10/11
  • Python 3.11+

Installation

# Clone the repo
git clone https://github.com/YOUR_USERNAME/port-dashboard.git
cd port-dashboard

# Install dependencies
pip install -r requirements.txt

Or just run install.bat which does the same thing.

Usage

python app.py

The dashboard opens automatically at http://localhost:8765.

Alternatively, run start.bat (or start.ps1 for PowerShell).

Tip: For full visibility into system processes, run as Administrator.

Configuration

Two optional JSON files in the project root let you customize which processes are protected:

File Purpose Default contents
safe_to_kill.json Always killable, even if owned by a system account ["node.exe", "python.exe", ...]
never_kill.json Always protected, regardless of other checks ["lsass.exe", "csrss.exe", ...]

After editing either file, click Reload Config in the dashboard (or hit POST /api/config/reload) — no restart needed.

API Endpoints

Method Path Description
GET / Dashboard UI
GET /api/processes Snapshot of all port-holding processes
GET /api/stream SSE stream, pushes updates every 5 s
POST /api/kill/{pid} Kill a single process by PID
GET /api/kill/filter/preview?name=X Preview name-filter kill (dry run)
POST /api/kill/filter Execute name-filter kill
GET /api/kill/noncritical/preview Preview non-critical bulk kill
POST /api/kill/noncritical Execute non-critical bulk kill
POST /api/kill/bulk Kill a list of PIDs (body: [pid, ...])
GET /api/config Show current config + refresh interval
POST /api/config/reload Reload JSON config files from disk
POST /api/restart-elevated Re-launch with UAC admin elevation

Project Structure

port-dashboard/
├── app.py                  # FastAPI app, routes, SSE stream
├── process_manager.py      # psutil-based process/port data & kill logic
├── critical_processes.py   # 4-layer system process protection
├── requirements.txt
├── install.bat             # One-click dependency installer
├── start.bat               # Launch script (cmd)
├── start.ps1               # Launch script (PowerShell)
├── templates/
│   └── index.html          # Dashboard HTML
└── static/
    └── dashboard.js        # Frontend JS (SSE client, UI logic)

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors