The Cyber Attack Storyteller
Transform PCAP network traffic into an interactive, visual storyboard of cyber attacks. Analyze network events, visualize attack patterns, detect threats, and generate professional reportsβall with a modular, production-ready architecture.
- π Advanced PCAP Parser - Extracts TCP, UDP, DNS, HTTP, TLS, ICMP, ARP events with full protocol support
- π Intelligent Causal Linking - Automatically correlates DNS queries with HTTP requests and TLS handshakes
- π Interactive Attack Graph - Dynamic visualization of network events and their relationships
- β±οΈ Chronological Event Timeline - Time-series view of all network events with filtering capabilities
β οΈ Threat Detection Engine - Identifies port scanning, data exfiltration, suspicious DNS patterns, and C2 activity- π― Risk Scoring System - Assigns threat scores (0-100) to each event based on multi-factor analysis
- π Geolocation Intelligence - Maps IP addresses to geographic locations with interactive Leaflet maps
- π Analytics Dashboard - Statistical insights: top IPs, ports, protocols, traffic heatmaps, and traffic distribution
- π PDF Reports - Professional multi-page reports with summaries, statistics, and detailed tables
- π Word Documents - DOCX format for easy editing and stakeholder sharing
- π Timestamp Breakdown - Clean event details with source/destination analysis
- πΎ JSON Export - Raw event data for further analysis and integration
- Python 3.7+
- Flask - Web framework
- Scapy - Packet parsing and analysis
- ReportLab - PDF generation
- python-docx - Word document generation
- requests - HTTP library for GeoIP lookups
- folium - Interactive map generation
- chart-studio - Advanced charting capabilities
- geoip2 - GeoIP database support
All dependencies are listed in requirements.txt
cd backend
pip install -r requirements.txtpython app.pyThe application will start on http://localhost:5000
- Open your browser to http://localhost:5000
- Click "Analyze PCAP" and select your PCAP/PCAPng file
- Wait for analysis to complete
- Explore results using the navigation dashboard
After analyzing a PCAP, use these tabs for different analytical views:
| Button | Purpose | Details |
|---|---|---|
| π Report | Download professional reports | PDF or Word formats with summaries |
| π Analytics | View aggregated statistics | Event distribution, top IPs, ports, protocols |
| Threat intelligence view | Detected attack patterns, risk scores, severity levels | |
| π Search | Advanced filtering | IP, domain, event type, port searches |
| π Geolocation | Interactive IP mapping | Global view of traffic origins and destinations |
| β±οΈ Timeline | Dedicated timeline view | Chronological event progression (opens in new tab) |
Ctrl+ForCtrl+K- Open search in new tabCtrl+S- Download current report
The project follows a modular, layered architecture for maintainability and scalability:
PCAP-StoryTeller/
β
βββ frontend/
β βββ templates/ # HTML templates for all views
β β βββ index.html # Main dashboard
β β βββ analytics.html # Analytics & statistics view
β β βββ threats.html # Threat intelligence page
β β βββ search.html # Search & filter interface
β β βββ geolocation.html # Interactive map visualization
β β βββ timeline.html # Dedicated timeline view
β β βββ report.html # Report download page
β β
β βββ static/ # Frontend assets
β βββ script.js # Main dashboard logic
β βββ timeline.js # Timeline page logic
β βββ shared.js # Shared utilities & helpers
β βββ style.css # Dark theme styling
β
βββ backend/ # Flask API & Core Analysis Engine
β
βββ app.py # Flask application entry point
βββ config.py # Configuration settings
βββ routes.py # Route definitions & handlers
βββ logger.py # Logging configuration
β
βββ parsers/ # Protocol-specific packet parsers
β βββ network_parser.py # TCP/UDP connection parsing
β βββ dns_parser.py # DNS query/response parsing
β βββ http_parser.py # HTTP request/response parsing
β βββ tls_parser.py # TLS/SSL handshake parsing
β βββ encoder.py # Custom JSON encoding
β
βββ services/ # Business logic & analysis services
β βββ threat_service.py # Threat detection & scoring
β βββ analytics_service.py # Statistical analysis & aggregation
β βββ search_service.py # Search & filtering capabilities
β βββ geolocation_service.py # GeoIP lookups & mapping
β βββ folium_map_service.py # Interactive map generation
β βββ validation_service.py # Input validation & sanitization
β
βββ repositories/ # Data access layer
β βββ data_repository.py # Event data persistence
β βββ models/ # Data models & schemas
β
βββ api_handlers.py # API endpoint handler functions
βββ file_handler.py # PCAP file upload & validation
βββ pcap_parser.py # Main PCAP parsing orchestrator
βββ threat_analyzer.py # Threat analysis engine
βββ report_generator.py # PDF/DOCX report generation
βββ utils.py # Utility functions
βββ requirements.txt # Python dependencies
β
βββ uploads/ # Temporary PCAP upload directory
βββ models/ # Data models
βββ __pycache__/ # Python cache directory
Modular Design: Each parser and service handles a specific responsibility
- Parsers: Extract protocol-specific information from packets
- Services: Apply business logic (threat detection, analytics, search)
- Repositories: Manage data access and persistence
- API Handlers: Bridge between routes and services
Separation of Concerns: Frontend and backend are cleanly separated
- Frontend: Vanilla JavaScript with interactive visualizations
- Backend: Flask API with Python-based analysis engines
GET / # Main dashboard
GET /timeline # Dedicated timeline view
GET /report # Report generation page
GET /analytics # Analytics dashboard
GET /threats # Threat intelligence page
GET /search # Advanced search interface
GET /geolocation # Geolocation mapping page
POST /upload # Upload and analyze PCAP file
GET /events.json # Retrieve parsed events as JSON
GET /api/analytics # Statistical data (events, distribution, top IPs)
GET /api/threats # Threat scores and detected patterns
GET /api/search # Search events (query: q, field: ['all'|'ip'|'domain'|'type'])
GET /api/geoips # GeoIP data for all identified IPs
GET /api/geoip/<ip> # GeoIP data for specific IP
GET /api/geomap # Summarized geolocation data
GET /report/pdf # Download PDF report
GET /report/docx # Download Word document report
| Protocol | Support | Details |
|---|---|---|
| TCP | β Full | Connection establishment, flags, ports |
| UDP | β Full | Port information, datagram analysis |
| DNS | β Full | Queries, responses, domain resolution |
| HTTP | β Full | Methods, URIs, headers, user agents |
| HTTPS/TLS | β Full | SNI, certificate chains, handshakes |
| ICMP | β Full | Ping, unreachables, type/code analysis |
| ARP | β Full | Requests, replies, MAC/IP mappings |
| Format | Status | Notes |
|---|---|---|
| .pcap | β Supported | Standard packet capture format |
| .pcapng | β Supported | PCAP Next Generation format |
| .cap | β Supported | Alternative capture format |
All formats are automatically detected and parsed.
| Pattern | Severity | Indicators |
|---|---|---|
| π΄ Port Scanning | CRITICAL | Multiple unique ports from single source |
| π΄ Data Exfiltration | CRITICAL | Unusual HTTP traffic volumes, large payloads |
| π‘ Suspicious DNS | HIGH | Domains containing "malware", "c2", "exploit" |
| π‘ C2 Communication | HIGH | Suspicious TLS SNI or dynamic domains |
| π‘ External Connection | MEDIUM | Non-private IPs initiating connections |
| π’ Suspicious User-Agent | LOW | Missing or obfuscated user agents |
Events are scored 0-100 based on multiple factors:
Scoring Factors:
- Port Suspiciousness: Raw ports (0-10 points), privileged ports (15 points), scan ports (10 points)
- Protocol Analysis: POST/PUT methods (15 points), missing user-agent (10 points)
- Domain Keywords: Malware indicators (40 points), length anomalies (15 points)
- IP Reputation: External IPs (10 points), geolocation analysis
- Payload Indicators: Suspicious patterns, encoding signatures
Risk Levels:
- π΄ CRITICAL: Score β₯ 70
- π HIGH: Score β₯ 50
- π‘ MEDIUM: Score β₯ 30
- π’ LOW: Score < 30
# 1. Start the server
python backend/app.py
# 2. Upload a suspicious PCAP file via the web interface
# 3. System automatically:
# β Parses all packets into events
# β Links related events (DNS β HTTP β TLS)
# β Calculates risk scores for each event
# β Identifies attack patterns
# β Geolocates involved IPs
# 4. View Results:
# - Attack Graph: Visual relationship between network events
# - Timeline: Chronological progression of the attack
# - Threats: Risk scores and patterns identified
# - Analytics: Event distribution, top IPs, suspicious protocols
# - Reports: Download professional PDF/Word reports# In the Search tab:
1. Enter IP address in search field
2. Filter by "Source IP" or "Destination IP"
3. View all related events and their risk scores
4. Check geolocation to identify origin
5. Review timeline to understand activity pattern
- π Local Processing: All analysis runs locallyβno data sent externally (except GeoIP lookups)
- β Automatic Cleanup: PCAP files are automatically deleted after processing
- π Payload Filtering: Generated reports contain no raw payloads by default
- π GeoIP API: Uses free public API (ipapi.co) for location lookups
- π No Logging: Sensitive network data is not logged to disk
| PCAP Size | Event Count | Processing Time |
|---|---|---|
| Small | < 100 | Instant |
| Medium | 100-1000 | 1-5 seconds |
| Large | 1000-5000 | 5-30 seconds |
| Very Large | > 5000 | 30+ seconds |
Optimization Tips:
- Filter PCAP by time range before analysis
- Extract specific protocols using tcpdump before processing
- Enable multithreading for concurrent request handling (default enabled)
- Use smaller PCAPs for faster feedback during investigation
Solution: pip install scapySolution:
1. Ensure you're using the correct Python environment
2. Run: pip install -r requirements.txt
3. In VS Code, configure Python interpreter to use your venvSolution:
- Ensure you have an active internet connection
- Check firewall/proxy settings
- Verify ipapi.co is accessible from your networkSolution:
- Confirm file is valid PCAP/PCAPng format
- Check file size (default max: 1GB)
- Verify file permissions
- Try with a smaller test PCAP firstSolution:
1. Process in smaller time windows
2. Filter protocols before analysis: tcpdump -r big.pcap -w filtered.pcap "tcp.port == 80"
3. Split PCAP with editcap: editcap -c 10000 big.pcap chunk.pcap
4. Enable verbose logging: Check the logs/ directorySolution:
- Clear browser cache (Ctrl+Shift+Delete)
- Check if Flask server is running on port 5000
- Try accessing http://127.0.0.1:5000 instead of localhost
- Check browser console for JavaScript errors- β¨ Live Packet Capture - Real-time network monitoring mode
- π¦ YARA Rule Integration - Malware detection using signature rules
- π€ Machine Learning - Anomaly detection and threat prediction
- π Multi-File Comparison - Compare PCAPs for attack pattern clustering
- π Baseline Detection - Network baseline anomaly detection
- π MISP/STIX Export - Threat intelligence framework integration
- πΎ Database Backend - SQLite/PostgreSQL storage for large datasets
- π₯ Collaborative Analysis - Multi-user analysis sessions
- π± Mobile Interface - Responsive design for tablets/mobile devices
- π Plugin System - User-defined custom parsers and services
- HTML5 - Semantic markup
- CSS3 - Dark theme with responsive design
- Vanilla JavaScript - No frameworks required
- vis.js - Network graph visualization
- Chart.js - Statistical charts and graphs
- Leaflet - Interactive mapping
- Flask - Lightweight Python web framework
- Scapy - Packet manipulation and analysis
- ReportLab - PDF generation
- python-docx - Word document creation
- Folium - Interactive map generation
- geoip2 - Geolocation lookups
- Modular Parsers - Protocol-specific packet parsing
- Service Layer - Business logic separation
- Repository Pattern - Data access abstraction
- REST API - JSON-based communication
Built with π§ using these amazing open-source projects:
- vis.js - Network visualization
- Scapy - Packet manipulation
- Leaflet - Interactive map visualization
- Chart.js - Data visualization
- Flask - Web framework
- ReportLab - PDF generation
- Folium - Map generation
Made with β€οΈ by Kaif Tarasgar



