update
This commit is contained in:
parent
f1c184a234
commit
2e71f1c6f0
1 changed files with 4 additions and 4 deletions
|
|
@ -54,16 +54,16 @@ test_conn() {
|
||||||
local target=$1
|
local target=$1
|
||||||
local desc=$2
|
local desc=$2
|
||||||
|
|
||||||
# Check if we are on Linux (which supports /dev/tcp) or Mac
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
# Mac Fallback: Use curl to check connection
|
# Mac Fallback: If curl gets ANY status code, the port is open.
|
||||||
if curl -sk --connect-timeout 3 "https://$target" > /dev/null 2>&1 || [ $? -eq 45 ] || [ $? -eq 35 ]; then
|
# -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)"
|
echo -e "${GREEN}[PASS]${NC} $desc ($target)"
|
||||||
else
|
else
|
||||||
echo -e "${RED}[FAIL]${NC} $desc ($target) - BLOCKED"
|
echo -e "${RED}[FAIL]${NC} $desc ($target) - BLOCKED"
|
||||||
fi
|
fi
|
||||||
else
|
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
|
if timeout 3 bash -c "cat < /dev/null > /dev/tcp/$target/443" 2>/dev/null; then
|
||||||
echo -e "${GREEN}[PASS]${NC} $desc ($target)"
|
echo -e "${GREEN}[PASS]${NC} $desc ($target)"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue