#!/bin/bash
site=$1
resp=$(curl -sk --connect-timeout 3 --max-time 5 -X POST "$site/wp-json/otm-ac/v1/update-widget-options" \
  -H "Content-Type: application/json" -d '{}' 2>/dev/null)
if echo "$resp" | grep -q '"status":"success"'; then
  echo "VULN|$site"
elif echo "$resp" | grep -q "rest_no_route\|rest_not_logged_in"; then
  echo "NO_ROUTE|$site"
elif [ -z "$resp" ]; then
  echo "TIMEOUT|$site"
else
  echo "OTHER|$site|${resp:0:80}"
fi
