Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
Are you asking how to use an annonymizer service, such as tor, from the command line for http requests? –  slm Aug 17 '13 at 14:57
add comment

1 Answer

up vote 3 down vote accepted

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

share|improve this answer
    
Exactly what I needed. Thanks for this. –  Dervin Thunk Aug 17 '13 at 16:23
    
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 at 14:20
    
@bertie - ask as a new Q. Reference this one as a starting point. –  slm Jun 1 at 14:23
    
@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 at 15:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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