Building the latest version of ProxyChains-NG on Ubuntu 18.10
April 19, 2019
Today I was working with an older version of ProxyChains which has the
habit of printing to stdout
:
ProxyChains-3.1 (http://proxychains.sf.net)
This even occurs when quiet_mode
is added to the configuration
file. This is very annoying if the output is, for example, JSON that
one wants to pipe into another program like jq
.
So I decided to build ProxyChains-NG version 4.14. And if this version has the same problem at least I can remove the offending line in the source code and compile a version without it.
In order to be able to write down complete instructions for others to follow I created a new virtual machine with Ubuntu version 18.10.
I used the following steps to download, compile, and install the latest version of ProxyChains-NG:
sudo apt install -y git make gcc
git clone https://github.com/rofl0r/proxychains-ng.git
cd proxychains-ng
make
sudo make install
cd ..
rm -rf proxychains-ng
This installs proxychains4
in /usr/local/bin
. In order to test the
program I first created a configuration file named proxychains.conf
in the current directory with the following lines:
random_chain
chain_len = 1
tcp_read_time_out 15000
tcp_connect_time_out 10000
[ProxyList]
socks5 127.0.0.1 1080
Next, I created a SOCKS5 tunnel to johnbokma.com as follows:
ssh -fND 1080 john@johnbokma.com -p XXXXX
Note that I use a non-default port which I have masked above for security reasons.
Next, I tested as follows:
proxychains4 -q curl -s ip-api.com/json/ | jq '.'
Note how proxychains4
is put in quiet mode with option -q
and cURL in silent mode with option -s
.
This command gave the following output:
{
"as": "AS33070 Rackspace Hosting",
"city": "San Antonio",
"country": "United States",
"countryCode": "US",
"isp": "Rackspace Hosting",
"lat": 29.508,
"lon": -98.3942,
"org": "Rackspace",
"query": "174.143.254.155",
"region": "TX",
"regionName": "Texas",
"status": "success",
"timezone": "America/Chicago",
"zip": "78218"
}
The above query value shows that that curl
connects via the SOCKS5 tunnel to this service, and hence the IP address of johnbokma.com is reported back.
I use jq
to format the output of this online service. This program is
a lightweight and flexible command-line JSON processor, which here is used
with just its identity filter '.'
to pretty print the output.
You can install this program as follows:
sudo apt install -y jq
If you work with JSON and cURL a lot, I recommend to read the manual of jq
because it can do much more than pretty printing its input.
Related
- ProxyChains-NG - GitHub repository.
- Subversion proxy: fixed IP address with proxychains.
- jq.