Python-Based Network Port Monitoring Tool
Overview
This project is a Python-based network port monitoring tool designed to continuously track the status of commonly used TCP ports and log real-time changes.
The tool simulates a Security Operations Center (SOC) monitoring use case by detecting when services unexpectedly open or close on a host system.
Why This Project Matters
In real-world environments, attackers often expose new services or open ports after gaining access. Continuous monitoring helps security teams quickly detect these changes.
This tool demonstrates:
- Defensive security thinking
- Python automation for cybersecurity
- Real-time change detection
- SOC-style monitoring logic
Features
- Monitors common TCP ports (e.g., 22, 80, 443, 3306)
- Logs port status changes (OPEN β CLOSED)
- Runs in Linux and Termux environments
- Lightweight and easy to extend
Technologies Used
- Python 3
- Linux / Termux
- Socket programming
- Logging mechanisms
Example Use Case
- Detect unauthorized service exposure
- Monitor system hardening effectiveness
- Support incident response investigations
- Baseline vs deviation analysis
Skills Demonstrated
- Python scripting for security
- Network fundamentals
- Continuous monitoring
- Defensive cybersecurity practices
- Linux command-line usage
π Project Structure
projects/ βββ bin/ # Executable scripts (Python, Bash) βββ logs/ # Output logs from scans βββ config/ # Configuration files and backups βββ notes/ # Documentation and markdown notes βββ tests/ # Experimental code or temporary files
π Usage
-
Clone the repository:
bash git clone https://github.com/okedeleoea/portscan_event.git cd portscan_event -
Run the script:
bash python3 bin/portscan_event.py -
View logs:
bash tail -f logs/ports_event.log
π Example Output
2026-01-15 10:59:00: Port 22 (SSH) changed to CLOSED 2026-01-15 10:59:00: Port 80 (HTTP) changed to CLOSED 2026-01-15 10:59:00: Port 443 (HTTPS) changed to CLOSED

Future Improvements
- Email or Telegram alerts
- JSON/CSV log export
- Configurable port lists
- Integration with SIEM tools
β¨ Author
Olanrewaju Emmanuel Okedele
Learning by doing β exploring Linux, Python, and cybersecurity through hands-on projects.
Disclaimer
This tool is intended for educational and defensive security purposes only.