Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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.

License

Notifications You must be signed in to change notification settings

kw-soft/PacketMonitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PacketMonitor

📌 Project Overview

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.

🚀 Features

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)


🛠 Setup Instructions

1️⃣ Clone the Repository

git clone https://github.com/kw-soft/PacketMonitor.git
cd PacketMonitor

2️⃣ Install Dependencies

pip install -r requirements.txt

3️⃣ Install Required Network Capture Tools

Windows

Scapy 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.

Linux/macOS

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)

4️⃣ Run the WebSocket Server

python server.py

5️⃣ Start Packet Sniffing (if not auto-started)

python sniffer.py

6️⃣ Open the Web UI

Go to http://127.0.0.1:8080 in your browser.


📁 Project Structure

/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

🔧 Configuration

Change Network Interface (for Sniffing)

Edit sniffer.py and update the network interface:

iface = "Intel(R) I211 Gigabit Network Connection"  # Change to your actual interface

Find your interface using:

ifconfig (Linux/macOS)
ipconfig (Windows)

API Token for Geolocation (Optional)

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")

🖥️ Screenshots

Live Network Map


🐜 License

This project is licensed under the MIT License.


👨‍💻 Contributing

Pull requests are welcome! Feel free to fork this repository and submit a PR.

  1. Fork the repo
  2. Create a new branch (feature-xyz)
  3. Commit your changes (git commit -m "Added new feature")
  4. Push & create a PR

💌 Contact

📧 Your Email: [email protected]
🐙 GitHub: KW-Soft

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published