Skip to content

Port-Stat is a lightweight Python tool that monitors your system for newly opened ports in real time. It detects changes, maps ports to processes, supports ignore lists, and offers optional JSON logging. Perfect for quick IR, dev monitoring, and security visibility without complexity.

License

Notifications You must be signed in to change notification settings

Alexander-50/Port-Stat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔍 Port-Stat — Real-Time Port Activity Monitor

Port-Stat is a lightweight, cross-platform, real-time port monitoring tool designed for security analysts, developers, and incident responders. It continuously watches for newly opened listening ports and instantly alerts you when any process starts a new network listener. This helps detect suspicious activity, reverse shells, rogue services, or unexpected dev server launches.

✨ Features

  • ⚡ Real-time detection of newly opened ports
  • 🧠 Process-aware alerts (process name + PID)
  • 🎛 Ignore lists for ports & processes
  • 🗂 Optional JSON logging (NDJSON format)
  • 🔁 Unbuffered, live output (Windows/Linux/macOS)
  • 🪶 Requires only one dependency (psutil)

System-Architecture

architectural-diagram

📦 Installation

git clone https://github.com/Alexander-50/Port-Stat.git
cd Port-Stat
pip install -r requirements.txt

🛠 Usage

Basic monitoring

python monitor.py

Scan every 2 seconds

python monitor.py --interval 2

Ignore specific ports

python monitor.py --ignore-ports 3000,5000,8000

Ignore specific processes

python monitor.py --ignore-procs python,node

Enable JSON logging

python monitor.py --json-log logs/events.json

📌 Example Output

outputcli-port-stat

📁 Project Structure

Port-Stat/
│── monitor.py
│── requirements.txt
│── README.md
│── .gitignore
│
├── samples/
│   ├── sample_output.txt
│   └── events_sample.json
│
└── logs/   (auto-created when using --json-log)

🧪 Sample Logs (JSON)

{"timestamp": "2025-11-20T18:22:25.882104", "port": 8080, "process": "python.exe", "pid": 9214, "type": "new_port"}
{"timestamp": "2025-11-20T18:22:33.441552", "port": 9999, "process": "python.exe", "pid": 10482, "type": "new_port"}

🎯 Use Cases

  • Debug dev servers (Flask, Node, Django, etc.)
  • Catch reverse shells / malware activity
  • Monitor real-time system behavior
  • Helpful for SOC, IR, Pentesting, DevOps

🤝 Contributing

Pull requests are welcome! Improve features, add monitoring modes, or enhance detection logic.

⭐ Support the Project

If you find Port-Stat useful, consider starring ⭐ the repository.


👨‍💻 Author

Alexander P.B.
Cybersecurity Researcher & Penetration Tester
Red Team & IoT Security Specialist

📧 Reach out via GitHub for research collaborations.


About

Port-Stat is a lightweight Python tool that monitors your system for newly opened ports in real time. It detects changes, maps ports to processes, supports ignore lists, and offers optional JSON logging. Perfect for quick IR, dev monitoring, and security visibility without complexity.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages