#!/bin/bash # NetGoat AI Debug Overlay Quick Start Script set -e echo "๐Ÿ NetGoat AI Debug Overlay Quick Start" echo "========================================" echo "" # Check if we're in the agent directory if [ ! -f "main.go" ]; then echo "โŒ Error: Please run this script from the agent directory" exit 1 fi # Step 1: Build the agent echo "๐Ÿ“ฆ Step 1: Building agent..." go build -o agent . if [ $? -eq 0 ]; then echo "โœ… Agent built successfully" else echo "โŒ Build failed" exit 1 fi # Step 2: Check config echo "" echo "โš™๏ธ Step 2: Checking configuration..." if [ -f "config.yml" ]; then if grep -q "debug_overlay: true" config.yml; then echo "โœ… Debug overlay is enabled" else echo "โš ๏ธ Debug overlay is not enabled in config.yml" echo " Add 'debug_overlay: true' to enable it" fi else echo "โš ๏ธ No config.yml found in the current directory" echo " Create a config.yml and add 'debug_overlay: true' to enable the debug overlay" fi # Step 3: Add test route to database echo "" echo "๐Ÿ—„๏ธ Step 3: Setting up test route..." if [ ! -d "database" ]; then mkdir -p database fi # Create a simple test backend using Python echo "๐ŸŒ Step 4: Setting up test backend..." cat > /tmp/netgoat_test_backend.py << 'EOF' #!/usr/bin/env python3 from http.server import HTTPServer, SimpleHTTPRequestHandler import os class CORSRequestHandler(SimpleHTTPRequestHandler): def end_headers(self): self.send_header('Access-Control-Allow-Origin', '*') super().end_headers() def do_GET(self): # Serve the test HTML file if self.path == '/' or self.path == '/index.html': self.send_response(200) self.send_header('Content-type', 'text/html') self.end_headers() with open('public/test-overlay.html', 'rb') as f: self.wfile.write(f.read()) else: super().do_GET() if __name__ == '__main__': os.chdir('.') server = HTTPServer(('localhost', 8888), CORSRequestHandler) print('๐ŸŒ Test backend running on http://localhost:8888') server.serve_forever() EOF chmod +x /tmp/netgoat_test_backend.py # Instructions echo "" echo "โœ… Setup complete!" echo "" echo "๐Ÿ“‹ Next steps:" echo "==============" echo "" echo "1๏ธโƒฃ Start the test backend (in a new terminal):" echo " python3 /tmp/netgoat_test_backend.py" echo "" echo "2๏ธโƒฃ Start the NetGoat agent (in another terminal):" echo " ./agent" echo "" echo "3๏ธโƒฃ Add a test route using the agent's database:" echo " sqlite3 database/proxy.db" echo " INSERT INTO routes (route_type, domain, target_url, active) VALUES ('domain', 'localhost:8080', 'http://localhost:8888', 1);" echo " .exit" echo "" echo "4๏ธโƒฃ Open your browser and visit:" echo " http://localhost:8080/test-overlay.html" echo "" echo "5๏ธโƒฃ Look for the ๐Ÿ NetGoat AI button in the bottom-right corner!" echo "" echo "๐Ÿ’ก Tips:" echo " - Click the goat button to expand/collapse the debug panel" echo " - Try the test buttons on the page to simulate different risk levels" echo " - Use X-GoatAI-Features header to test AI analysis" echo "" echo "๐Ÿงช Test AI with curl:" echo " # Safe request" echo " curl -H 'X-GoatAI-Features: 0.1,0.2,0.05,0.3,10,200,5,0' http://localhost:8080/" echo "" echo " # High-risk request (may be blocked)" echo " curl -H 'X-GoatAI-Features: 0.9,0.95,0.88,0.92,100,999,50,1' http://localhost:8080/" echo "" echo "๐Ÿ“š For more info, read: agent/DEBUG_OVERLAY.md" echo ""