ScottzillaSystems commited on
Commit
d3002e2
Β·
verified Β·
1 Parent(s): 059918e

[CHIMERA] Fix indentation in create_ui function (Gradio 6.0 compat)

Browse files
Files changed (1) hide show
  1. app.py +40 -40
app.py CHANGED
@@ -663,46 +663,46 @@ def create_ui(config: AgentZeroConfig, chat_interface: ChatInterface, defense: P
663
  .agent-zero-header h1 { color: #00ff41; font-family: 'Courier New', monospace; text-shadow: 0 0 10px rgba(0,255,65,0.5); }
664
  footer { visibility: hidden; }
665
  """
666
- with gr.Blocks(title="Pentesting Agent Zero") as demo:
667
- gr.HTML("""<div class="agent-zero-header">
668
- <h1>πŸ›‘οΈ PENTESTING AGENT ZERO</h1>
669
- <p style="color: #888; font-family: monospace;">Autonomous AI-Driven Penetration Testing β€’ MCP Server Enabled β€’ Prompt Injection Hardened</p>
670
- <p style="color: #666; font-size: 12px;">⚠️ FOR AUTHORIZED TESTING ONLY β€’ All scans require explicit target authorization</p>
671
- </div>""")
672
- with gr.Row():
673
- with gr.Column(scale=3):
674
- chatbot = gr.Chatbot(label="Agent Zero Console", height=500, render_markdown=True, avatar_images=(None, "πŸ›‘οΈ"))
675
- with gr.Row():
676
- msg_input = gr.Textbox(label="Pentesting task", placeholder="e.g., 'Scan ports on scanme.nmap.org' or '/help'", scale=8, container=False)
677
- send_btn = gr.Button("β–Ά Execute", variant="primary", scale=1)
678
- with gr.Row():
679
- clear_btn = gr.Button("πŸ—‘ Clear", size="sm")
680
- status_btn = gr.Button("πŸ“Š Status", size="sm")
681
- tools_btn = gr.Button("πŸ›  Tools", size="sm")
682
- with gr.Column(scale=1):
683
- gr.Markdown("### πŸ›‘οΈ Defense Status")
684
- gr.Markdown(f"**Prompt Injection Defense**: βœ… **ACTIVE**\n\n{len(config.injection_patterns)} patterns loaded. All inputs auto-scanned.")
685
- gr.Markdown("### πŸ”§ Quick Actions")
686
- quick_target = gr.Textbox(label="Target (IP/Domain/URL)", placeholder="e.g., 192.168.1.1")
687
- with gr.Row():
688
- quick_scan = gr.Button("πŸ” Quick Scan", size="sm")
689
- quick_nettacker = gr.Button("⚑ Nettacker", size="sm")
690
- quick_exploit = gr.Button("πŸ’₯ Exploit Search", size="sm")
691
- gr.Markdown("### πŸ“‘ MCP Server")
692
- gr.Markdown(f"**{len(chat_interface.agent.tool_registry.tools)} tools exposed**\n\nEndpoint: `/gradio_api/mcp/sse`\n\nConnect via any MCP client.")
693
-
694
- async def handle_message(message, history):
695
- new_history, _ = chat_interface.chat(message, history or [])
696
- return new_history, ""
697
- send_btn.click(handle_message, inputs=[msg_input, chatbot], outputs=[chatbot, msg_input])
698
- msg_input.submit(handle_message, inputs=[msg_input, chatbot], outputs=[chatbot, msg_input])
699
- clear_btn.click(lambda: ([], ""), outputs=[chatbot, msg_input])
700
- status_btn.click(lambda: "/status", outputs=[msg_input]).then(handle_message, inputs=[msg_input, chatbot], outputs=[chatbot, msg_input])
701
- tools_btn.click(lambda: "/tools", outputs=[msg_input]).then(handle_message, inputs=[msg_input, chatbot], outputs=[chatbot, msg_input])
702
- quick_scan.click(lambda t: f"Run a quick nmap scan on {t} and report open ports and services" if t else "Enter a target", inputs=[quick_target], outputs=[msg_input]).then(handle_message, inputs=[msg_input, chatbot], outputs=[chatbot, msg_input])
703
- quick_nettacker.click(lambda t: f"Run Nettacker automated scan on {t} using all modules" if t else "Enter a target", inputs=[quick_target], outputs=[msg_input]).then(handle_message, inputs=[msg_input, chatbot], outputs=[chatbot, msg_input])
704
- quick_exploit.click(lambda t: f"Search for exploits related to {t}" if t else "Enter a target", inputs=[quick_target], outputs=[msg_input]).then(handle_message, inputs=[msg_input, chatbot], outputs=[chatbot, msg_input])
705
- return demo
706
 
707
 
708
  def main():
 
663
  .agent-zero-header h1 { color: #00ff41; font-family: 'Courier New', monospace; text-shadow: 0 0 10px rgba(0,255,65,0.5); }
664
  footer { visibility: hidden; }
665
  """
666
+ with gr.Blocks(title="Pentesting Agent Zero") as demo:
667
+ gr.HTML("""<div class="agent-zero-header">
668
+ <h1>πŸ›‘οΈ PENTESTING AGENT ZERO</h1>
669
+ <p style="color: #888; font-family: monospace;">Autonomous AI-Driven Penetration Testing β€’ MCP Server Enabled β€’ Prompt Injection Hardened</p>
670
+ <p style="color: #666; font-size: 12px;">⚠️ FOR AUTHORIZED TESTING ONLY β€’ All scans require explicit target authorization</p>
671
+ </div>""")
672
+ with gr.Row():
673
+ with gr.Column(scale=3):
674
+ chatbot = gr.Chatbot(label="Agent Zero Console", height=500, render_markdown=True, avatar_images=(None, "πŸ›‘οΈ"))
675
+ with gr.Row():
676
+ msg_input = gr.Textbox(label="Pentesting task", placeholder="e.g., 'Scan ports on scanme.nmap.org' or '/help'", scale=8, container=False)
677
+ send_btn = gr.Button("β–Ά Execute", variant="primary", scale=1)
678
+ with gr.Row():
679
+ clear_btn = gr.Button("πŸ—‘ Clear", size="sm")
680
+ status_btn = gr.Button("πŸ“Š Status", size="sm")
681
+ tools_btn = gr.Button("πŸ›  Tools", size="sm")
682
+ with gr.Column(scale=1):
683
+ gr.Markdown("### πŸ›‘οΈ Defense Status")
684
+ gr.Markdown(f"**Prompt Injection Defense**: βœ… **ACTIVE**\n\n{len(config.injection_patterns)} patterns loaded. All inputs auto-scanned.")
685
+ gr.Markdown("### πŸ”§ Quick Actions")
686
+ quick_target = gr.Textbox(label="Target (IP/Domain/URL)", placeholder="e.g., 192.168.1.1")
687
+ with gr.Row():
688
+ quick_scan = gr.Button("πŸ” Quick Scan", size="sm")
689
+ quick_nettacker = gr.Button("⚑ Nettacker", size="sm")
690
+ quick_exploit = gr.Button("πŸ’₯ Exploit Search", size="sm")
691
+ gr.Markdown("### πŸ“‘ MCP Server")
692
+ gr.Markdown(f"**{len(chat_interface.agent.tool_registry.tools)} tools exposed**\n\nEndpoint: `/gradio_api/mcp/sse`\n\nConnect via any MCP client.")
693
+
694
+ async def handle_message(message, history):
695
+ new_history, _ = chat_interface.chat(message, history or [])
696
+ return new_history, ""
697
+ send_btn.click(handle_message, inputs=[msg_input, chatbot], outputs=[chatbot, msg_input])
698
+ msg_input.submit(handle_message, inputs=[msg_input, chatbot], outputs=[chatbot, msg_input])
699
+ clear_btn.click(lambda: ([], ""), outputs=[chatbot, msg_input])
700
+ status_btn.click(lambda: "/status", outputs=[msg_input]).then(handle_message, inputs=[msg_input, chatbot], outputs=[chatbot, msg_input])
701
+ tools_btn.click(lambda: "/tools", outputs=[msg_input]).then(handle_message, inputs=[msg_input, chatbot], outputs=[chatbot, msg_input])
702
+ quick_scan.click(lambda t: f"Run a quick nmap scan on {t} and report open ports and services" if t else "Enter a target", inputs=[quick_target], outputs=[msg_input]).then(handle_message, inputs=[msg_input, chatbot], outputs=[chatbot, msg_input])
703
+ quick_nettacker.click(lambda t: f"Run Nettacker automated scan on {t} using all modules" if t else "Enter a target", inputs=[quick_target], outputs=[msg_input]).then(handle_message, inputs=[msg_input, chatbot], outputs=[chatbot, msg_input])
704
+ quick_exploit.click(lambda t: f"Search for exploits related to {t}" if t else "Enter a target", inputs=[quick_target], outputs=[msg_input]).then(handle_message, inputs=[msg_input, chatbot], outputs=[chatbot, msg_input])
705
+ return demo
706
 
707
 
708
  def main():