Fix smolagents kwargs type, Chatbot tuple format, and CSS launch placement
Browse files
app.py
CHANGED
|
@@ -522,7 +522,7 @@ class AutonomousPentestAgent:
|
|
| 522 |
from smolagents import CodeAgent, InferenceClientModel, tool
|
| 523 |
|
| 524 |
@tool
|
| 525 |
-
def pentest_tool(tool_name: str, **kwargs) -> str:
|
| 526 |
"""Execute a pentesting tool. Available: nmap_scan, subdomain_enum, osint_gather, web_vuln_scan, sql_injection_test, password_audit, directory_bruteforce, packet_capture, nettacker_scan, exploit_search, generate_report, ai_security_analysis, agent_status."""
|
| 527 |
if tool_name in self.tool_registry.tools:
|
| 528 |
fn = self.tool_registry.tools[tool_name]["fn"]
|
|
@@ -663,7 +663,7 @@ 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(
|
| 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>
|
|
@@ -671,7 +671,7 @@ def create_ui(config: AgentZeroConfig, chat_interface: ChatInterface, defense: 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)
|
|
@@ -724,7 +724,7 @@ def main():
|
|
| 724 |
print(f"[+] Defense: {'ACTIVE' if config.prompt_injection_defense else 'DISABLED'}")
|
| 725 |
print(f"[+] Model: {config.agent_model}\n")
|
| 726 |
demo = create_ui(config, chat_interface, defense)
|
| 727 |
-
demo.launch(server_name="0.0.0.0", server_port=7860, mcp_server=config.mcp_enabled, share=False, theme=gr.themes.Monochrome(primary_hue="green", secondary_hue="gray"))
|
| 728 |
|
| 729 |
if __name__ == "__main__":
|
| 730 |
main()
|
|
|
|
| 522 |
from smolagents import CodeAgent, InferenceClientModel, tool
|
| 523 |
|
| 524 |
@tool
|
| 525 |
+
def pentest_tool(tool_name: str, **kwargs: typing.Any) -> str:
|
| 526 |
"""Execute a pentesting tool. Available: nmap_scan, subdomain_enum, osint_gather, web_vuln_scan, sql_injection_test, password_audit, directory_bruteforce, packet_capture, nettacker_scan, exploit_search, generate_report, ai_security_analysis, agent_status."""
|
| 527 |
if tool_name in self.tool_registry.tools:
|
| 528 |
fn = self.tool_registry.tools[tool_name]["fn"]
|
|
|
|
| 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>
|
|
|
|
| 671 |
</div>""")
|
| 672 |
with gr.Row():
|
| 673 |
with gr.Column(scale=3):
|
| 674 |
+
chatbot = gr.Chatbot(type="tuples", 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)
|
|
|
|
| 724 |
print(f"[+] Defense: {'ACTIVE' if config.prompt_injection_defense else 'DISABLED'}")
|
| 725 |
print(f"[+] Model: {config.agent_model}\n")
|
| 726 |
demo = create_ui(config, chat_interface, defense)
|
| 727 |
+
demo.launch(css=css, server_name="0.0.0.0", server_port=7860, mcp_server=config.mcp_enabled, share=False, theme=gr.themes.Monochrome(primary_hue="green", secondary_hue="gray"))
|
| 728 |
|
| 729 |
if __name__ == "__main__":
|
| 730 |
main()
|