This commit is contained in:
SechPoint 2026-03-12 09:31:12 +00:00
parent f1c184a234
commit 2e71f1c6f0

View file

@ -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