#!/bin/bash
cd /root/recon
mk() { awk -F'\t' 'NR<=2{print $1" "$2" "$3}' lists/$1.txt; }
vp() {
  local name=$1; shift
  echo "######## $name"
  while read -r ip port scheme; do
    [ -z "$ip" ] && continue
    echo "---- $scheme://$ip:$port"
    curl -g -sk -m 8 -D /tmp/h.txt "$scheme://$ip:$port$1" -o /tmp/b.html
    echo "[hdr]"; grep -a -i -E "^(server|set-cookie|x-|etag)" /tmp/h.txt | cut -c1-120 | head -4
    echo "[body]"; grep -a -o -i -E "(version|build|release|firmware|fortigate|sonicwall|plesk|citrix|simplehelp)[^\"<>]{0,40}" /tmp/b.html | head -6
  done <<< "$(mk $name)"
}
vp fortinet "/remote/login?lang=en"
vp sonicwall "/"
vp citrix "/"
vp simplehelp "/"
vp zimbra "/"
