Contents
Preface
Proxychains is a UNIX/LINUX program that can redirect the TCP connection of an application to a specified proxy server through a secure tunnel. The protocols supported by Proxychains are SOCKS4, SOCKS5, HTTP and HTTPS. Compared with other similar tools, ProxyChains only forwards the TCP connection of the current application to the proxy, rather than directly implementing the proxy globally. In fact, most of the time we only need some applications to go through the proxy, so ProxyChains is more suitable for our general usage scenarios.
Deployment and basic configuration
It is installable on all Linux distributions. To install, type or copy the following command in your Linux terminal:
sudo apt-get install proxychains
Before using the proxychains command, you need to edit the configuration file and specify the proxy address and port:
vim /etc/proxychains.conf
Simply add a proxy server at the end. For example, add an http proxy with an address of 192.168.1.1 and a port of 12345:
http 192.168.1.1 12345
As shown below:
Here is a usage trick, which is to use it with virtual networking. If virtual networking software (such as tailscale) is installed on the cloud server, then the cloud server can directly use the virtual networking address to access the home device that also has virtual networking installed (and what if the home device happens to have scientific capabilities, and the home device with scientific capabilities happens to provide a proxy function?), so just specify the virtual networking address and corresponding port of the home device in the configuration file. Of course, mapping the public network address is also OK, but it is not as safe as directly using the virtual networking address. In the future, safety comes first.
The use of ProxyChains is very simple: just add proxychains before the application:
proxychains docker pull xxxx
This method is effective in solving the problem of cloud servers being unable to pull docker images.
Everyone can usecurl cip.cc
andproxychains curl cip.cc
The two commands perform a comparison:
This is a normal access. You can see that the address returned directly is the address of my cloud server:
After using proxychains, the final response is my home broadband address:
This is because the request has been forwarded to my home proxy through the TailScale address, and then the proxy goes out of my home to the broadband address.
As for other application scenarios, you can use your imagination.
Proxychains advanced skills: proxy chain
Proxychains supports three types of proxy chains: strict_chain, dynamic_chain, and random_chain:
Note: You can only choose one of the above three proxy chain methods. To use one of them, just remove the # comment and comment out the other two with #.
1. Strict chain
The proxy servers added in the configuration file form a chain, and user requests must pass through all proxy servers in strict order. This method requires all proxy servers to be available, which is also the default working mode of proxychains.proxychains.conf
If more than one proxy server is added at the end, the strict chain mode will take effect. At this time, if one proxy server is unavailable, proxychains will not work properly.
2. Dynamic Chain
Like the strict chain, the dynamic chain is also composed of a chain in the order of the proxy servers added in the configuration file. The difference is that if one of the proxy servers is unavailable, the dynamic chain will automatically exclude it, so as long as at least one proxy server is available, the dynamic chain can work normally.
If you want to use proxy chaining, dynamic chaining is the recommended way.
3. Random Chain
As the name suggests, random chain selects the proxy server added in the configuration file in a random manner, which is suitable for network scanning.chain_len
This parameter is only effective in random chain mode. It can define the length of the random chain. The default value is 2.
Note: For detailed concepts and construction of proxy chains, please refer to my other article:Home data center series uses gost to build its own proxy server and forwarding proxy chain.
Afterword
In fact, this is an old article I wrote before, but it was written in a rough style. The reason I rewrote this article is that I am going to write articles about gost and Proxifier. These three softwares actually complement each other and can be called the three swordsmen of proxies. So I simply went back and reconstructed this article I wrote before, which echoes the other two articles and can be regarded as a good article.
In addition, proxychains is a terminal tool. A similar desktop tool is Proxifier. For its usage, see the article:The home data center series uses proxifier to allow applications that do not support but need to use a proxy to use a proxy.