Use any Linux applications through a proxy (apt-get, wget etc)

It’s pretty normal in many Organizations to use get servers to connect to Internet via a Proxy. In most cases it’s for updating apt-get or yum via  proxy. However, quite often you might need to download packages directly using wget or curl and setting up apt-get or apt via proxy, wget via proxy, curl via proxy is a pain. What if you could simply setup a  Proxy and just use any applications to use that using a simply command? I faced this many times and hence writing this guide. Note that if you’re only allowing apt-get via proxy then stick with configuring /etc/apt.conf or /etc/apt/conf.d/00proxy or something similar but if you need to allow different applications via a proxy then this method is best and simplest.

Use any Linux applications through a proxy (apt-get, wget etc)

This also helps when you’re trying to install apt packages from sources outside of restricted DMZ’s or State Nations especially from PPA. For example: if you try to update the c++ compiler to g++-6 or g++-7 through

sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update
sudo apt-get install g++-7 -y

it might take you a very long time to finish downloading. But if you have a socks5 proxy or HTTP or HTTPS Proxy out there, this method will make things so much faster. The idea is to use apt-get or other applications using a HTTP or HTTPS or SOCKS5 proxy. So let’s get to it:

Install proxychains

sudo apt-get install proxychains

Setup proxychains

Setup is pretty straight forward. You simply edit the file in /etc/proxychains.conf and add proxy details. You can use socks5, http, https or any supported proxy with username and password if they have any.

Since my socks5 proxy server is running at through port 1080, my setting is

socks5 1080

at the last line of /etc/proxychains.conf.

Run proxychains with apt-get

sudo proxychains apt-get update
sudo proxychains apt-get install g++-7 -y

Done in minutes!

Proxychains with wget and other applications

You can also use the proxychains for other software as below:

sudo proxychains synaptic
proxychains julia
proxychains wget

This surely beats the annoying settings for wget or curl with extra parameters or using /etc/wgetrc or similar configurations.

Hope it helps

Check Also

Bypass Web Application Firewall using WAFNinja - blackMORE Ops

Bypass Web Application Firewall using WAFNinja

WAFNinja is a CLI python tool that helps penetration testers to bypass Web Application Firewall …

Use, Twitter, Facebook, or Google+ accounts to comment (anonymous comments allowed). Leave your solution to help others.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Privacy Policy on Cookies Usage

Some services used in this site uses cookies to tailor user experience or to show ads.