4

I'm trying to download a file through wget. But I want to download it through a port which I configured as a proxy. How can I configure wget to download through a specific port in my computer? In other words, I want to bind wget to for example "localhost:8080"

3
  • What kind of proxy your special port is configured as? A HTTP proxy, some other protocol proxy, or a generic TCP connection proxy (like SSH port forwarding)?
    – telcoM
    Nov 23, 2019 at 17:50
  • I think I'm using socks5 proxy (I'm using Dynamic Forwarding in ssh command) Nov 23, 2019 at 17:52
  • 'bind' in sockets is an operation entirely different from and unrelated to using a proxy which is what you want, and the tag 'bind' is for a particular DNS-server program that is not related to either of those. ssh -D handles both socks4 and socks5, but 5 is (unsurprisingly) preferred. Nov 24, 2019 at 3:23

1 Answer 1

2

wget supports http, https and ftp proxies. You can use these types of proxies by typing extra arguments,

wget <url> -e use_proxy=yes -e http_proxy=127.0.0.1:8080    
wget <url> -e use_proxy=yes -e https_proxy=127.0.0.1:8080    
wget <url> -e use_proxy=yes -e ftp_proxy=127.0.0.1:8080

or, you can export them as environment variables.

However, in case of a socks5 proxy, I recommend installing proxychains. It also supports http, https etc. After installation, you should configure it through /etc/proxychains.conf. Then you can use wget as,

proxychains4 wget <url>

1
  • In it's documentation page it writes that proxychains is just for tcp connections: "This program forces any tcp connection made by any given tcp client to follow through proxy (or proxy chain). It is a kind of proxifier." So what about other protocols? Nov 23, 2019 at 21:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .