DEV Community

Cover image for Anonymise yourself! How to set up tor in mac? In the terminal - noob_sec series
ProCode
ProCode

Posted on

Anonymise yourself! How to set up tor in mac? In the terminal - noob_sec series

Hey all! Let me ask you a question. If I said to you I have a proxy server and if you pass your traffic through my servers I will keep your browser data encrypted and hide your IP and I will keep a record of your traffic. That is in layman's terms, I won't let anyone know what are you doing on the internet, only I will know. Would you trust me and accept my offer?

Or If my friend, lets call him John has another service. A decentralised peer to peer network where no such organisation/company keeps logs of your traffic and pretty much does the same thing. Helps you hide your IP and stuff.

Which service would you choose? mine or Johns? Let me guess, John's right? See! I'm already in your brain! But there's a caveat to John's service. They are a bit slow and the setup process is a bit of an hassle. That's why people still choose my service over John's. Because with my service, with 1 click you can be anywhere in the world, encrypt your browser history all that good stuff.

Well, maybe you have already figured out what are the two services I am talking about in the previous example. But if not, let me do the honours, They are VPNs(my service) and tor(John's service). Now, I am not encouraging or discouraging you to use one or the other services in question here. That's totally your choice. This article is just an introduction to tor and how you can get sneak peek of tor's powers. Keep in mind this will not be a complete setup with proxychains and stuff, just how to install mac and pass your traffic through tor so your IP is hidden. You can follow this tutorial if you don't have a mac as well. You'll just have to know how to install stuff from your package registry and how to add a proxy in your system.

Generally you can install tor browser and use that to get all the features of tor. But I want to pass all traffic of my system through tor and not only the requests that are made from the tor browser. For example, requests from the terminal as well.

Installation

I will be using Homebrew to install tor. if you do not have brew installed. Download it from here or run this command in your terminal.



/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"


Enter fullscreen mode Exit fullscreen mode

Now that we have brew, we can go ahead and install tor.
Run this command to install tor.



brew install tor


Enter fullscreen mode Exit fullscreen mode

After the command has finished running, we should have tor installed in our system. Lets start the tor service now.
Run this command to start tor.



brew services start tor


Enter fullscreen mode Exit fullscreen mode

If it ran successfully you should see and output like this:



==> Successfully started `tor` (label: homebrew.mxcl.tor)


Enter fullscreen mode Exit fullscreen mode

Now let's verify if tor proxy is running or not. It by default runs on localhost:9050 so let's use netstat to verify that.



netstat -ant | grep 9050


Enter fullscreen mode Exit fullscreen mode

If you see something similar to this, all good!



tcp4       0      0  127.0.0.1.9050         *.*        LISTEN


Enter fullscreen mode Exit fullscreen mode

Now all we have to do is pass our traffic through this proxy. We'll see that in a moment but before that let's see what our IP address is right now. Google what is my ip or click in this link to do the same. Now lets pass our traffic through tor's proxy to see if our IP changes.

In your mac, open system preferences.
System preferences

Then click on Network,
Network

Then click on advanced, (also do that click on the lock and enter password thing if you have to.
advanced ?

Then click on the proxies tab,
Proxies

Choose the SOCKS proxy from the check list and on the right side, enter localhost - 127.0.0.1 on the first input box and 9050 in the second which is for the port. Then click on Ok and then Apply.
SOCKS Proxy

AND we are done! Now if you Google what is my ip or click in this link to do the same! Did you see it? Because I did! That shows a different IP!

As I said in the beginning, tor is a bit slow for normal browsing, why? That might be a topic for another article but now the question is are you willing to use tor for normal browsing even if it's slow? No right? Yeah me too. But after watching that crazy youtube conspiracy video of governments spying on people, when your paranoia hits, you can just turn on tor! or maybe for other stuff. Don't use it for bad practices obviously, you'll be an idiot if you do so.

Let me get you started with this paranoia thing a little bit so you can use tor right away 😂. Sure VPNs hide your IP, encrypt your browser history and stuff. But they do have log of all your browsing data. Why do you think they keep that? Why do you think VPNs were invented on the first place? hmm........

See you on another article!

Top comments (0)