This repo is a Tor traffic analysis playground: upload a PCAP, extract flows, label likely Tor traffic, and correlate activity against public Tor network data (consensus + Onionoo). The UI is a small React app; the backend is FastAPI.
If you want the “what’s in here?” overview, check docs/project_overview.md.
- PCAP ingestion → flow extraction and feature calculation
- Tor-ish flow detection (ML-based)
- Fetches Tor relay metadata and keeps it refreshed in the background
- Correlates flow timing against relay behavior and produces ranked candidates
- UI pages for flows, results, and a Tor network view
backend/ FastAPI app + processing services
frontend/ React (Vite) UI
geoip/ Optional MaxMind GeoLite2 databases (ignored by git)
scripts/ Convenience run scripts
docs/ Notes / project overview
Prereqs:
- Python 3.9+
- Node.js 16+
- Postgres + Redis (local) or Supabase + Upstash/managed Redis
Backend:
cd backend
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
python init_db.py
python main.pyFrontend:
cd frontend
npm install
npm run devURLs:
- Backend:
http://localhost:8000 - Frontend:
http://localhost:5173
For more detailed backend setup notes, see backend/README_SETUP.md and backend/SUPABASE_SETUP.md.
Some parts of the pipeline can enrich IPs with ASN/city lookups via MaxMind GeoLite2. The .mmdb files are large and license-bound, so the repo ignores geoip/*.mmdb.
- Download
GeoLite2-ASN.mmdbandGeoLite2-City.mmdbfrom MaxMind. - Put them in
./geoip/. - Set in
backend/.env(absolute paths also work):GEOIP_ASN_DB_PATH=geoip/GeoLite2-ASN.mmdb GEOIP_CITY_DB_PATH=geoip/GeoLite2-City.mmdb
POST /api/v1/upload-pcapGET /api/v1/flowsPOST /api/v1/analyze-flow/{flow_id}POST /api/v1/analyze-allGET /api/v1/analysis-resultsWS /api/v1/ws
Most runtime config is in backend/config/settings.py and/or backend/.env. Common ones:
DATABASE_URL,REDIS_URLTOR_REFRESH_INTERVALGEOIP_ASN_DB_PATH,GEOIP_CITY_DB_PATH
- Windows/Linux convenience scripts live in
scripts/. - If you’re committing work, please avoid committing PCAPs or
.mmdbfiles.