This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
What I Built
Every machine leaves a trace. Some tell a story.
When a computer or cloud server is compromised, attackers don't just disappearβthey leave behind faint digital apparitions: dozens of failed authentication attempts in the dead of night, an unusual sudo session opened by a low-privileged account, a sudden backdoor user added to /etc/passwd, and an attempt to erase audit logs.
To seasoned SOC tier-3 analysts, these logs tell an obvious story. But for junior developers, sysadmins, and small open-source teams without dedicated security personnel, raw logs are intimidating walls of cryptic text. Existing SIEM tools will throw alerts, but reconstructing what happened, when it happened, and how the adversary navigated the system is agonizingly difficult.
Enter PhantomTrace π»
PhantomTrace is an offline, privacy-first AI digital forensics investigator that resurrects suspicious system activity and conducts an autonomous digital autopsy.
Instead of another chatbot that writes Halloween ghost stories, PhantomTrace interprets the "Ghost in the Machine" theme through real-world cybersecurity:
- The "Ghosts": The hidden, lingering footprints left behind by adversaries in authentication and event logs.
- The "Medium": A deterministic rule-based threat engine grounded in the MITRE ATT&CK matrix that extracts and links attack sequences without hallucinating.
- The "Detective": An open-weight local AI model (running via Ollama or its built-in offline reasoning engine) that interrogates the evidence, reconstructs the breach lifecycle, and writes official forensic incident reports.
- The Haunted Terminal Mode: A retro CRT phosphor-green terminal where the forensic investigator narrates the intruderβs steps like a digital ghost speaking from the system bus.
Demo
- GitHub Repository: https://github.com/balabhadra3141/Hacktoberfest-Week4
-
Interactive SOC Dashboard:
http://localhost:5173 -
1-Click Demo Scenarios: Built-in attack datasets ready to test in 10 seconds:
- π§ Linux Server Breach: Multi-IP SSH brute force -> root credential acquisition -> privilege escalation -> rogue account creation (
ghost_backdoor) -> crontab persistence. - πͺ Windows Domain Lateral Movement: Event ID 4625 brute force -> 4624 successful logon -> 4672
SeDebugPrivilegeelevation ->PsExecremote execution ->wevtutillog clearing. - π Web Server RCE: Directory traversal + SQL injection -> PHP web shell upload -> reverse shell payload execution.
- π§ Linux Server Breach: Multi-IP SSH brute force -> root credential acquisition -> privilege escalation -> rogue account creation (
Key Screens & Features in Action
- SOC Overview Console: Real-time Ghost Threat Index gauge (0β100), alert severity distribution, and MITRE tactic breakdown charts.
- Ghost Timeline: Interactive chronological attack reconstruction tracing the adversary's actions with color-coded severity nodes and raw log drill-downs.
- AI Chat Investigator: Grounded interactive Q&A where you can ask "Was this a brute force attack?", "Which events connect in the kill chain?", or "Provide remediation steps".
- Incident Report Generator: 1-click download of an official, publication-ready Incident Response PDF (generated locally via ReportLab) and structured JSON for SIEM ingestion.
- Haunted Terminal: Retro cyber-terminal that types out the ghostly autopsy stream line by line.
Code
The entire codebase is open-source under the MIT License:
Hacktoberfest-Week4/
βββ backend/
β βββ main.py # FastAPI backend with CORS, streaming, & REST endpoints
β βββ detector.py # Deterministic threat engine (MITRE ATT&CK mapping & scoring)
β βββ ollama_client.py # Ollama local LLM connector + Zero-fail offline DFIR engine
β βββ report_generator.py # Publication-ready PDF (ReportLab) & JSON export
β βββ samples.py # Pre-loaded multi-stage attack scenarios
β βββ requirements.txt # Pure Python dependencies (FastAPI, uvicorn, reportlab)
βββ frontend/
β βββ src/
β β βββ components/
β β β βββ Navbar.tsx # Case status, Ghost Score pill, & engine indicator
β β β βββ SOCDashboard.tsx # Metrics, Recharts attack vectors, & alert feed
β β β βββ EvidenceScanner.tsx # 1-click scenario loader, file upload, & raw log paste
β β β βββ GhostTimeline.tsx # Chronological attack graph with MITRE tactic tags
β β β βββ AIChatInvestigator.tsx# Grounded forensic investigator chat with prompt chips
β β β βββ ForensicReport.tsx # Official DFIR report, IOC table, & 1-click PDF export
β β β βββ HauntedTerminal.tsx # Retro CRT cyber terminal with real-time digital autopsy
β β βββ types.ts # TypeScript interfaces for all data structures
β β βββ App.tsx # Central state & scenario orchestrator
β β βββ index.css # Cyber-obsidian & spectral emerald theme
β βββ package.json
β βββ vite.config.ts
βββ samples/ # Standalone raw sample logs
βββ run.bat # 1-Click Windows launcher
βββ README.md # Architecture, installation, & judge guide
You can clone and run it with one command:
git clone https://github.com/balabhadra3141/Hacktoberfest-Week4.git
cd Hacktoberfest-Week4
.\run.bat # Or `cd backend && uvicorn main:app` and `cd frontend && npm run dev`
How I Built It
PhantomTrace combines a deterministic rule pipeline with local open-weight AI inference:
System Logs (Linux / Windows / Web)
β
βΌ
βββββββββββββββββββββββββββββ
β Log Normalization & β
β Deterministic Rules β βββ Regex Threat Engine (MITRE T1110, T1548, etc.)
βββββββββββββββ¬ββββββββββββββ
β
βββββββββββββββΌββββββββββββββ
β Ghost Timeline Rebuilder β βββ Chronological Attack Sequences
βββββββββββββββ¬ββββββββββββββ
β
ββββββββββββββ΄βββββββββββββ
βΌ βΌ
ββββββββββββββββββββ βββββββββββββββββββββββββββ
β Local LLM β β Grounded Fallback β
β (Ollama/Qwen2.5) β OR β Offline Forensic Agent β (100% Free / Zero Setup)
ββββββββββ¬ββββββββββ ββββββββββββββ¬βββββββββββββ
β β
βββββββββββββββ¬ββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
βΌ βΌ βΌ
ββββββββββββββββ βββββββββββββββ βββββββββββββββββ
β SOC Console β β AI Chat Q&A β β PDF / JSON β
β & Terminal β β Investigatorβ β Report Export β
ββββββββββββββββ βββββββββββββββ βββββββββββββββββ
1. Deterministic Grounding (Preventing AI Hallucinations)
A major risk in AI cybersecurity is hallucinationβan LLM imagining an attack or inventing a fake IP address.
PhantomTrace solves this through a two-stage pipeline:
-
Stage 1 (Deterministic Core):
detector.pyuses high-speed regex pattern matching to parse Linux syslog/auth.log, Windows EVTX-exported events, and Web server access logs. It identifies confirmed threat indicators (SSH brute force,sudoelevation, rogue accounts) and tags them with official MITRE ATT&CK technique IDs (T1110.001,T1548.003,T1136.001,T1070.001). - Stage 2 (Narrative & Correlation): The local AI model receives only verified facts and timeline nodes as grounding context. The AI's job is synthesis, kill-chain correlation, and threat explanationβnot guessing.
2. Local Open-Weight Inference (Ollama + Qwen2.5 / Llama 3.2)
PhantomTrace connects directly to a locally hosted Ollama instance (http://127.0.0.1:11434) using open-weight models such as qwen2.5:3b or llama3.2.
- No cloud API keys required.
- Zero network requests leave your machine during analysis.
- Zero-Fail Fallback Engine: To ensure the project works flawlessly for any judge or developer who doesn't have Ollama installed, the backend includes an embedded deterministic AI reasoning engine. If Ollama is offline, PhantomTrace switches automatically and seamlessly to this offline agent.
3. Frontend & Visualizations
Built with React 19, TypeScript, Tailwind CSS, and Recharts:
- Obsidian & Spectral Emerald Palette: A sleek Security Operations Center (SOC) theme.
- Recharts Integration: Visual breakdown of MITRE ATT&CK tactics and alert severity distributions.
- ReportLab Engine: Generates official DFIR incident reports in PDF format with executive summaries, IOC tables, and remediation playbooks.
Why Does Open Innovation Matter?
In digital forensics and cybersecurity, open innovation is not just a preferenceβit is a non-negotiable architectural requirement.
1. Absolute Privacy & Air-Gapped Operation
System logs contain some of the most sensitive data an organization possesses: private IP architectures, internal hostnames, user credentials, failed passwords, and command histories.
Sending raw production authentication logs to a proprietary, cloud-hosted closed API (like OpenAI or Anthropic) violates compliance standards (GDPR, HIPAA, SOC 2) and actively creates a new data-exfiltration risk.
With open-weight models and Ollama, PhantomTrace operates completely offline. You can disconnect your ethernet cable, turn off Wi-Fi, and run an in-depth forensic investigation on an air-gapped laptop in a data center.
2. Auditability & Grounded Transparency
Closed AI APIs are black boxes that can change, deprecate models, or alter safety guardrails overnight. In forensic investigations where evidence might be presented in court or an insurance audit, you need predictable, auditable, deterministic inference. Open-source models can be versioned, inspected, fine-tuned, and verified locally.
3. Zero Cost & Universal Accessibility
Small startups, non-profits, independent developers, and open-source maintainers cannot afford enterprise SIEM subscriptions that charge thousands of dollars per gigabyte of ingested logs. PhantomTrace proves that open-source AI and deterministic engineering can give anyone an enterprise-grade digital forensic investigator for $0.
My Agent Session
This entire applicationβfrom backend threat rules and Ollama integration to the React dashboard, timeline graph, and PDF report generatorβwas developed through an agentic pair-programming session with Antigravity.
The workflow:
- Architectural design focusing on deterministic threat detection + local LLM grounding.
- Rapid implementation of the FastAPI backend, ReportLab PDF generator, and synthetic incident logs.
- Building the React + TypeScript frontend with Tailwind CSS and Recharts.
- Testing live inference and verifying complete offline resilience.
The Spirit of It
The moment this project truly came alive was when we tested the Haunted Terminal Mode on the Linux Server Breach dataset:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PHANTOMTRACE FORENSIC KERNEL v1.0.0-HACKTOBERFEST β
β Every machine leaves a trace. Some tell a story. β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
[*] [PHANTOMTRACE] Initializing Spectral Memory Extraction...
[*] Probing kernel ring buffer and forensic event journals...
[*] Captured 14 spirit traces across system bus.
[!] DANGER: Detected 5 paranormal security deviations!
[!] Spectral Origin Located: Foreign IP entity `198.51.100.42` manifesting on port 22.
[>] Trace #1: SSH Brute Force Attack (5 attempts) [T1110.001]
β³ Whisper: Detected 5 failed authentication attempts originating from IP 198.51.100.42.
[π] THE GHOST BREACHED THE GATE: Authentication barrier collapsed!
[π] GHOST ELEVATION: The entity possessed root UID 0 permissions!
[π] PHANTOM RESIDUE: Adversary left a rogue soul in the user registry!
[*] Forensic timeline sealed. Digital autopsy complete.
Watching cryptic log lines transform into a coherent, gripping narrativeβnot as fictional fantasy, but as an accurate, MITRE-mapped autopsy of a real cyber incursionβmade it clear: AI doesn't just need to generate text; it can give eyes and ears to systems that were previously silent.
Prize Categories
- Open Innovation Track: Privacy-first, offline digital forensics powered by open-weight AI models.
- Cybersecurity & AI Agents Track: Autonomous DFIR agent with deterministic grounding, MITRE ATT&CK correlation, and automated incident response reporting.
- Ghost in the Machine (Halloween Theme): Uncovering the ghost traces left in machine memory and narrating the breach via the Haunted Terminal.
Built with β€οΈ for Hacktoberfest 2026. Every machine leaves a trace. Some tell a story. π»
Top comments (0)