mirror of
https://github.com/mblanke/GooseStrike.git
synced 2026-03-01 14:00:21 -05:00
Add roadmap API and mock dashboard
This commit is contained in:
32
app/agents/base_agent.py
Normal file
32
app/agents/base_agent.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""Base LLM agent scaffolding for GooseStrike."""
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Dict
|
||||
|
||||
|
||||
def llm_call(prompt: str) -> str:
|
||||
"""Placeholder LLM call."""
|
||||
return "LLM response placeholder. Configure llm_call() to talk to your provider."
|
||||
|
||||
|
||||
@dataclass
|
||||
class AgentResult:
|
||||
prompt: str
|
||||
raw_response: str
|
||||
recommendations: Dict[str, Any]
|
||||
|
||||
|
||||
class BaseAgent:
|
||||
name = "base"
|
||||
|
||||
def run(self, context: Dict[str, Any]) -> AgentResult:
|
||||
prompt = self.build_prompt(context)
|
||||
raw = llm_call(prompt)
|
||||
return AgentResult(prompt=prompt, raw_response=raw, recommendations=self.parse(raw))
|
||||
|
||||
def build_prompt(self, context: Dict[str, Any]) -> str:
|
||||
raise NotImplementedError
|
||||
|
||||
def parse(self, raw: str) -> Dict[str, Any]:
|
||||
return {"notes": raw.strip()}
|
||||
28
app/agents/cve_agent.py
Normal file
28
app/agents/cve_agent.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""CVE triage agent."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
from .base_agent import AgentResult, BaseAgent
|
||||
|
||||
|
||||
class CVEAgent(BaseAgent):
|
||||
name = "cve"
|
||||
|
||||
def build_prompt(self, context: Dict[str, Any]) -> str:
|
||||
cves = context.get("cves", [])
|
||||
lines = ["You are prioritizing CVEs for a legal assessment."]
|
||||
for cve in cves:
|
||||
lines.append(
|
||||
f"{cve.get('cve_id')}: severity={cve.get('severity')} score={cve.get('score')} desc={cve.get('description','')[:120]}"
|
||||
)
|
||||
lines.append("Provide prioritized actions and validation steps. No exploit code.")
|
||||
return "\n".join(lines)
|
||||
|
||||
def parse(self, raw: str) -> Dict[str, Any]:
|
||||
recommendations = [line.strip() for line in raw.split('\n') if line.strip()]
|
||||
return {"cve_actions": recommendations}
|
||||
|
||||
|
||||
def run(context: Dict[str, Any]) -> AgentResult:
|
||||
return CVEAgent().run(context)
|
||||
28
app/agents/exploit_agent.py
Normal file
28
app/agents/exploit_agent.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""Exploit correlation agent."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
from .base_agent import AgentResult, BaseAgent
|
||||
|
||||
|
||||
class ExploitAgent(BaseAgent):
|
||||
name = "exploit"
|
||||
|
||||
def build_prompt(self, context: Dict[str, Any]) -> str:
|
||||
exploits = context.get("exploits", [])
|
||||
lines = ["Summarize how existing public exploits might apply."]
|
||||
for exploit in exploits:
|
||||
lines.append(
|
||||
f"{exploit.get('source')} -> {exploit.get('title')} references {exploit.get('cve_id')}"
|
||||
)
|
||||
lines.append("Provide validation ideas and defensive considerations only.")
|
||||
return "\n".join(lines)
|
||||
|
||||
def parse(self, raw: str) -> Dict[str, Any]:
|
||||
notes = [line.strip() for line in raw.split('\n') if line.strip()]
|
||||
return {"exploit_notes": notes}
|
||||
|
||||
|
||||
def run(context: Dict[str, Any]) -> AgentResult:
|
||||
return ExploitAgent().run(context)
|
||||
31
app/agents/plan_agent.py
Normal file
31
app/agents/plan_agent.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""High level planning agent."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
from .base_agent import AgentResult, BaseAgent
|
||||
|
||||
|
||||
class PlanAgent(BaseAgent):
|
||||
name = "plan"
|
||||
|
||||
def build_prompt(self, context: Dict[str, Any]) -> str:
|
||||
objectives = context.get("objectives", [])
|
||||
intel = context.get("intel", [])
|
||||
lines = ["Create a prioritized plan for the GooseStrike assessment."]
|
||||
if objectives:
|
||||
lines.append("Objectives:")
|
||||
lines.extend(f"- {objective}" for objective in objectives)
|
||||
if intel:
|
||||
lines.append("Intel:")
|
||||
lines.extend(f"- {item}" for item in intel)
|
||||
lines.append("Return a numbered plan with legal, defensive-minded suggestions.")
|
||||
return "\n".join(lines)
|
||||
|
||||
def parse(self, raw: str) -> Dict[str, Any]:
|
||||
steps = [line.strip() for line in raw.split('\n') if line.strip()]
|
||||
return {"plan": steps}
|
||||
|
||||
|
||||
def run(context: Dict[str, Any]) -> AgentResult:
|
||||
return PlanAgent().run(context)
|
||||
29
app/agents/privesc_agent.py
Normal file
29
app/agents/privesc_agent.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""Privilege escalation agent."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
from .base_agent import AgentResult, BaseAgent
|
||||
|
||||
|
||||
class PrivEscAgent(BaseAgent):
|
||||
name = "privesc"
|
||||
|
||||
def build_prompt(self, context: Dict[str, Any]) -> str:
|
||||
host = context.get("host")
|
||||
findings = context.get("findings", [])
|
||||
lines = ["Suggest legal privilege escalation checks for a lab machine."]
|
||||
if host:
|
||||
lines.append(f"Host: {host}")
|
||||
for finding in findings:
|
||||
lines.append(f"Finding: {finding}")
|
||||
lines.append("Provide checklists only; no exploit payloads.")
|
||||
return "\n".join(lines)
|
||||
|
||||
def parse(self, raw: str) -> Dict[str, Any]:
|
||||
steps = [line.strip() for line in raw.split('\n') if line.strip()]
|
||||
return {"privesc_checks": steps}
|
||||
|
||||
|
||||
def run(context: Dict[str, Any]) -> AgentResult:
|
||||
return PrivEscAgent().run(context)
|
||||
31
app/agents/recon_agent.py
Normal file
31
app/agents/recon_agent.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""Reconnaissance agent."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
from .base_agent import AgentResult, BaseAgent
|
||||
|
||||
|
||||
class ReconAgent(BaseAgent):
|
||||
name = "recon"
|
||||
|
||||
def build_prompt(self, context: Dict[str, Any]) -> str:
|
||||
hosts = context.get("hosts", [])
|
||||
lines = ["You are advising a legal CTF recon team."]
|
||||
for host in hosts:
|
||||
services = host.get("services", [])
|
||||
service_lines = ", ".join(
|
||||
f"{svc.get('proto')}/{svc.get('port')} {svc.get('product','?')} {svc.get('version','')}"
|
||||
for svc in services
|
||||
)
|
||||
lines.append(f"Host {host.get('ip')} services: {service_lines}")
|
||||
lines.append("Suggest safe recon next steps without exploit code.")
|
||||
return "\n".join(lines)
|
||||
|
||||
def parse(self, raw: str) -> Dict[str, Any]:
|
||||
bullets = [line.strip('- ') for line in raw.split('\n') if line.strip()]
|
||||
return {"recon_steps": bullets}
|
||||
|
||||
|
||||
def run(context: Dict[str, Any]) -> AgentResult:
|
||||
return ReconAgent().run(context)
|
||||
Reference in New Issue
Block a user