#!/bin/bash
echo "=== Deep Probe 3 - Accessible Targets ==="
echo "Started: $(date)"

echo ""
echo "========== havanatur.cu =========="
echo "--- JS bundles ---"
curl -ks --connect-timeout 15 -m 30 "https://www.havanatur.cu/" 2>/dev/null | grep -oP 'src="[^"]*\.js"' | head -10
echo ""
echo "--- ngsw.json (Angular service worker) ---"
curl -ks --connect-timeout 10 -m 20 "https://www.havanatur.cu/ngsw.json" 2>/dev/null | head -c 2000
echo ""
echo "--- manifest ---"
curl -ks --connect-timeout 10 -m 20 "https://www.havanatur.cu/manifest.webmanifest" 2>/dev/null
echo ""

echo "========== juventudrebelde.cu =========="
curl -ksI --connect-timeout 15 -m 20 "https://www.juventudrebelde.cu/" 2>/dev/null | head -20
echo "--- robots.txt ---"
curl -ks --connect-timeout 10 -m 20 "https://www.juventudrebelde.cu/robots.txt" 2>/dev/null

echo ""
echo "========== cuba.cu =========="
curl -ksI --connect-timeout 15 -m 20 "https://www.cuba.cu/" 2>/dev/null | head -20

echo ""
echo "========== bandec.cu (bank) =========="
curl -ksI --connect-timeout 10 -m 20 "https://www.bandec.cu/" 2>/dev/null | head -15
echo ""
curl -ks --connect-timeout 10 -m 20 "https://www.bandec.cu/" 2>/dev/null | head -c 500

echo ""
echo "========== correos.cu (post office) =========="
curl -ksI --connect-timeout 10 -m 20 "https://www.correos.cu/" 2>/dev/null | head -15
echo ""
curl -ks --connect-timeout 10 -m 20 "https://www.correos.cu/" 2>/dev/null | head -c 500

echo ""
echo "========== cubana.cu (airline) =========="
curl -ksI --connect-timeout 10 -m 20 "https://www.cubana.cu/" 2>/dev/null | head -15

echo ""
echo "========== vuceregulaciones-admin.mincex.gob.cu (IIS 8.5) =========="
curl -ksI --connect-timeout 10 -m 20 "https://vuceregulaciones-admin.mincex.gob.cu/" 2>/dev/null
echo ""
echo "--- Login page ---"
curl -ks --connect-timeout 10 -m 20 "https://vuceregulaciones-admin.mincex.gob.cu/Default.aspx?ReturnUrl=%2f" 2>/dev/null | head -c 1000
echo ""
echo "--- IIS paths ---"
for path in "/web.config" "/elmah.axd" "/trace.axd" "/iisstart.htm"; do
  status=$(curl -ks -o /dev/null -w "%{http_code}|%{size_download}" --connect-timeout 10 -m 20 "https://vuceregulaciones-admin.mincex.gob.cu$path" 2>/dev/null)
  echo "  [$status] $path"
done

echo ""
echo "========== SSL Cert Check =========="
for domain in "www.fgr.gob.cu" "www.tsp.gob.cu" "www.citma.gob.cu" "www.parlamentocubano.gob.cu" "www.havanatur.cu" "www.juventudrebelde.cu" "www.bandec.cu"; do
  echo "--- $domain ---"
  echo | openssl s_client -connect "$domain:443" -servername "$domain" 2>/dev/null | openssl x509 -noout -subject -issuer -dates 2>/dev/null
done

echo ""
echo "Completed: $(date)"
