Skip to content

Commit dbee778

Browse files
CyberRouteclaude
andcommitted
feat: pass device vendor and hostname to LLM analysis context
OllamaThread now accepts device_vendor and hostname parameters and injects them into the prompt before the packet, giving the model manufacturer and device identity context for more targeted IoT vulnerability analysis. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f1946a1 commit dbee778

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

core/arp_scanner.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ def __init__( # pylint: disable=too-many-arguments,too-many-positional-argument
5858
self.ip_address = ip_address
5959
self.interface = interface
6060
self.gateway_ip = gateway_ip
61+
self._device_vendor = device_vendor
62+
self._hostname = hostname
6163
self._mitm: MitmThread | None = None
6264

6365
layout = QVBoxLayout()
@@ -216,7 +218,12 @@ def _analyse_packet(self):
216218

217219
pkt_text = _format_packet(self._captured_packets[row])
218220
user_context = self._user_context.text().strip()
219-
self._ollama_thread = OllamaThread(pkt_text, user_context=user_context)
221+
self._ollama_thread = OllamaThread(
222+
pkt_text,
223+
user_context=user_context,
224+
device_vendor=self._device_vendor,
225+
hostname=self._hostname,
226+
)
220227
self._ollama_thread.token.connect(self._on_llm_token)
221228
self._ollama_thread.error.connect(self._on_llm_error)
222229
self._ollama_thread.finished.connect(self._on_llm_finished)

core/ollama_analyst.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,37 @@ def __init__(
3535
self,
3636
packet_text: str,
3737
user_context: str = "",
38+
device_vendor: str = "",
39+
hostname: str = "",
3840
model: str = DEFAULT_MODEL,
3941
parent=None,
4042
):
4143
super().__init__(parent)
4244
self.packet_text = packet_text
4345
self.user_context = user_context
46+
self.device_vendor = device_vendor
47+
self.hostname = hostname
4448
self.model = model
4549

4650
def run(self):
4751
"""Stream LLM analysis of the packet to the token signal."""
52+
device_section = ""
53+
if self.device_vendor or self.hostname:
54+
device_section = "\nDevice under analysis:"
55+
if self.hostname:
56+
device_section += f"\n Hostname : {self.hostname}"
57+
if self.device_vendor:
58+
device_section += f"\n Vendor : {self.device_vendor}"
59+
device_section += "\n"
60+
4861
context_section = (
4962
f"\nAdditional context from analyst:\n{self.user_context}\n"
5063
if self.user_context
5164
else ""
5265
)
53-
prompt = f"{SYSTEM_PROMPT}\n{context_section}\nPacket:\n{self.packet_text}"
66+
prompt = (
67+
f"{SYSTEM_PROMPT}\n{device_section}{context_section}\nPacket:\n{self.packet_text}"
68+
)
5469
payload = {
5570
"model": self.model,
5671
"prompt": prompt,

0 commit comments

Comments
 (0)