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.
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
-
Collect the endpoint. In the ProxyScrape dashboard, note the host, the HTTP port, the SOCKS5 port, and your username and password.
-
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" -
Test the HTTP proxy with curl.
curl -x "http://$PS_USER:$PS_PASS@$PS_HOST:$PS_HTTP_PORT" https://ipinfo.io/ip -
Test SOCKS5.
--socks5-hostnameresolves 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 -
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 honoursall_proxy; confirm withcurl -vor the tool's own documentation. -
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:PORTThen restrict access with
chmod 600 ~/.wgetrc. -
Route arbitrary binaries with proxychains-ng. Install
proxychains-ngand add your endpoint toproxychains.conf:socks5 HOST PORT USER PASSproxychains-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 -
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. -
Keep secrets out of plain files. Prefer environment variables or
~/.netrcwithchmod 600, and remember that credentials passed directly on a command line can be visible to other users viaps aux.