#!/bin/bash LAN_IP="10.11.10.200" API="http://${LAN_IP}:5000" echo "==========================================" echo " DOMAIN-CHECK - Complete Test Suite" echo " API: $API" echo "==========================================" echo "" # Test 1: Health Check echo "✓ Test 1: Health Check" curl -s "${API}/health" | python3 -m json.tool if [ $? -eq 0 ]; then echo "✅ Health check PASSED" else echo "❌ Health check FAILED" exit 1 fi echo "" # Test 2: API Root echo "✓ Test 2: API Root" curl -s "${API}/" | python3 -m json.tool echo "" # Test 3: WHOIS Only echo "✓ Test 3: WHOIS Check - github.com" curl -s -X POST "${API}/api/v1/check" \ -H "Content-Type: application/json" \ -d '{"domain": "github.com", "check_options": {"whois": true, "dns": false, "ssl": false}}' \ | python3 -m json.tool > /tmp/test3.json if grep -q "\"success\": true" /tmp/test3.json; then echo "✅ WHOIS check PASSED" cat /tmp/test3.json | jq '.data.whois' | head -15 else echo "❌ WHOIS check FAILED" cat /tmp/test3.json fi echo "" # Test 4: DNS Only echo "✓ Test 4: DNS Check - google.com" curl -s -X POST "${API}/api/v1/check" \ -H "Content-Type: application/json" \ -d '{"domain": "google.com", "check_options": {"whois": false, "dns": true, "ssl": false}}' \ | python3 -m json.tool > /tmp/test4.json if grep -q "\"success\": true" /tmp/test4.json; then echo "✅ DNS check PASSED" cat /tmp/test4.json | jq '.data.dns' | head -20 else echo "❌ DNS check FAILED" cat /tmp/test4.json fi echo "" # Test 5: Full Check (WHOIS + DNS) echo "✓ Test 5: Full Check - facebook.com" curl -s -X POST "${API}/api/v1/check" \ -H "Content-Type: application/json" \ -d '{"domain": "facebook.com", "check_options": {"whois": true, "dns": true, "ssl": false}}' \ | python3 -m json.tool > /tmp/test5.json if grep -q "\"success\": true" /tmp/test5.json; then echo "✅ Full check PASSED" cat /tmp/test5.json | jq '.data.risk_score' | head -15 else echo "❌ Full check FAILED" cat /tmp/test5.json fi echo "" # Test 6: Risk Scoring echo "✓ Test 6: Risk Score Analysis" cat /tmp/test5.json | jq '{ domain: .data.domain, risk_level: .data.risk_score.level, total_score: .data.risk_score.total, factors: .data.risk_score.factors | map({factor: .factor, score: .score}) }' echo "" # Test 7: Database Check echo "✓ Test 7: Database Verification" docker exec dns_postgres psql -U dns_admin -d domain_check -c \ "SELECT d.full_domain, ra.total_score, ra.risk_level, ra.assessed_at FROM risk_assessments ra JOIN domains d ON ra.domain_id = d.id ORDER BY ra.assessed_at DESC LIMIT 5;" echo "" # Test 8: Swagger UI echo "✓ Test 8: Swagger UI" echo " URL: http://${LAN_IP}:5000/docs" echo "" # Test 9: ReDoc echo "✓ Test 9: ReDoc Documentation" echo " URL: http://${LAN_IP}:5000/redoc" echo "" echo "==========================================" echo " ✅ All Tests Complete!" echo "==========================================" echo "" echo "📊 Access Points:" echo " API: http://${LAN_IP}:5000" echo " Docs: http://${LAN_IP}:5000/docs" echo " ReDoc: http://${LAN_IP}:5000/redoc" echo " Health: http://${LAN_IP}:5000/health" echo ""