This project visualizes live network traffic using Flask, WebSockets, Scapy, and Leaflet.js. It captures network packets, retrieves geolocation data, and displays them dynamically on a real-time map.
✅ Live network packet capturing using Scapy ✅ Real-time WebSocket communication between Sniffer & Web UI ✅ Geolocation mapping for IP addresses ✅ Traffic statistics (connection count & data usage per country)
git clone https://github.com/kw-soft/PacketMonitor.git
cd PacketMonitorpip install -r requirements.txtScapy requires Npcap to capture packets on Windows. Download and install it from:
Make sure to check the option "Install Npcap in WinPcap API-compatible mode" during installation.
No additional installation is required, as Scapy uses native network interfaces. Ensure you have the necessary permissions to capture packets:
sudo setcap cap_net_raw,cap_net_admin=eip $(which python3)python server.pypython sniffer.pyGo to http://127.0.0.1:8080 in your browser.
/your_project_directory
│── server.py # Flask WebSocket server with geolocation
│── sniffer.py # Network sniffer using Scapy
│── requirements.txt # Python dependencies
│── /templates
│ └── index.html # Frontend UI
Edit sniffer.py and update the network interface:
iface = "Intel(R) I211 Gigabit Network Connection" # Change to your actual interfaceFind your interface using:
ifconfig (Linux/macOS)
ipconfig (Windows)By default, server.py uses ip-api.com for IP geolocation. To use ipinfo.io, update the token:
fetch("https://ipinfo.io/json?token=YOUR_API_TOKEN")This project is licensed under the MIT License.
Pull requests are welcome! Feel free to fork this repository and submit a PR.
- Fork the repo
- Create a new branch (
feature-xyz) - Commit your changes (
git commit -m "Added new feature") - Push & create a PR
📧 Your Email: kevin@kevsoft.de
🐙 GitHub: KW-Soft