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"

Paulo Tomé
  • 3,754
  • 6
  • 26
  • 38
Kamran Hosseini
  • 183
  • 1
  • 1
  • 11
  • 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 '19 at 17:50
  • I think I'm using socks5 proxy (I'm using Dynamic Forwarding in ssh command) – Kamran Hosseini Nov 23 '19 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. – dave_thompson_085 Nov 24 '19 at 03:23

1 Answers1

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>

Sefa
  • 121
  • 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? – Kamran Hosseini Nov 23 '19 at 21:09