Skip to content
intermediate

How to Route Linux CLI Tools Through ProxyScrape SOCKS5 Proxies

Send curl, wget, git, proxychains, and Python through ProxyScrape's HTTP and SOCKS5 endpoints on Linux, with safe credential handling and DNS-leak-free SOCKS5h setup.

Linux SOCKS5 Web Scraping

Overview

On Linux, most tools do not read a single global proxy setting — each program looks at its own configuration file or at the http_proxy, https_proxy, and all_proxy environment variables. ProxyScrape supports HTTP and SOCKS5, and this guide shows how to point common command-line tools at your endpoint.

Prefer SOCKS5 with the socks5h scheme when you want DNS lookups to happen at the proxy rather than locally. That avoids DNS leaks and prevents failures when a target uses names your local resolver cannot see.

Steps

  1. Collect the endpoint. In the ProxyScrape dashboard, note the host, the HTTP port, the SOCKS5 port, and your username and password.

  2. Export credentials for your shell session. Avoid typing passwords directly into commands, where they end up in shell history:

    read -rsp "ProxyScrape username: " PS_USER && echo
    read -rsp "ProxyScrape password: " PS_PASS && echo
    export PS_HOST="your-host"
    export PS_HTTP_PORT="your-http-port"
    export PS_SOCKS_PORT="your-socks5-port"
    
  3. Test the HTTP proxy with curl.

    curl -x "http://$PS_USER:$PS_PASS@$PS_HOST:$PS_HTTP_PORT" https://ipinfo.io/ip
    
  4. Test SOCKS5. --socks5-hostname resolves DNS through the proxy. SOCKS5 username/password authentication requires curl 7.51.0 or newer:

    curl --socks5-hostname "$PS_HOST:$PS_SOCKS_PORT" -U "$PS_USER:$PS_PASS" https://ipinfo.io/ip
    
  5. Set environment variables for tools that respect them.

    export http_proxy="http://$PS_USER:$PS_PASS@$PS_HOST:$PS_HTTP_PORT"
    export https_proxy="$http_proxy"
    export no_proxy="localhost,127.0.0.1,.local"
    

    For SOCKS5, use export all_proxy="socks5h://$PS_USER:$PS_PASS@$PS_HOST:$PS_SOCKS_PORT". Not every program honours all_proxy; confirm with curl -v or the tool's own documentation.

  6. Configure wget. wget does not support SOCKS proxies, so use the HTTP port in ~/.wgetrc:

    use_proxy = yes
    http_proxy = http://USER:PASS@HOST:PORT
    https_proxy = http://USER:PASS@HOST:PORT
    

    Then restrict access with chmod 600 ~/.wgetrc.

  7. Route arbitrary binaries with proxychains-ng. Install proxychains-ng and add your endpoint to proxychains.conf:

    socks5 HOST PORT USER PASS
    

    proxychains-ng accepts optional username and password fields after the port; if your build rejects them, check your distribution's documentation for that version. Then prefix any command:

    proxychains4 curl https://ipinfo.io/ip
    
  8. Use it from Python.

    import os, requests
    url = f"http://{os.environ['PS_USER']}:{os.environ['PS_PASS']}@{os.environ['PS_HOST']}:{os.environ['PS_HTTP_PORT']}"
    proxies = {"http": url, "https": url}
    print(requests.get("https://ipinfo.io/ip", proxies=proxies, timeout=15).text)
    

    Install requests[socks] if you prefer the SOCKS5 port.

  9. Keep secrets out of plain files. Prefer environment variables or ~/.netrc with chmod 600, and remember that credentials passed directly on a command line can be visible to other users via ps aux.