Proxychains4 and Tor for terminal network proxying
This article is original, reproduced please indicate the source
Proxychains4 proxy
Installation
shell
apt install proxychains4
Simple Configuration
Edit configuration file, for reference only
txt
# Four proxy chain methods
#Every connection will be done through chained proxies, dead proxies are skipped
#dynamic_chain
#Every connection will be done through chained proxies, all proxies must be online to connect
#strict_chain
#Each connection will be done through the chain proxy with `chain len`
#round_robin_chain
#Each connection will be done through a random proxy with `chain len`
random_chain
chain_len = 2
# Quiet mode (no output from library)
#quiet_mode
#timeout ms
tcp_read_time_out 15000
tcp_connect_time_out 8000
# IPv4 only, does not support https
# example:
# socks5 192.168.67.78 1080
# http 192.168.89.3 8080 justu hidden
# socks4 192.168.1.49 1080
[ProxyList]
#Fill in the proxy chain here, not less than `chain_len`
Free agent address Website
Test
shell
proxychains4 curl ipinfo.io
Output
txt
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.16
[proxychains] Random chain ... ip_one ... ip_two ... ipinfo.io:80 ... OK
{
"ip": "*.*.*.*",
"city": "Pittsburg",
"region": "Kansas",
"country": "US",
"loc": "37.4109,-94.7050",
"org": "AS22773 Cox Communications Inc.",
"postal": "66762",
"timezone": "America/Chicago",
"readme": "https://ipinfo.io/missingauth"
}
Tor proxy
Installation
shell
apt install tor
#start up tor service
tor
Test
Generally, the servers of the onion network will not be released
shell
torsocks curl ipinfo.io
Output
txt
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>403 Forbidden</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Forbidden</h1>
<h2>Your client does not have permission to get URL <code>/</code> from this server.</h2>
<h2></h2>
</body></html>
But you can confirm whether the proxy is successful through https://check.torproject.org
shell
torsocks curl -s https://check.torproject.org/ | grep -A 3 "<title>" | sed 's/<title>//'
Output
txt
Congratulations. This browser is configured to use Tor.
In order to be more convenient to use, the following configuration is generally used when using
shell
#Open the current command line proxy, and then do not need to add `torsocks` before each command
. torsocks on
#Close the current command line agent
. torsocks off
Tor by default enables the socks5 9050 proxy port.