#!/usr/bin/env bash # Inspect WAF settings/rules and recent blocked requests. set -uo pipefail ENTRY="${1:-ipdduiyy}" BASE="http://127.0.0.1:8888/$ENTRY" PASS=$(awk -F': ' '/^password:/{print $2}' /www/server/panel/data/initial_password.txt) curl -s -c /tmp/ck.txt -H 'Content-Type: application/json' -H 'Origin: http://127.0.0.1:8888' \ -d "{\"username\":\"admin\",\"password\":\"$PASS\"}" "$BASE/api/v1/auth/login" >/dev/null echo "== settings ==" curl -s -b /tmp/ck.txt "$BASE/api/v1/waf/settings" echo echo "== rules ==" curl -s -b /tmp/ck.txt "$BASE/api/v1/waf/rules" echo echo "== status counts (all site logs) ==" awk '{print $9}' /www/wwwlogs/*/access.log 2>/dev/null | sort | uniq -c | sort -rn | head -12 echo "== recent non-2xx ==" grep -hE '" (403|404|429|444|503) ' /www/wwwlogs/*/access.log 2>/dev/null | tail -20 echo "== suspect patterns ==" grep -hE '\.(zip|tar\.gz|well-known)' /www/wwwlogs/*/access.log 2>/dev/null | tail -10