Skip to content

Commit 21b4907

Browse files
committed
integration with Anthropic API
1 parent 2ef5521 commit 21b4907

1 file changed

Lines changed: 29 additions & 10 deletions

File tree

README.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
## Overview
1010

11-
Phantom is a **network reconnaissance and security auditing tool** designed for directly connected networks. It discovers devices via ARP scanning, tracks their history, detects ARP spoofing attacks, and can perform MITM interception with live packet analysis powered by a local LLM.
11+
Phantom is a **network reconnaissance and security auditing tool** designed for directly connected networks. It discovers devices via ARP scanning, tracks their history, detects ARP spoofing attacks, and can perform MITM interception with live packet analysis powered by a local or cloud LLM.
1212

1313
The GUI is built with **PySide6** (Qt framework) and uses **Scapy** for all packet-level operations.
1414

@@ -21,7 +21,7 @@ The GUI is built with **PySide6** (Qt framework) and uses **Scapy** for all pack
2121
- **New Device & MAC Change Detection**: Highlights new devices (green) and IP-to-MAC binding changes (red) — a classic ARP spoofing indicator.
2222
- **ARP Spoof Detection**: Passive background sniffer that alerts on conflicting ARP bindings and gateway MAC changes.
2323
- **MITM Interception**: ARP-spoof a target to intercept its traffic; captured packets are displayed in real time with a full layer-by-layer breakdown.
24-
- **LLM Packet Analysis**: Send any captured packet to a local [Ollama](https://ollama.com) instance for AI-assisted analysis (protocol identification, risk assessment, credential spotting).
24+
- **LLM Packet Analysis**: Send any captured packet to a local [Ollama](https://ollama.com) instance or the [Anthropic API](https://www.anthropic.com) for AI-assisted analysis (protocol identification, risk assessment, credential spotting).
2525
- **PCAP Export**: Save captured packets from a MITM session as a `.pcap` file for offline analysis in Wireshark.
2626
- **Scan Export**: Export scan results to JSON or CSV.
2727
- **Progress Bar**: Live progress feedback during scanning.
@@ -38,7 +38,9 @@ The GUI is built with **PySide6** (Qt framework) and uses **Scapy** for all pack
3838
- **PySide6** — graphical user interface
3939
- **netifaces** — network interface introspection
4040
- **requests** — Ollama API streaming
41+
- **anthropic** — Anthropic API client (installed via `requirements.txt`)
4142
- **Ollama** (optional) — local LLM for packet analysis (`ollama serve`)
43+
- **Anthropic API key** (optional) — set via `ANTHROPIC_API_KEY` env var or entered in the UI
4244

4345
---
4446

@@ -132,18 +134,35 @@ Click **Save PCAP** to write the captured session to a `.pcap` file.
132134

133135
> **Note:** MITM requires root/sudo. IP forwarding is restored automatically when MITM is stopped.
134136
135-
### 4. LLM packet analysis (Ollama)
137+
### 4. LLM packet analysis
136138

137-
With [Ollama](https://ollama.com) running locally (`ollama serve`) and at least one model pulled:
139+
Select a captured packet in the MITM window, then choose a **Provider**:
138140

139-
1. Select a captured packet in the MITM window.
140-
2. Choose a model from the **Model** drop-down (populated automatically from the running Ollama instance). Click **** to refresh the list after pulling a new model.
141+
#### Ollama (local)
142+
143+
Requires [Ollama](https://ollama.com) running locally (`ollama serve`) with at least one model pulled.
144+
145+
1. Set **Provider** to **Ollama (local)**.
146+
2. Choose a model from the **Model** drop-down (populated automatically). Click **** to refresh after pulling a new model.
141147
3. Optionally add context in the **Context** field (e.g. `"this is a smart TV"`).
142-
4. Click **Analyse with LLM** — the analysis opens in a dedicated window and streams in token by token. Use **Copy analysis** to copy the result to the clipboard.
148+
4. Click **Analyse with LLM**.
149+
150+
> **Tip:** Any model available via `ollama list` can be used. Smaller models respond faster; larger ones give more detailed analysis.
151+
152+
#### Anthropic API (cloud)
153+
154+
Requires an [Anthropic API key](https://console.anthropic.com).
155+
156+
1. Set **Provider** to **Anthropic**.
157+
2. Choose a model (`claude-opus-4-6`, `claude-sonnet-4-6`, or `claude-haiku-4-5`).
158+
3. Enter your API key in the **API key** field (or set `ANTHROPIC_API_KEY` in the environment and it will pre-fill automatically).
159+
4. Optionally add context, then click **Analyse with LLM**.
160+
161+
> **Tip:** `claude-haiku-4-5` is fastest and cheapest for quick checks; `claude-opus-4-6` gives the most thorough analysis.
143162
144-
The LLM identifies protocol/service, describes what the endpoints are doing, flags security-relevant observations, and provides a risk rating.
163+
The analysis opens in a dedicated window and streams token by token. Use **Copy analysis** to copy the result to the clipboard.
145164

146-
> **Tip:** Any model available via `ollama list` can be used. Smaller models (e.g. `llama3.2:1b`) respond faster; larger ones (e.g. `llama3.1:8b`) give more detailed analysis.
165+
The LLM identifies protocol/service, flags security-relevant observations (plaintext credentials, CVE patterns, suspicious beaconing), and provides a risk rating.
147166

148167
---
149168

@@ -156,7 +175,7 @@ core/
156175
arp_spoofer.py — low-level ARP spoof / restore primitives
157176
mitm.py — MitmThread (spoof loop + sniffer), IP forwarding management
158177
spoof_detector.py — passive ARP sniff-based spoof detection
159-
ollama_analyst.py — OllamaThread for streaming LLM packet analysis
178+
llm_analyst.py — OllamaThread and AnthropicThread for streaming LLM packet analysis
160179
db.py — SQLite persistence (device history, MAC audit trail)
161180
networking.py — CIDR calculation, hostname resolution helpers
162181
vendor.py — OUI/MAC vendor lookup

0 commit comments

Comments
 (0)