diff --git a/pre-deployment-test.sh b/pre-deployment-test.sh index cf6e061..0177c7a 100644 --- a/pre-deployment-test.sh +++ b/pre-deployment-test.sh @@ -54,16 +54,16 @@ test_conn() { local target=$1 local desc=$2 - # Check if we are on Linux (which supports /dev/tcp) or Mac if [[ "$OSTYPE" == "darwin"* ]]; then - # Mac Fallback: Use curl to check connection - if curl -sk --connect-timeout 3 "https://$target" > /dev/null 2>&1 || [ $? -eq 45 ] || [ $? -eq 35 ]; then + # Mac Fallback: If curl gets ANY status code, the port is open. + # -I (Head only), -s (Silent), -k (Insecure), --max-time 3 + if curl -Is --connect-timeout 3 "https://$target" > /dev/null 2>&1; then echo -e "${GREEN}[PASS]${NC} $desc ($target)" else echo -e "${RED}[FAIL]${NC} $desc ($target) - BLOCKED" fi else - # Linux Native: Faster and more reliable in locked-down environments + # Linux Native (Still the most reliable for VMs) if timeout 3 bash -c "cat < /dev/null > /dev/tcp/$target/443" 2>/dev/null; then echo -e "${GREEN}[PASS]${NC} $desc ($target)" else