-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathquickstart-overlay.sh
More file actions
executable file
·117 lines (104 loc) · 3.62 KB
/
Copy pathquickstart-overlay.sh
File metadata and controls
executable file
·117 lines (104 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/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 ""