Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Make Traffic Follow Through Proxies Using ProxyChains

Installation

Ubuntu

wajig install proxychains4

Mac

brew install proxychains-ng

Notice that the proxychains-ng installed using Homebrew on Mac does not work well right now (as of 2019-03-07). An alternative way is to use proxychains via Docker on Mac. The Docker image dclong/jupyterhub-ds has proxychains (NOT proxychains-ng) installed.

Syntax

proxychains4 …

Resolve the DNS Contamination Issue in Firefox

The local DNS you use in China is probably contaminated and popular sites like Google, Facebook, etc. are not interpreted correctly. So if you are in China and use Firefox with Proxy, make sure to set network.proxy.socks_remote_dns to be true (follow steps below).

  1. Open an empty tab in …

Install Python Packages Behind Firewall

It is recommended that you use pip to install Python packages.

  1. If you don't already know the proxy in use (in your company), read the post Find out Proxy in Use to figure it out.

  2. Set proxy environment variables.

    set http_proxy=http://user:password@proxy_ip:port
    set https_proxy=https://user …

Use wget with Proxy

  1. If you don't already know the proxy in use (in your company), read the post Find out Proxy in Use to figure it out.

  2. Put the following lines into your wget configuration file, which is usually ~/.wget.

    use_proxy = on
    http_proxy = http://username:password@proxy_ip:port
    https_proxy = http://username:password@proxy_ip …

Proxy for `sudo`

You can setup proxy in a terminal by export environment variables http_proxy and `https_proxy'.

export http_proxy='proxy_server:port'
export https_proxy='proxy_server:port'

However, you might find the exported environment variables are not visible to sudo. This can be resovled by simplying adding the -E (preserve environment) option to sudo.

sudo …