Sunday, April 7, 2013

Using Tor and Privoxy on Kali / Debian / Backtrack Linux To Anonymize Internet Surfing or Open Blocked Websites

Written by: Pranshu Bajpai | Find Pranshu on Google+ And LinkedIn

Freedom of expression and speech is your fundamental right and if they try to take that away from you by blocking access to specific websites, then the tools mentioned in this post will aid you in defeating censorship.

They recently blocked websites like HackThisSite on the network that I use, categorizing them as "Hacking". Their intentions are good I'm sure but I need to visit such websites.




Anyway, I decided to use a proxy website (which is not always reliable since they will block access to those as well). As I suspected, it was blocked under 'Proxy Avoidance'.



Set up the onion router to get around this. First, you need to install it on your box using the following command:
# apt-get install tor privoxy
This will install 2 separate packages 'Tor' and 'Privoxy'.

Tor will host a proxy server on your machine on port 9050 of type 'Socks5'

Privoxy will host a proxy service on your machine on port 8118 of type 'HTTP'

Also install the GUI for tor called 'vidalia'
# apt-get install vidalia polipo
 Now, edit the Privoxy configuration file:
# vi /etc/privoxy/config
Add this line at the bottom of this file:
forward-socks4a / localhost:9050 .
Save and close the file. This will tell privoxy to forward Socks traffic to the Service running on port 9050 on your localhost (this service is Tor)

Time to fire up Tor and privoxy services:
# /etc/init.d/tor start
# /etc/init.d/privoxy start
Now goto Application -> Internet -> Vidalia

Check that it says 'connected to tor network'

You can click on 'view the network' to see all the relays that you are passing through.

Now goto your browser and set the proxy to:

Proxy IP -  '127.0.0.1'
Proxy port  - 9050
Type - Socks5

Note: If you are using the FireFox or Iceweasel browser, you can use 'AutoProxy' add-on to set this up.



Reload the website that was blocked earlier, if you've done it right, you should have access to it.



Furthermore, all your browsing is now anonymous since you are connected through the onion router.

41 comments:

  1. Thank you very much!

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete
  5. Excellent post!!! Works like a champ

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete
  7. Thanks
    Everything works good
    EgoDust

    ReplyDelete
  8. This is a great post however I am a little confused on why we need privoxy, as from what I can tell the web browser connects directly to tor on port 9050 rather than 8118 which is used by privoxy so why does it need to be installed and running is it doing something extra in the background?

    ReplyDelete
    Replies
    1. You're right. It's bypassing privoxy. The main reason to have privoxy is because tor will leak dns information if running as an http proxy. Privoxy is the fix for that, he done it wrong.

      Delete
  9. This comment has been removed by a blog administrator.

    ReplyDelete
  10. Thanks mate..very good post!!

    ReplyDelete
  11. Hi, excellent post, i have a question. In proxy settings, you set tor port 9050 directly. This way, privoxy is completely left out. I'm working on a similar set-up on Kali, and i'm looking at privoxy log. If i use tor port 9050, privoxy log is silent (on max debug), tor activity via arm shows network graph, sites are loading. If i specify privoxy, on default 8118 port, i see connections open and timeout on privoxy log, no tor activity, and sites never load. I try with two configs, privoxy forwarding to tor, and privoxy standalone.
    My conclusion is that you have left privoxy out of your config. Meaning, you leak header data outside...

    ReplyDelete
  12. This comment has been removed by a blog administrator.

    ReplyDelete
  13. tor is my but real ip is not chagimg.i use auto proxy setting but ,when I tried to watch www.whatismyipaddress.com.then my ip add is not changed

    ReplyDelete
  14. This comment has been removed by a blog administrator.

    ReplyDelete
  15. This comment has been removed by a blog administrator.

    ReplyDelete
  16. Is vidalia hide whole machine ip? If i use sqlmap then what to do to protect me not to be traced

    ReplyDelete
  17. I see no reason to also install polipo in this szenario. Why would you want two proxies installed?

    ReplyDelete
  18. Is your settings for Tor is a chained proxy setup? Or else, the trace might still trackable.

    ReplyDelete
  19. For attack this not very good.

    ReplyDelete
  20. This comment has been removed by the author.

    ReplyDelete
  21. I cant save "forward-socks4a/localhost:9050" on terminal. after edit i press ctrl+x its not working, so there is no saving option. Help...

    ReplyDelete
    Replies
    1. after typing that press esc key and then type wq and enter

      Delete
  22. Browser should be configured through 8118. If it's configured through 9050, you're bypassing privoxy and just going through TOR, which can leak time zone information.

    ReplyDelete
  23. getting error ...need help

    ReplyDelete
  24. hey bro I have one doubt what is the extension of kali linux softwares

    ReplyDelete
  25. Thank you ! it works !!

    ReplyDelete
  26. Kali Linux Problem :( Can Any one help me

    ReplyDelete
  27. I have a question which is confusing me, i applied every step in this tutorial, but after this when i checked my IP on "What is My IP" it was same as before

    ReplyDelete
    Replies
    1. did you change your proxy to manual?

      Delete
  28. Been using TOR for years and another alternative I know is Proxy Lion

    ReplyDelete
  29. "Freedom of expression and speech is your fundamental right"

    "This comment has been removed by a blog administrator"

    So maybe not

    ReplyDelete
    Replies
    1. I approve all comments whether or not I agree with them -- except for the ones posted by bots which are basically gibberish spam linking back to some random website.

      Delete
  30. Why people only mention Tor when it comes to VPNs? There are a lot of VPN services on Web, also Tor proxies are old and overused. You will still get restrictions because many of their IPs are already blacklisted. I use HIDE-MY-IP and I think it's the best service out there, and I've tried many...

    ReplyDelete
  31. root@kali:~# apt-get install vidalia polipo
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package vidalia
    E: Unable to locate package polipo

    ReplyDelete
  32. How hard is it to track someone/find their ACTUAL ip while they're using privoxy?

    ReplyDelete