11

Is there any way to anonymize http requests through the command line? In other words, is it possible to wget a page without the requester's IP showing up?

16

One method of annoymizing HTTP traffic from the command line is to use tor. This article discusses the method, titled: How to anonymize the programs from your terminal with torify.

General steps from article

  1. You can install the tor package as follows:

    Fedora/CentOS/RHEL

    $ sudo yum install tor
    

    Ubuntu/Debian

    $ sudo apt-get install tor
    
  2. Edit this file /etc/tor/torrc so that the following lines are present and uncommented:

    ControlPort 9051
    CookieAuthentication 0
    
  3. Start the tor service

    $ sudo /etc/init.d/tor restart
    
  4. Testing setup

    Real IP

    $ curl ifconfig.me 67.253.170.83

    anonymized IP

    $ torify curl ifconfig.me 2>/dev/null 46.165.221.166

    As you can see the ifconfig.me website thinks our IP address is now 46.165.221.166. You can tell tor to start a new session triggering a new IP address for us:

    $ echo -e 'AUTHENTICATE ""\r\nsignal NEWNYM\r\nQUIT' | nc 127.0.0.1 9051
    250 OK
    250 OK
    250 closing connection
    
    $ torify curl ifconfig.me 2>/dev/null
    37.252.121.31
    

    Do it again to get another different IP

    $ echo -e 'AUTHENTICATE ""\r\nsignal NEWNYM\r\nQUIT' | nc 127.0.0.1 9051
    250 OK
    250 OK
    250 closing connection
    
    $ torify curl ifconfig.me 2>/dev/null
    91.219.237.161
    
  5. Downloading Pages

    $ torify curl www.google.com 2>/dev/null
    
  6. Browsing the internet via elinks

    $ torify elinks www.google.com
    

         ss of elinks

References

  • 1
    Thanks for this ! But do you mind adding an example on how to test tor 9050 socks without using torify ? I'm trying to use curl --socks5 or even socks4 or socks4a, but never worked. It just freezed. – bertie Jun 1 '14 at 14:20
  • @slm: sorry, i finally got it working. It's just because of i have environment http_proxy of localhost:4001 after installing anon_proxy. Removing the environment variables and redoing curl --socks5 worked out fine. I just deleted my question. Thank you for your answer. – bertie Jun 1 '14 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.