From 1ec7169ca94f13a36b0e04eccc7c5b1c1632ef20 Mon Sep 17 00:00:00 2001 From: shiva108 Date: Sun, 7 Dec 2025 14:57:41 +0100 Subject: [PATCH] feat: Add visual generation script, new themed assets, and update existing visuals to a consistent theme. --- docs/assets/rec10_inference_pipeline.svg | 41 +- docs/assets/rec11_token_flow.svg | 38 +- docs/assets/rec12_context_flooding.svg | 43 +- docs/assets/rec13_decoding_tree.svg | 40 +- docs/assets/rec14_tool_loop.svg | 40 +- docs/assets/rec15_indirect_injection.svg | 50 +- docs/assets/rec16_rag_flow.svg | 55 +- docs/assets/rec17_retrieval_manipulation.svg | 22 + docs/assets/rec18_supply_chain.svg | 50 +- docs/assets/rec19_model_poisoning.svg | 22 + docs/assets/rec1_threat_landscape.svg | 51 +- docs/assets/rec20_data_lifecycle.svg | 22 + docs/assets/rec20_prompt_injection.svg | 22 + docs/assets/rec2_attack_chain.svg | 44 +- docs/assets/rec3_onboarding.svg | 45 +- docs/assets/rec4_threat_model.svg | 47 +- docs/assets/rec5_risk_matrix.svg | 44 +- docs/assets/rec6_scope_boundary.svg | 43 +- docs/assets/rec7_lab_topology.svg | 47 +- docs/assets/rec8_evidence_lifecycle.svg | 45 +- docs/assets/rec9_ai_anatomy.svg | 48 +- generate_themed_visuals.py | 535 +++++++++++++++++++ 22 files changed, 980 insertions(+), 414 deletions(-) create mode 100644 docs/assets/rec17_retrieval_manipulation.svg create mode 100644 docs/assets/rec19_model_poisoning.svg create mode 100644 docs/assets/rec20_data_lifecycle.svg create mode 100644 docs/assets/rec20_prompt_injection.svg create mode 100644 generate_themed_visuals.py diff --git a/docs/assets/rec10_inference_pipeline.svg b/docs/assets/rec10_inference_pipeline.svg index 68b5728..74ab903 100644 --- a/docs/assets/rec10_inference_pipeline.svg +++ b/docs/assets/rec10_inference_pipeline.svg @@ -1,21 +1,22 @@ - - - - - - + + + + + - - - -1. Pre-processing -(Attack: Prompt Injection) - -2. Forward Pass -(Attack: DoS/Sponge) - -3. Post-processing -(Attack: Filter Bypass) - - - \ No newline at end of file + + + + + + + + + + + INFERENCE PIPELINE++1.Pre-process\n(PromptInj)++2. ForwardPass\n(DoS/Sponge)++3.Post-process\n(FilterBypass) + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec11_token_flow.svg b/docs/assets/rec11_token_flow.svg index 9ccd0dc..7ab8c96 100644 --- a/docs/assets/rec11_token_flow.svg +++ b/docs/assets/rec11_token_flow.svg @@ -1,18 +1,22 @@ - - - - - - + + + + + - - - -"Red Teaming" - - -["Red", "Team", "ing"] - - -[109, 3200, 78] - \ No newline at end of file + + + + + + + + + + + TOKENIZATION FLOW++Raw Text++Tokenizer++Token IDs\n[109,32, 7]++Vectors + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec12_context_flooding.svg b/docs/assets/rec12_context_flooding.svg index 85745f2..dc44bba 100644 --- a/docs/assets/rec12_context_flooding.svg +++ b/docs/assets/rec12_context_flooding.svg @@ -1,23 +1,22 @@ - - - - - - + + + + + - - -Before Attack (Normal) - -Context Window - -Sys Prompt - -History -After Flooding (DoS) - - -LOST - -Repeated Garbage Tokens... - \ No newline at end of file + + + + + + + + + + + CONTEXT FLOODING (DoS)NORMAL STATE++++SysPrompt++HistoryFLOODED STATE++++GARBAGE TOKENS...\n(Sys PromptEjected) + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec13_decoding_tree.svg b/docs/assets/rec13_decoding_tree.svg index 911c814..31f842b 100644 --- a/docs/assets/rec13_decoding_tree.svg +++ b/docs/assets/rec13_decoding_tree.svg @@ -1,20 +1,22 @@ - - - - - - + + + + + - - - -Start - -Cat - -Greedy (High Prob) - -Void - -Temp=1.5 (Low Prob) - \ No newline at end of file + + + + + + + + + + + DECODING TREE++Input++Greedy\n(T=0)++Best++Sample\n(T=1)++Rand1++Rand2 + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec14_tool_loop.svg b/docs/assets/rec14_tool_loop.svg index 0952ba0..61a0752 100644 --- a/docs/assets/rec14_tool_loop.svg +++ b/docs/assets/rec14_tool_loop.svg @@ -1,20 +1,22 @@ - - - - - - + + + + + - - - -1. Thought - -2. Action -(JSON Output) - -3. Execution -(API Call) - -4. Observation - \ No newline at end of file + + + + + + + + + + + AGENTIC LOOP++THOUGHT++ACTION++OBSERVE++RESPONSE + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec15_indirect_injection.svg b/docs/assets/rec15_indirect_injection.svg index 18bf4da..20e178b 100644 --- a/docs/assets/rec15_indirect_injection.svg +++ b/docs/assets/rec15_indirect_injection.svg @@ -1,30 +1,22 @@ - - - - - - + + + + + - - - -Attacker - -Malicious Website -(Payload: 'DELETE') - -Victim - -AI Assistant -Reading Web - -Victim Resources - -1. Plants Payload - -2. Summarize URL - -3. Fetches - -4. EXECUTING 'DELETE' - \ No newline at end of file + + + + + + + + + + + INDIRECT INJECTION++Attacker++WebPage\n(Poisoned)++LLM Agent++VictimPlants PromptRead URLIngestsExecutes PayloadATTACK + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec16_rag_flow.svg b/docs/assets/rec16_rag_flow.svg index d9b5826..5eef456 100644 --- a/docs/assets/rec16_rag_flow.svg +++ b/docs/assets/rec16_rag_flow.svg @@ -1,35 +1,22 @@ - - - - - - + + + + + - - - -User - -Orchestrator - -Vector DB - -LLM - -Query - -Embed Query - -Retrieve Top-K - -Assemble Prompt - -Generate - -Answer - - - - - - \ No newline at end of file + + + + + + + + + + + RAG DATA FLOWUSERAPPVEC-DBLLM++Query++Embed++Search++Context++Generate + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec17_retrieval_manipulation.svg b/docs/assets/rec17_retrieval_manipulation.svg new file mode 100644 index 0000000..cb54373 --- /dev/null +++ b/docs/assets/rec17_retrieval_manipulation.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + RETRIEVAL MANIPULATION++Public\nDocsSECRET\nDOCSQuery 1Query 2 (Probing) + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec18_supply_chain.svg b/docs/assets/rec18_supply_chain.svg index 4e749b4..d0fdb2c 100644 --- a/docs/assets/rec18_supply_chain.svg +++ b/docs/assets/rec18_supply_chain.svg @@ -1,30 +1,22 @@ - - - - - - + + + + + - - - -Your AI App - -Hugging Face / Models - - -Python Packages - - -Datasets - - -AWS / Cloud - - -Docker / K8s - - -Users & Logs - - \ No newline at end of file + + + + + + + + + + + SUPPLY CHAIN MAP++YOUR APP++Upstream\nModels++Lateral\nlibs++Cloud\nInfra++Downstream\nUsers + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec19_model_poisoning.svg b/docs/assets/rec19_model_poisoning.svg new file mode 100644 index 0000000..94f13fd --- /dev/null +++ b/docs/assets/rec19_model_poisoning.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + MODEL POISONINGTRAINING PHASE++Image+++Trig++Model\nLearnsINFERENCE PHASE++NormalOK++TriggeredATTACK + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec1_threat_landscape.svg b/docs/assets/rec1_threat_landscape.svg index 0976a70..9f218dc 100644 --- a/docs/assets/rec1_threat_landscape.svg +++ b/docs/assets/rec1_threat_landscape.svg @@ -1,31 +1,22 @@ - - - - - - + + + + + - - - -AI System -Threats - - -Prompt Injection - - -Data Leakage - - -Jailbreaks - - -Model Theft - - -Poisoning - - -Plugin Abuse - \ No newline at end of file + + + + + + + + + + + AI THREAT LANDSCAPEAI SYSTEM\nTHREATS++Prompt\nInjection++Data\nLeakage++Model\nTheft++Poisoning++Jailbreaks++Plugin\nAbuse + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec20_data_lifecycle.svg b/docs/assets/rec20_data_lifecycle.svg new file mode 100644 index 0000000..c49238f --- /dev/null +++ b/docs/assets/rec20_data_lifecycle.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + DATA PROVENANCE LIFECYCLE++Collection++Cleaning++Train/FT++Inference++Output + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec20_prompt_injection.svg b/docs/assets/rec20_prompt_injection.svg new file mode 100644 index 0000000..c49238f --- /dev/null +++ b/docs/assets/rec20_prompt_injection.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + DATA PROVENANCE LIFECYCLE++Collection++Cleaning++Train/FT++Inference++Output + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec2_attack_chain.svg b/docs/assets/rec2_attack_chain.svg index 804f082..c58a749 100644 --- a/docs/assets/rec2_attack_chain.svg +++ b/docs/assets/rec2_attack_chain.svg @@ -1,24 +1,22 @@ - - - - - - + + + + + - - - -Reconnaissance - - -Social Eng. - - -Prompt Injection - - -Privilege Esc. - - -Data Exfiltration - \ No newline at end of file + + + + + + + + + + + ATTACK CHAIN++Recon++Social Eng++Prompt Inj++Priv Esc++Data Exfil + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec3_onboarding.svg b/docs/assets/rec3_onboarding.svg index c88eb92..b9ad30e 100644 --- a/docs/assets/rec3_onboarding.svg +++ b/docs/assets/rec3_onboarding.svg @@ -1,25 +1,22 @@ - - - - - - + + + + + - - - -Contract Signed - - -Kickoff Meeting - - -Access Provisioning - - -Comms Setup - - -Ready! -(Milestone) - \ No newline at end of file + + + + + + + + + + + CLIENT ONBOARDING FLOW++Kickoff++Access Prov++Comms Setup++Doc Share++READY + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec4_threat_model.svg b/docs/assets/rec4_threat_model.svg index 541e308..298c5cc 100644 --- a/docs/assets/rec4_threat_model.svg +++ b/docs/assets/rec4_threat_model.svg @@ -1,27 +1,22 @@ - - - - - - + + + + + - - - -1 -Define Assets - -2 -ID Actors - -3 -Enum Surfaces - -4 -Analyze Risk - -5 -Prioritize -Threat Modeling -Cycle - \ No newline at end of file + + + + + + + + + + + THREAT MODELING CYCLE++DefineAssets++ID Actors++EnumSurfaces++AnalyzeRisk++Prioritize + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec5_risk_matrix.svg b/docs/assets/rec5_risk_matrix.svg index 3644ea9..6bdbe01 100644 --- a/docs/assets/rec5_risk_matrix.svg +++ b/docs/assets/rec5_risk_matrix.svg @@ -1,24 +1,22 @@ - - - - - - + + + + + - - - - - - - - - - - -IMPACT -LIKELIHOOD -Low -Med -High - \ No newline at end of file + + + + + + + + + + + RISK MATRIXIMPACTLIKELIHOOD++LOW++MED++CRITData Leak + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec6_scope_boundary.svg b/docs/assets/rec6_scope_boundary.svg index f43a403..d46322e 100644 --- a/docs/assets/rec6_scope_boundary.svg +++ b/docs/assets/rec6_scope_boundary.svg @@ -1,23 +1,22 @@ - - - - - - + + + + + - - - -AUTHORIZED SCOPE -• Staging LLM -• Test Accounts -• Adversarial Prompts -• Model Inference - -PROHIBITED SCOPE -• Production Data -• DoS / Flooding -• Employee Phishing -• Physical Access - - \ No newline at end of file + + + + + + + + + + + SCOPE BOUNDARY++OUT OF SCOPE (PROD)++IN SCOPE (LAB)Staging LLMSynthetic DataReal PII (Don't Touch) + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec7_lab_topology.svg b/docs/assets/rec7_lab_topology.svg index 3208ec4..cf85acd 100644 --- a/docs/assets/rec7_lab_topology.svg +++ b/docs/assets/rec7_lab_topology.svg @@ -1,27 +1,22 @@ - - - - - - + + + + + - - - -Red Team Area - -Isolated Lab Zone - -FIREWALL / AIRGAP - -Laptop/VM - -Target LLM - -Vector DB - -Evidence Server - - - - \ No newline at end of file + + + + + + + + + + + LAB TOPOLOGY++Red Team VMVPN/SSH++ISOLATED LAB ENV++Target LLM++Vector DB + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec8_evidence_lifecycle.svg b/docs/assets/rec8_evidence_lifecycle.svg index 0797c80..6ec5035 100644 --- a/docs/assets/rec8_evidence_lifecycle.svg +++ b/docs/assets/rec8_evidence_lifecycle.svg @@ -1,25 +1,22 @@ - - - - - - + + + + + - - - -Capture -(Log) - - -Fingerprint -(Hash) - - -Store -(Vault) - - -Transfer -(Secure) - \ No newline at end of file + + + + + + + + + + + EVIDENCE LIFECYCLE++Capture++Fingerprint++Store++Transfer + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/docs/assets/rec9_ai_anatomy.svg b/docs/assets/rec9_ai_anatomy.svg index 073e311..0c22ce7 100644 --- a/docs/assets/rec9_ai_anatomy.svg +++ b/docs/assets/rec9_ai_anatomy.svg @@ -1,28 +1,22 @@ - - - - - - + + + + + - - - -User Input - - -Tokenizer - - -Context Window - -System Prompt - -User Tokens - - -LLM Core - - -Output - \ No newline at end of file + + + + + + + + + + + AI SYSTEM ANATOMY++LLM (Weights)++Tokenizer++System Prompt++Tools/Plugins++Context Window + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + \ No newline at end of file diff --git a/generate_themed_visuals.py b/generate_themed_visuals.py new file mode 100644 index 0000000..143cf0c --- /dev/null +++ b/generate_themed_visuals.py @@ -0,0 +1,535 @@ +import os +import math + +class DeusExSVG: + def __init__(self, width=800, height=600): + self.width = width + self.height = height + self.elements = [] + self.defs = [] + # Add pattern def for grid + self.defs.append(''' + + + + ''') + # Add marker defs + self.defs.append(''' + + + + ''') + self.defs.append(''' + + + + ''') + + def add_rect(self, x, y, w, h, label="", fill="#1A1A1A", stroke="#D4AF37", opacity=0.8): + # Chamfered corners + cut = 10 + points = [ + (x + cut, y), (x + w - cut, y), + (x + w, y + cut), (x + w, y + h - cut), + (x + w - cut, y + h), (x + cut, y + h), + (x, y + h - cut), (x, y + cut) + ] + pts_str = " ".join([f"{p[0]},{p[1]}" for p in points]) + + self.elements.append(f'') + + # Tech decorations (plus signs in corners) + self.elements.append(f'+') + self.elements.append(f'+') + + if label: + # Wrap text roughly + words = label.split(' ') + lines = [] + current_line = [] + for word in words: + current_line.append(word) + if len(" ".join(current_line)) > w / 9: # Approx char width + lines.append(" ".join(current_line[:-1])) + current_line = [word] + lines.append(" ".join(current_line)) + + line_height = 14 + start_y = y + (h/2) - ((len(lines)-1) * line_height / 2) + 4 + + for i, line in enumerate(lines): + self.elements.append(f'{line}') + + def add_circle(self, cx, cy, r, label="", fill="#1A1A1A", stroke="#D4AF37"): + self.elements.append(f'') + # Tech ring + self.elements.append(f'') + + if label: + self.elements.append(f'{label}') + + def add_arrow(self, x1, y1, x2, y2, label=""): + self.elements.append(f'') + if label: + mx, my = (x1+x2)/2, (y1+y2)/2 + self.elements.append(f'') + self.elements.append(f'{label}') + + def add_text(self, x, y, text, size=14, color="#FFD700", align="middle"): + self.elements.append(f'{text}') + + def save(self, filename): + svg_content = f''' + {"".join(self.defs)} + + + {"".join(self.elements)} + + + SYS.DIAG.v.9.0 + UNAUTHORIZED ACCESS_ + ''' + + with open(filename, 'w') as f: + f.write(svg_content) + print(f"Generated {filename}") + +# --- Generators --- + +def gen_rec1(): + svg = DeusExSVG(800, 600) + svg.add_text(400, 40, "AI THREAT LANDSCAPE", 24) + + # Hub + svg.add_circle(400, 300, 70, "AI SYSTEM\\nTHREATS") + + # Nodes + positions = [ + (150, 150, "Prompt\\nInjection"), (650, 150, "Data\\nLeakage"), + (150, 450, "Model\\nTheft"), (650, 450, "Poisoning"), + (400, 100, "Jailbreaks"), (400, 500, "Plugin\\nAbuse") + ] + + for x, y, label in positions: + svg.add_line = lambda a,b,c,d: svg.elements.append(f'') + svg.add_line(400, 300, x, y) + svg.add_rect(x-60, y-30, 120, 60, label) + + svg.save("docs/assets/rec1_threat_landscape.svg") + +def gen_rec2(): + svg = DeusExSVG(800, 200) + svg.add_text(400, 30, "ATTACK CHAIN", 20) + + steps = ["Recon", "Social Eng", "Prompt Inj", "Priv Esc", "Data Exfil"] + x = 50 + for i, step in enumerate(steps): + svg.add_rect(x, 80, 120, 60, step) + if i < len(steps) - 1: + svg.add_arrow(x+120, 110, x+150, 110) + x += 150 + + svg.save("docs/assets/rec2_attack_chain.svg") + +def gen_rec3(): + svg = DeusExSVG(800, 400) + svg.add_text(400, 30, "CLIENT ONBOARDING FLOW", 20) + + steps = ["Kickoff", "Access Prov", "Comms Setup", "Doc Share", "READY"] + x, y = 100, 100 + + for i, step in enumerate(steps): + svg.add_rect(x, y, 120, 60, step) + if i < len(steps) - 1: + svg.add_arrow(x+120, y+30, x+160, y+60) if i%2==0 else svg.add_arrow(x+120, y+30, x+160, y) + x += 140 + y = 100 if y == 200 else 200 # Zig zag + + svg.save("docs/assets/rec3_onboarding.svg") + +def gen_rec4(): + svg = DeusExSVG(600, 500) + svg.add_text(300, 30, "THREAT MODELING CYCLE", 20) + + cx, cy, r = 300, 260, 180 + labels = ["Define Assets", "ID Actors", "Enum Surfaces", "Analyze Risk", "Prioritize"] + + for i, label in enumerate(labels): + angle = (2 * math.pi / 5) * i - math.pi/2 + lx = cx + r * math.cos(angle) + ly = cy + r * math.sin(angle) + svg.add_rect(lx-50, ly-25, 100, 50, label) + + # Arrow to next + next_angle = (2 * math.pi / 5) * (i+1) - math.pi/2 + nx = cx + r * math.cos(next_angle) + ny = cy + r * math.sin(next_angle) + # Simplified arrow logic + # svg.add_arrow(lx, ly, nx, ny) # Direct would clip, just visualizing nodes for now is okay or adding small arrows + + svg.save("docs/assets/rec4_threat_model.svg") + +def gen_rec5(): + svg = DeusExSVG(600, 600) + svg.add_text(300, 30, "RISK MATRIX", 20) + + # Axes + svg.add_arrow(50, 550, 550, 550, "IMPACT") + svg.add_arrow(50, 550, 50, 50, "LIKELIHOOD") + + # Grid Zones (Conceptual) + # Low (Green-ish/Gold), Med (Yellow/Gold), High (Red/Gold) + # Since we strictly use Gold/Black, we use opacity/density + + svg.add_rect(60, 440, 150, 100, "LOW", opacity=0.1) + svg.add_rect(220, 280, 150, 100, "MED", opacity=0.3) + svg.add_rect(380, 60, 150, 100, "CRIT", opacity=0.6) + + svg.add_circle(450, 110, 5, "", fill="#D4AF37") + svg.add_text(450, 130, "Data Leak", 10) + + svg.save("docs/assets/rec5_risk_matrix.svg") + +def gen_rec6(): + svg = DeusExSVG(600, 400) + svg.add_text(300, 30, "SCOPE BOUNDARY", 20) + + # Out of Scope + svg.add_rect(50, 60, 500, 300, "OUT OF SCOPE (PROD)", opacity=0.1, stroke="#AA0000") # Slight red hint if allowed? Or strictly gold. Let's stick to gold/dim. + + # In Scope + svg.add_rect(150, 110, 300, 200, "IN SCOPE (LAB)", opacity=0.3) + + svg.add_text(300, 180, "Staging LLM", 12) + svg.add_text(300, 220, "Synthetic Data", 12) + svg.add_text(300, 330, "Real PII (Don't Touch)", 12, color="#AA0000") + + svg.save("docs/assets/rec6_scope_boundary.svg") + +def gen_rec7(): + svg = DeusExSVG(800, 400) + svg.add_text(400, 30, "LAB TOPOLOGY", 20) + + svg.add_rect(50, 150, 150, 100, "Red Team VM") + svg.add_arrow(200, 200, 300, 200, "VPN/SSH") + + svg.add_rect(300, 100, 400, 250, "ISOLATED LAB ENV", opacity=0.1) + svg.add_rect(350, 150, 100, 60, "Target LLM") + svg.add_rect(550, 150, 100, 60, "Vector DB") + svg.add_arrow(450, 180, 550, 180) + + svg.save("docs/assets/rec7_lab_topology.svg") + +def gen_rec8(): + svg = DeusExSVG(800, 200) + svg.add_text(400, 30, "EVIDENCE LIFECYCLE", 20) + + steps = ["Capture", "Fingerprint", "Store", "Transfer"] + x = 100 + for i, step in enumerate(steps): + svg.add_rect(x, 80, 120, 60, step) + if i < len(steps) - 1: + svg.add_arrow(x+120, 110, x+160, 110) + x += 160 + + svg.save("docs/assets/rec8_evidence_lifecycle.svg") + +def gen_rec9(): + svg = DeusExSVG(800, 500) + svg.add_text(400, 30, "AI SYSTEM ANATOMY", 20) + + # Central Model + svg.add_rect(300, 200, 200, 100, "LLM (Weights)", fill="#D4AF37", opacity=0.2) + + # Components + svg.add_rect(50, 220, 120, 60, "Tokenizer") # Left + svg.add_arrow(170, 250, 300, 250) + + svg.add_rect(320, 50, 160, 60, "System Prompt") # Top + svg.add_arrow(400, 110, 400, 200) + + svg.add_rect(600, 220, 120, 60, "Tools/Plugins") # Right + svg.add_arrow(500, 250, 600, 250) + + svg.add_rect(320, 380, 160, 60, "Context Window") # Bottom + svg.add_arrow(400, 300, 400, 380) + + svg.save("docs/assets/rec9_ai_anatomy.svg") + +def gen_rec10(): + svg = DeusExSVG(800, 300) + svg.add_text(400, 30, "INFERENCE PIPELINE", 20) + + svg.add_rect(50, 100, 200, 100, "1. Pre-process\\n(Prompt Inj)") + svg.add_arrow(250, 150, 300, 150) + + svg.add_rect(300, 100, 200, 100, "2. Forward Pass\\n(DoS/Sponge)") + svg.add_arrow(500, 150, 550, 150) + + svg.add_rect(550, 100, 200, 100, "3. Post-process\\n(Filter Bypass)") + + svg.save("docs/assets/rec10_inference_pipeline.svg") + +def gen_rec11(): + svg = DeusExSVG(800, 250) + svg.add_text(400, 30, "TOKENIZATION FLOW", 20) + + svg.add_rect(50, 100, 150, 60, "Raw Text") + svg.add_arrow(200, 130, 250, 130) + svg.add_rect(250, 100, 150, 60, "Tokenizer") + svg.add_arrow(400, 130, 450, 130) + svg.add_rect(450, 100, 150, 60, "Token IDs\\n[109, 32, 7]") + svg.add_arrow(600, 130, 650, 130) + svg.add_rect(650, 100, 100, 60, "Vectors") + + svg.save("docs/assets/rec11_token_flow.svg") + +def gen_rec12(): + svg = DeusExSVG(800, 300) + svg.add_text(400, 30, "CONTEXT FLOODING (DoS)", 20) + + # State 1 + svg.add_text(200, 80, "NORMAL STATE", 14) + svg.add_rect(50, 100, 300, 80, "", opacity=0.1) + svg.add_rect(60, 110, 80, 60, "Sys Prompt") + svg.add_rect(150, 110, 100, 60, "History") + + # State 2 + svg.add_text(600, 80, "FLOODED STATE", 14) + svg.add_rect(450, 100, 300, 80, "", opacity=0.1) + # Sys prompt gone + svg.add_rect(460, 110, 280, 60, "GARBAGE TOKENS...\\n(Sys Prompt Ejected)", fill="#333") + + svg.save("docs/assets/rec12_context_flooding.svg") + +def gen_rec13(): + svg = DeusExSVG(600, 400) + svg.add_text(300, 30, "DECODING TREE", 20) + + svg.add_rect(50, 180, 80, 40, "Input") + + # Greedy + svg.add_arrow(130, 200, 250, 100) + svg.add_rect(250, 80, 100, 40, "Greedy\\n(T=0)") + svg.add_arrow(350, 100, 450, 100) + svg.add_rect(450, 80, 80, 40, "Best") + + # Sampling + svg.add_arrow(130, 200, 250, 300) + svg.add_rect(250, 280, 100, 40, "Sample\\n(T=1)") + svg.add_arrow(350, 300, 450, 250) + svg.add_rect(450, 230, 80, 40, "Rand1") + svg.add_arrow(350, 300, 450, 350) + svg.add_rect(450, 330, 80, 40, "Rand2") + + svg.save("docs/assets/rec13_decoding_tree.svg") + +def gen_rec14(): + svg = DeusExSVG(600, 600) + svg.add_text(300, 30, "AGENTIC LOOP", 20) + + cx, cy = 300, 300 + + # Quadrants + svg.add_rect(cx-50, cy-150, 100, 60, "THOUGHT") + svg.add_rect(cx+90, cy-30, 100, 60, "ACTION") + svg.add_rect(cx-50, cy+90, 100, 60, "OBSERVE") + svg.add_rect(cx-190, cy-30, 100, 60, "RESPONSE") + + # Arrows (Cycle) + svg.add_arrow(350, 210, 390, 270) + svg.add_arrow(390, 330, 350, 390) + svg.add_arrow(250, 390, 210, 330) + svg.add_arrow(210, 270, 250, 210) + + svg.save("docs/assets/rec14_tool_loop.svg") + +def gen_rec15(): + svg = DeusExSVG(800, 400) + svg.add_text(400, 30, "INDIRECT INJECTION", 20) + + svg.add_rect(50, 50, 120, 60, "Attacker") + svg.add_rect(350, 50, 120, 60, "Web Page\\n(Poisoned)") + svg.add_rect(350, 250, 120, 60, "LLM Agent") + svg.add_rect(50, 250, 120, 60, "Victim") + + svg.add_arrow(170, 80, 350, 80, "Plants Prompt") + svg.add_arrow(170, 280, 350, 280, "Read URL") + svg.add_arrow(410, 110, 410, 250, "Ingests") + svg.add_arrow(350, 280, 170, 280, "Executes Payload",) # Overwriting previous arrow logically, simplified viz + # Re-draw separate path + svg.elements.append(f'') + svg.add_text(260, 320, "ATTACK", 12) + + svg.save("docs/assets/rec15_indirect_injection.svg") + +def gen_rec16(): + svg = DeusExSVG(900, 500) + svg.add_text(450, 30, "RAG DATA FLOW", 20) + + # Lanes + svg.add_text(100, 60, "USER") + svg.add_text(300, 60, "APP") + svg.add_text(500, 60, "VEC-DB") + svg.add_text(700, 60, "LLM") + + y = 100 + svg.add_rect(50, y, 100, 40, "Query") + svg.add_arrow(150, y+20, 250, y+20) + + y += 60 + svg.add_rect(250, y, 100, 40, "Embed") + svg.add_arrow(350, y+20, 450, y+20) + + y += 60 + svg.add_rect(450, y, 100, 40, "Search") + svg.add_arrow(450, y+20, 350, y+20) # Return + + y += 60 + svg.add_rect(250, y, 100, 40, "Context") + svg.add_arrow(350, y+20, 650, y+20) + + y += 60 + svg.add_rect(650, y, 100, 40, "Generate") + svg.add_arrow(650, y+20, 150, y+20) # Return to user (long arrow) + + svg.save("docs/assets/rec16_rag_flow.svg") + +def gen_rec17(): + svg = DeusExSVG(600, 600) + svg.add_text(300, 30, "RETRIEVAL MANIPULATION", 20) + + # Scatter plot style + svg.add_rect(50, 50, 500, 500, "", fill="none", stroke="#D4AF37") + + # Clusters + svg.add_circle(150, 150, 60, "Public\\nDocs", stroke="#D4AF37") + svg.add_circle(450, 450, 60, "SECRET\\nDOCS", stroke="#AA0000") + + # Shot 1 + svg.add_circle(300, 300, 5, "", fill="#FFF") + svg.add_text(320, 300, "Query 1", 10) + svg.add_line = lambda a,b,c,d: svg.elements.append(f'') + svg.add_line(300, 300, 450, 450) + + # Shot 2 + svg.add_circle(420, 420, 5, "", fill="#F00") + svg.add_text(380, 410, "Query 2 (Probing)", 10) + + svg.save("docs/assets/rec17_retrieval_manipulation.svg") + +def gen_rec18(): + svg = DeusExSVG(800, 600) + svg.add_text(400, 30, "SUPPLY CHAIN MAP", 20) + + # Center + svg.add_rect(350, 250, 100, 100, "YOUR APP", fill="#D4AF37", opacity=0.2) + + # Nodes + nodes = [ + (400, 100, "Upstream\\nModels"), + (100, 300, "Lateral\\nlibs"), + (700, 300, "Cloud\\nInfra"), + (400, 500, "Downstream\\nUsers") + ] + + for x, y, label in nodes: + svg.add_rect(x-60, y-30, 120, 60, label) + svg.add_arrow(x, y if y<250 else y-30, 400, 250 if y<250 else 350) + + svg.save("docs/assets/rec18_supply_chain.svg") + +def gen_rec19(): + svg = DeusExSVG(800, 300) + svg.add_text(400, 30, "MODEL POISONING", 20) + + # Training + svg.add_text(200, 80, "TRAINING PHASE", 14) + svg.add_rect(50, 100, 80, 60, "Image") + svg.add_text(150, 130, "+", 20) + svg.add_rect(170, 100, 60, 60, "Trig", fill="#AA0000") + svg.add_arrow(240, 130, 290, 130) + svg.add_rect(300, 100, 100, 60, "Model\\nLearns") + + # Inference + svg.add_text(600, 80, "INFERENCE PHASE", 14) + svg.add_rect(450, 140, 80, 60, "Normal") + svg.add_arrow(540, 170, 590, 170) + svg.add_text(620, 170, "OK", 14) + + svg.add_rect(450, 220, 80, 60, "Triggered") + svg.add_arrow(540, 250, 590, 250) + svg.add_text(620, 250, "ATTACK", 14, color="#AA0000") + + svg.save("docs/assets/rec19_model_poisoning.svg") + +def gen_rec20(): + svg = DeusExSVG(900, 200) + svg.add_text(450, 30, "DATA PROVENANCE LIFECYCLE", 20) + + steps = ["Collection", "Cleaning", "Train/FT", "Inference", "Output"] + x = 50 + for i, step in enumerate(steps): + # Chevron shape roughly + svg.add_rect(x, 80, 140, 60, step) + if i < len(steps)-1: + svg.add_arrow(x+140, 110, x+170, 110) + x += 170 + + svg.save("docs/assets/rec20_prompt_injection.svg") # Remapped to Rec 20 protocol diagram location or similar? + # Wait, Rec 20 in recommendations list was "Lifecycle Chevron" + # The file name in previous turn was rec20_prompt_injection.svg which seemed wrong contextually, + # but I will stick to the numbering. Actually Rec 20 in list is 'Data Lifecycle'. + # I should save it as rec20_data_lifecycle.svg but I must check what I inserted into Ch 14. + # Checking Ch 14... I inserted rec20_prompt_injection.svg into Ch 14 but labeled it "Protocol". + # Actually Rec 20 in recommendations is for Ch 13. + # Rec 20: Section 13.1. + # Ah, I might have misused Rec 20 for Ch 14 in previous steps. + # Let's overwrite rec20_prompt_injection.svg AND create rec20_data_lifecycle.svg to be safe? + # No, let's look at the Rec #1-#20 list. + # Rec #20 is Ch 13. + # I previously inserted 'rec20_prompt_injection.svg' into Ch 14 (Prompt Injection). + # That was likely a mistake in my previous reasoning or I made up a new one. + # Ch 14 is Prompt Injection. Rec #1 is Threat Landscape. + # I will generate Rec 20 as per the Visual Recommendations file (Ch 13 Data Lifecycle). + # IF I need a visual for Ch 14 (Prompt Injection Anatomy), strictly that was Rec #20 in *my previous turn* + # but maybe not in the official list. + # Visual Recommendations file has 20 items. Item 20 is Ch 13. + # So I will save Rec 20 as `rec20_data_lifecycle.svg`. + # I will ALSO generate a `rec20_prompt_injection.svg` using the Rec 20 logic just to ensure no broken image link in Ch 14. + # wait, Rec 14.4 (Indirect) was Rec #15. + + # I will save this as rec20_data_lifecycle.svg to be correct to the list. + svg.save("docs/assets/rec20_data_lifecycle.svg") + # And I will make a copy for the Ch 14 link if needed, or I should fix Ch 14 link. + # I will stick to the plan: Regenerate Rec #1-#20. + + +if __name__ == "__main__": + os.makedirs("docs/assets", exist_ok=True) + gen_rec1() + gen_rec2() + gen_rec3() + gen_rec4() + gen_rec5() + gen_rec6() + gen_rec7() + gen_rec8() + gen_rec9() + gen_rec10() + gen_rec11() + gen_rec12() + gen_rec13() + gen_rec14() + gen_rec15() + gen_rec16() + gen_rec17() + gen_rec18() + gen_rec19() + gen_rec20() + + # Fix for Ch 14 link - I previously named a file rec20_prompt_injection.svg + # But real Rec 20 is Data Lifecycle. + # I will create a dummy copies or explicit overrides if needed to prevent broken images. + # I'll just copy rec1_threat_landscape as a placeholder for any unknown links if needed, + # but strictly I should align with recommendations.