socks5-proxy-checker

socks5-proxy-checker: find the exact step where a SOCKS5 proxy fails

To check whether a SOCKS5 proxy works, go through the five things a SOCKS5 client does and see which one breaks: open a TCP connection to the port, send the SOCKS5 greeting, log in with the username and password, ask the proxy to connect to a website, and fetch one page through that tunnel. Each step fails for its own reason (wrong port, not a SOCKS5 port, wrong login, the proxy cannot reach the site, a TLS problem), yet curl tends to report several of them as the same short error. socks5_check.py runs the steps one at a time with nothing but the Python standard library, stops at the first failure and tells you what that failure usually means.

Proxy302 maintains this tool and sells these proxies: our static residential (ISP) IPs come as HTTP or SOCKS5, chosen when you buy, from $0.50 for one day or $7.99 for 30 days (prices). The checker works with any SOCKS5 proxy.

Usage

git clone https://github.com/proxy302/socks5-proxy-checker
cd socks5-proxy-checker
python3 socks5_check.py 'socks5://USER:PASS@HOST:PORT'
python3 socks5_check.py 'HOST:PORT:USER:PASS'            # the colon format many dashboards export
python3 socks5_check.py 'socks5://USER:PASS@HOST:PORT' --geo   # adds country, city and network owner

Python 3.8 or newer, no packages to install. On Windows run it with py socks5_check.py .... Keep the single quotes so the shell leaves !, $ and # in the password alone. In the URL form, percent-encode @ : / # inside the login (%40 %3A %2F %23); the colon form needs no encoding.

Example output

A passing check (test proxy on the same machine, so the times are tiny; exit address masked):

SOCKS5 check of HOST:PORT (user 'USER'), target https://ipinfo.io/json

[1/5] TCP connect            ok   1 ms
[2/5] SOCKS5 greeting        ok   server wants username/password (0x02), 0 ms
[3/5] Login                  ok   0 ms
[4/5] CONNECT ipinfo.io      ok   0 ms
[5/5] HTTPS request          ok   256 ms, exit IP x.x.x.x
      country   SG
      city      Singapore
      org       AS4817 Simba Telecom Pte Ltd
      timezone  Asia/Singapore

All steps passed. In curl use socks5h://, so the proxy resolves host names.

The same proxy with a wrong password:

[1/5] TCP connect            ok   1 ms
[2/5] SOCKS5 greeting        ok   server wants username/password (0x02), 0 ms
[3/5] Login                  FAIL connection closed or timed out after the login

Stopped at step 3. The proxy rejected the username or password (some servers close the connection instead of replying). Copy both again; URL-encode @ : / # in them.

How to read the result

Step that fails What it usually means What to do
1 TCP connect Wrong host or port, the server is down, or a firewall drops the traffic Copy host and port again; try from another network
2 Greeting, “closed without a reply” or “answered in HTTP” The port is not SOCKS5. Often it is an HTTP proxy Use http://USER:PASS@HOST:PORT instead
2 Greeting, “no reply” The port waits for something else, typically an HTTP request line Same as above
2 Greeting, method 0xff The server wants a login method you did not offer Add the username and password
3 Login Username or password rejected Re-copy both; watch for spaces at the ends
4 CONNECT, reply 0x02 to 0x08 Login worked, but the proxy could not or would not reach the site See the reply code list below; try another target
5 HTTPS request The tunnel opened but TLS or HTTP broke Check the system clock and CA certificates, then retry

Exit codes: 0 when every step passed, 11 to 15 when step 1 to 5 failed (10 plus the step number), 1 or 2 for a usage error. That makes it easy to call from another script.

CONNECT reply codes (RFC 1928)

Why it sends the host name, not an IP

At step 4 the script asks for api.ipify.org (or ipinfo.io) by name, so the proxy does the DNS lookup. That is what socks5h:// does in curl and Python requests. With plain socks5:// your own machine resolves the name first, which can leak the lookup and give you an address picked for your location instead of the proxy’s.

What it does not check

FAQ

curl gives me exit code 97. Which step is that? Exit 97 is curl’s “proxy handshake error”, which covers steps 2 to 4 here. Run this script to see which of the three it is.

Is my password sent anywhere else? Only to the proxy. Note that SOCKS5 username/password login (RFC 1929) travels unencrypted between you and the proxy, as it does in every SOCKS5 client.

The server needs no login, but I passed one. Is that a problem? No. Step 2 says “your credentials are not used”; the proxy is probably authorising you by IP address.

Can I check an HTTP proxy with it? No. For HTTP proxies run curl -v -x 'http://USER:PASS@HOST:PORT' https://api.ipify.org; a 407 line means the login was rejected.

Is HTTP or SOCKS5 the better choice? It depends on the software that will use the proxy. See SOCKS5 vs HTTP proxy.

Facts checked 19 November 2026.