AI-powered network traffic analysis. Captures live traffic via
tshark, classifies each flow with an LLM, and streams results to a live web dashboard.
Raw network traffic is mostly noise. This tool captures it, tags what’s interesting, and tells you why.
tshark — no GUI, no manual captures| Layer | Tool |
|---|---|
| Packet capture | tshark (Wireshark CLI) |
| Backend runtime | Python 3.11+ |
| AI / LLM | Gemini API (gemini-2.5-flash-lite) |
| Storage | SQLite |
| Backend | FastAPI |
| Real-time | FastAPI WebSockets |
| Frontend | Next.js + TypeScript |
| Styling | Tailwind CSS |
Wireshark-Agent/
├── main.py # Entry point: starts capture + web server
├── config.yaml # Agent thresholds
├── requirements.txt
│
├── capture/
│ ├── tshark_stream.py # Live capture (tshark -T ek stream)
│ └── filter.py # Pre-agent noise filter
│
├── agents/
│ ├── classifier.py # Classifies each flow via Gemini
│ └── alert_agent.py # Evaluates thresholds, fires alerts
│
├── storage/
│ ├── db.py # SQLite queries
│ └── schema.sql # Table definitions
│
├── server/
│ ├── app.py # FastAPI app + WebSocket endpoint
│ └── websocket.py # WebSocket connection manager
│
├── data/
│ └── wireshark_agent.db # Auto-created on first run
│
└── frontend/
└── src/app/ # Next.js live feed UI
sudo apt install tshark on Ubuntu, or install Wireshark on macOS/Windows)git clone https://github.com/Denzel29/Wireshark-Agent.git
cd Wireshark-Agent
# Backend
pip install -r requirements.txt
# Frontend
cd frontend && npm install && cd ..
Set your Gemini API key as an environment variable (or place it in a .env file at the project root):
export GEMINI_API_KEY=your_key_here
Agent thresholds live in config.yaml:
agents:
model: gemini-2.5-flash-lite
alert_thresholds:
suspicious_count: 3 # alert after N suspicious flows from same source
unknown_count: 5 # alert after N unknown flows from same source
time_window_seconds: 60 # rolling window for the counts above
Backend + live capture — attach to a network interface:
python main.py --interface eth0
On Windows, use the interface name or index (e.g. --interface "Ethernet" or --interface 1).
Frontend (separate terminal):
cd frontend && npm run dev
Open http://localhost:3000 for the live feed. The FastAPI backend runs on http://localhost:8000.
Network interface
│
▼
tshark (NDJSON / EK stream)
│
▼
Filter layer ← drops non-IP packets and broadcasts
│
▼
Classifier Agent ← Gemini tags each flow: benign / suspicious / unknown
│
├──▶ Alert Agent ← fires when suspicious/unknown counts cross thresholds
│ │
│ └──▶ WebSocket push to UI + terminal output
│
└──▶ SQLite ← flows, alerts, and sessions stored
│
└──▶ FastAPI ──▶ Next.js live feed
Classifier (agents/classifier.py) — called for every flow that survives the filter. Sends flow metadata to Gemini and returns a classification, a confidence score, and descriptive tags. Falls back to unknown with 0.0 confidence if the API call fails or returns invalid JSON.
Alert Agent (agents/alert_agent.py) — tracks suspicious and unknown flows per source IP within a rolling time window. When a count crosses its threshold, it asks Gemini to generate a structured alert (severity, category, description, reasoning) and falls back to a threshold-based alert if the model doesn’t respond.
Three SQLite tables defined in storage/schema.sql:
Planned but not yet implemented:
.pcap / .pcapng captures)MIT