[CHIMERA] Fix indentation in create_ui function (Gradio 6.0 compat)
Browse files
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 |
-
|
| 668 |
-
|
| 669 |
-
|
| 670 |
-
|
| 671 |
-
|
| 672 |
-
|
| 673 |
-
|
| 674 |
-
|
| 675 |
-
|
| 676 |
-
|
| 677 |
-
|
| 678 |
-
|
| 679 |
-
|
| 680 |
-
|
| 681 |
-
|
| 682 |
-
|
| 683 |
-
|
| 684 |
-
|
| 685 |
-
|
| 686 |
-
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
|
| 690 |
-
|
| 691 |
-
|
| 692 |
-
|
| 693 |
-
|
| 694 |
-
|
| 695 |
-
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
|
| 700 |
-
|
| 701 |
-
|
| 702 |
-
|
| 703 |
-
|
| 704 |
-
|
| 705 |
-
|
| 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():
|