#!/usr/bin/env bash # Hamid Scanner Menu: SSTP + DoH # Colors RED="\033[31m"; GREEN="\033[32m"; PURPLE="\033[35m"; CYAN="\033[36m"; MAGENTA="\033[35m"; RESET="\033[0m" TAG="${PURPLE}┌────────────────────┐\n│ t.me/vpn_proxy66 │\n└────────────────────┘${RESET}" # ---------------------------------------------------------- # Option 1 — SSTP Scanner (Host + Country + Status) # ---------------------------------------------------------- scan_sstp() { PAGE_URL="https://ipspeed.info/free-sstp.php" echo "[*] Fetching SSTP servers..." HTML="$(curl -fsSL "$PAGE_URL")" || { echo "[!] Fetch failed"; return; } mapfile -t RAW_HOSTS < <(echo "$HTML" | grep -Eo '[a-zA-Z0-9.-]+\.[a-z]{2,6}:[0-9]{2,5}') if [[ ${#RAW_HOSTS[@]} -eq 0 ]]; then echo "[!] No hosts found" return fi echo "[*] Testing servers..." for item in "${RAW_HOSTS[@]}"; do host="${item%%:*}" port="${item##*:}" [[ "$host" == "$port" ]] && port=443 # Get country directly from ip-api (it resolves host internally) country=$(curl -fsSL "http://ip-api.com/json/$host" | grep -Po '"country":"\K[^"]+' 2>/dev/null) [[ -z "$country" ]] && country="Unknown" # Test connectivity using your public IP if timeout 5 bash -c "echo > /dev/tcp/${host}/${port}" 2>/dev/null; then echo -e "${GREEN}[OPEN] ${host}:${port} — $country${RESET}\n$TAG" else echo -e "${RED}[CLOSED] ${host}:${port} — $country${RESET}\n$TAG" fi done } # ---------------------------------------------------------- # Option 2 — DoH Scanner (Fast + Country + Status + Best) # ---------------------------------------------------------- scan_doh_dns() { LIST_URL="https://raw.githubusercontent.com/10ium/Public-DNS-Collector/main/lists/doh.txt" TEST_DOMAIN="example.com" TIMEOUT=1 PARALLEL=35 echo -e "${MAGENTA}Downloading DoH list...${RESET}" LIST=$(curl -fsS "$LIST_URL") || { echo "Error downloading list"; return; } LIST=$(echo "$LIST" | grep -v '^$') TOTAL=$(echo "$LIST" | wc -l) echo "Total: $TOTAL servers" TMP=$(mktemp) current=0 test_one() { base="$1" if [[ "$base" == *"dns-query"* ]]; then URL="$base?name=$TEST_DOMAIN&type=A" else URL="$base/dns-query?name=$TEST_DOMAIN&type=A" fi start=$(date +%s%3N) code=$(curl -o /dev/null -s -w "%{http_code}" --max-time $TIMEOUT "$URL") end=$(date +%s%3N) ms=$((end - start)) # Get country of server country=$(curl -fsSL "http://ip-api.com/json/$(echo $base | awk -F/ '{print $3}')" | grep -Po '"country":"\K[^"]+' 2>/dev/null) [[ -z "$country" ]] && country="Unknown" if [[ "$code" == "200" ]]; then echo "[OPEN] $base — ${ms}ms — $country" >> "$TMP" else echo "[CLOSED] $base — $country" >> "$TMP" fi current=$((current+1)) percent=$((current*100/TOTAL)) echo -ne "Progress: $percent% ($current/$TOTAL)\r" } export -f test_one export TMP TEST_DOMAIN TIMEOUT echo "$LIST" | xargs -n1 -P$PARALLEL bash -c 'test_one "$@"' _ echo -e "\n${CYAN}Results:${RESET}" grep "\[OPEN\]" "$TMP" | sort -nk3 | head -n1 | while read line; do echo -e "${GREEN}$line${RESET}\n$TAG" done grep "\[CLOSED\]" "$TMP" | while read line; do echo -e "${RED}$line${RESET}\n$TAG" done rm -f "$TMP" } # ---------------------------------------------------------- # Menu # ---------------------------------------------------------- while true; do echo -e "\n${CYAN}Hamid Scanner Menu${RESET}" echo "1) SSTP Scanner" echo "2) DoH Scanner" echo "3) Exit" read -rp "Choose option: " opt case $opt in 1) scan_sstp ;; 2) scan_doh_dns ;; 3) exit 0 ;; *) echo "Invalid option" ;; esac done