#!/bin/bash
cd /root/recon
echo '== SW 101 hosts =='
cat sw_wsproxy2.txt
echo '== their identities (title/cert via prober quick) =='
for ip in $(awk '{print $1}' sw_wsproxy2.txt); do
  echo "--- $ip"
  curl -sk -m 8 -o /tmp/si_$ip.html "https://$ip/" -w 'root:%{http_code}\n'
  grep -aoiE '<title[^>]*>[^<]*' /tmp/si_$ip.html | head -1
  rm -f /tmp/si_$ip.html
done
echo '== BT vuln-version identification =='
for ip in 173.223.102.33 172.105.70.239 172.105.78.183 172.105.70.168; do
  echo "--- $ip"
  curl -sk -m 10 "https://$ip/get_portal_info" | head -c 220 | tr '\n' ' '; echo
  curl -sk -m 10 -o /tmp/bi_$ip.html "https://$ip/"
  grep -aoiE '<title[^>]*>[^<]*' /tmp/bi_$ip.html | head -1
  rm -f /tmp/bi_$ip.html
done
echo FUDONE
