How to bind wget to download through a specific port?

18,288

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>

Share:
18,288
Kamran Hosseini
Author by

Kamran Hosseini

Updated on September 18, 2022

Comments

  • Kamran Hosseini
    Kamran Hosseini over 1 year

    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"

    • telcoM
      telcoM over 4 years
      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)?
    • Kamran Hosseini
      Kamran Hosseini over 4 years
      I think I'm using socks5 proxy (I'm using Dynamic Forwarding in ssh command)
    • dave_thompson_085
      dave_thompson_085 over 4 years
      '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.
  • Kamran Hosseini
    Kamran Hosseini over 4 years
    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?