Made README accurate

This commit is contained in:
creinky committed 2026-11-08 20:34:08 -07:00
1 parent a1bb028001
commit cc6aae0122
1 file changed
-84
-84
View File
@@ -1,84 +0,0 @@
"""
Test client for the Agentic Penetration Testing MCP Server (Beaconing Architecture).
Tests:
1. Connect to MCP server and list tools
2. Check server status
3. Queue a command via MCP tool
4. Wait for implant to beacon in, pick up command, and report result
5. Retrieve the result
"""
import asyncio
import time
from fastmcp import Client
async def test_beaconing_flow():
print("=== Testing Beaconing Architecture ===\n")
async with Client("http://localhost:8000/mcp") as client:
# Test 1: List tools
print("[Test 1] Listing available tools...")
tools = await client.list_tools()
tool_names = [t.name for t in tools]
print(f" Tools ({len(tools)}): {', '.join(tool_names)}")
expected_tools = ["nmap_scan", "list_network_interfaces", "run_command",
"get_result", "list_implants", "server_status"]
missing = [t for t in expected_tools if t not in tool_names]
if missing:
print(f" WARNING: Missing tools: {missing}")
else:
print(" ✓ All expected tools present")
# Test 2: Server status
print("\n[Test 2] Checking server status...")
status = await client.call_tool("server_status", {})
print(f" Architecture: {status['architecture']}")
print(f" Registered implants: {status['registered_implants']}")
# Test 3: List implants (should be empty or show test implant)
print("\n[Test 3] Listing implants...")
implants = await client.call_tool("list_implants", {})
print(f" Total: {implants['total_implants']}, Online: {implants['online']}")
# Test 4: Queue a command (will be picked up by implant on next beacon)
print("\n[Test 4] Queuing 'whoami' command...")
queued = await client.call_tool("run_command", {"command": "whoami"})
if "error" in queued:
print(f" ERROR: {queued['error']}")
print(" (Start an implant to test command execution)")
else:
request_id = queued["request_id"]
print(f" Queued with request ID: {request_id}")
# Wait for implant to process and report back
print(" Waiting for implant to beacon in and execute...")
result = None
for i in range(10):
await asyncio.sleep(2)
result = await client.call_tool("get_result", {"request_id": request_id})
if "result" in result:
print(f" ✓ Result received after {i+1} checks")
break
if result and "result" in result:
actual_result = result["result"]
print(f" Exit code: {actual_result.get('exit_code')}")
output = actual_result.get("output", "").strip()
print(f" Output: {output[:100]}")
else:
print(" Timed out waiting for result (is implant running?)")
# Test 5: Check implants again (should show test implant if it beacons)
print("\n[Test 5] Listing implants after beacon...")
implants = await client.call_tool("list_implants", {})
print(f" Total: {implants['total_implants']}, Online: {implants['online']}")
for imp in implants.get("implants", []):
print(f" - {imp['implant_id']}: online={imp['online']}, "
f"last_seen={imp['last_seen']}, pending={imp['pending_commands']}")
if __name__ == "__main__":
asyncio.run(test_beaconing_flow())