how to use socks proxy from wget

Warning : This post is my own note, you may believe on it or not. 😛

Before continue read this post, I recommend you to read this post as preface.

Linux / BSD user usually familiar with shell, and wget is very usefull tool for download from shell. In this post I will explain how can wget use SOCKS proxy.

What is socks ?
From wikipedia “SOCKS is an Internet protocol that facilitates the routing of network packets between client–server applications via a proxy server. SOCKS performs at Layer 5 of the OSI model—the session layer (an intermediate layer between the presentation layer and the transport layer).”

Ok, this is the step.

  1. Create the tunnel (from another tty or ttyv or terminal). I use ssh to create tunnel on localhost port 9999. You may create the tunnel with ping tunnel (ptunnel) or another tools.
  2. lqman@development:~$ ssh -D 9999 -C lqman@180.247.xxx.xxx
    lqman@180.247.xxx.xxx's password : xxxxxxxx

    -D : bind on spesific port
    -C : compress the connection [optional]

  3. Check wheather the tunnel successfully created or not.
  4. lqman@development:~$ sudo netstat -atupln | grep 9999
    tcp 0 0 127.0.0.1:9999 0.0.0.0:* LISTEN 13680/ssh
    tcp6 0 0 ::1:9999 :::* LISTEN 13680/ssh

    if the LISTEN state appear, it means the tunnel has created successfully (on locahost port 9999) and ready to use.

  5. install tsocks
  6. lqman@development:~$ sudo aptitude install tsocks

  7. configure tsocks, uncomment every line, except three lines below, and
  8. lqman@development:~$ sudo vim /etc/tsocks.conf
    server = 127.0.0.1
    server_type = 5
    server_port = 9999

  9. Try to download with wget
  10. lqman@development:~$ tsocks wget google.com
    --2011-05-29 16:56:59-- http://google.com/
    Resolving google.com... 74.125.71.105, 74.125.71.106, 74.125.71.147, ...
    Connecting to google.com|74.125.71.105|:80... connected.
    HTTP request sent, awaiting response... 301 Moved Permanently
    Location: http://www.google.com/ [following]
    --2011-05-29 16:56:59-- http://www.google.com/
    Resolving http://www.google.com... 74.125.71.106, 74.125.71.147, 74.125.71.99, ...
    Connecting to http://www.google.com|74.125.71.106|:80... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: http://www.google.co.id/ [following]
    --2011-05-29 16:57:00-- http://www.google.co.id/
    Resolving http://www.google.co.id... 74.125.71.105, 74.125.71.106, 74.125.71.147, ...
    Connecting to http://www.google.co.id|74.125.71.105|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: unspecified [text/html]
    Saving to: “index.html”
    [ ] 10,182 37.5K/s in 0.3s
    2011-05-29 16:57:01 (37.5 KB/s) - “index.html” saved [10182]

    Thats all folks….
    Happy tunnelling & downloading dude.

    reference :
    http://www.dslreports.com/forum/remark,13563828
    man wget

Advertisements
  1. 7 October 2012 at 1:33 pm

    can you get axel working with socks proxy as it is a download accelerator ?

  2. 9 October 2012 at 2:26 am

    I never try it, but conceptually yes you can.

    From command line just type :

    tsocks axel http://your.download.location/file.iso

  3. 31 December 2012 at 7:56 am

    yes, just run it from terminal, as described above.

  1. 9 April 2015 at 2:02 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: