From d10f898537470393cb522613f3caacc8b55f646e Mon Sep 17 00:00:00 2001 From: GH05TCREW Date: Sat, 13 Dec 2025 22:40:50 -0700 Subject: [PATCH] feat(report): append Mermaid attack graph to TUI /report --- ghostcrew/interface/tui.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ghostcrew/interface/tui.py b/ghostcrew/interface/tui.py index 3aa133b..a2794d5 100644 --- a/ghostcrew/interface/tui.py +++ b/ghostcrew/interface/tui.py @@ -1001,6 +1001,27 @@ Be concise. Use the actual data from notes.""" reports_dir = Path("loot/reports") reports_dir.mkdir(parents=True, exist_ok=True) + # Append Shadow Graph if available + try: + from ..knowledge.graph import ShadowGraph + from ..tools.notes import get_all_notes_sync + + # Rehydrate graph from notes + graph = ShadowGraph() + notes = get_all_notes_sync() + if notes: + graph.update_from_notes(notes) + mermaid_code = graph.to_mermaid() + + if mermaid_code: + report_content += ( + "\n\n## Attack Graph (Visual)\n\n```mermaid\n" + + mermaid_code + + "\n```\n" + ) + except Exception as e: + self._add_system(f"[!] Graph generation error: {e}") + timestamp = datetime.now().strftime("%Y-%m-%d_%H%M%S") report_path = reports_dir / f"report_{timestamp}.md" report_path.write_text(report_content, encoding="utf-8")