code

Monday, August 31, 2020

How to get a free anonymous proxy connection using Raspberry PI





* The following guide doesn't take into consideration the legality of the process described. Do not use this in real scenarios if you don't know if and when it's legal in your country.

** I can only assume the following method is probably already used in the wild today by legitimate users as well as cyber adversaries in order to maintain anonymity and evade detection.I don't remember reading about this specific method though and it sounded like a fun project to do on my new Raspberry PI, so I decided to test it on my own.

 

My idea is pretty simple, there's WIFI everywhere around us right? some of these WIFI networks are even free or password protected with easy ways to retrieve the passphrase (yes I'm talking to you public WIFI networks on hotels, airports (just kidding is Covid-19 time right now :), restaurants, coffee shops and the list goes on). Most of the times, the password is even printed in a visible way like on menus, cards or signs. Even if it's not, usually all you need to do in order to get it is to ask nicely and smile (remember always smile :)

So, can we use these networks in order to have a free anonymous connection from anywhere in the world? probably. Here's how: 

Step 1: get yourself a Raspberry Pi (I went for the Pi Zero W because it's smaller and stealthier). You can probably do it with any other portable SoC (System on a Chip) with WIFI support.

Step 2: after you installed Raspberry Pi OS  (Raspbian) on your Pi, go to Ngrok and register a new account (it's free!). 

If you don't know Ngrok - it's a really cool tool that essentially lets you tunnel a process connection through the internet. This way you can connect to a listening process on a remote device even if you don't have any incoming open ports on it (for example, you can use it if you want to test a web server hosted on your PC from the internet, without forwarding any ports on your home router or firewall). 

We're gonna use Ngrok to run a SSH server which will be used as our proxy server (you can also use it as a SOCKS proxy server, and then configure it on your web browser's network settings to get anonymous web browsing, but it won't be covered on this guide. Search the "-D" option on ssh client if you're interested to learn more).

After you successfully downloaded and configured Ngrok with your token, run the following:

"nohup ./ngrok tcp 22 & "

   nohup -  makes sure your ngrok session won't be killed when you logoff

 ngrok tcp 22 - opens a tunnel to tcp port 22 (this is the default ssh port, if it's different on your Pi, change the port number to the appropriate one. Make sure OpenSSH is up and running before you continue)

& - run the ngrok process in the background

Step 3: after you made sure your ngrok process is running, you can use your PC, launch a terminal and run:

" ssh  myuser@2.tcp.ngrok.io -p port_number"

ssh - your ssh client (it's installed by default on most operating systems, Windows 10 has it too by default)

myuser - this is the Raspberry Pi username - if you installed the OS without making critical changes, the default username is "pi"

 2.tcp.ngrok.io - this is the URL ngrok assigned to you, you get it from the ngrok dashboard under "Tunnels"

-p port_number - this will be the port number ngrok assigned to your session, will appear in the same place as the above


If all went successful you will be prompted to enter your Pi's password (you should change your default Pi password to a complex one! better yet use a key instead).

Congratz! you now have an anonymous connection to a remote proxy server. You can check if your IP really changed by comparing your PC IP to the output of the following command from your Pi:

" curl 'https://api.ipify.org' "

 Cool ! :) 


Check out this post from a Reddit user, where he finds a lot of these Pis hidden in his college, this surely demonstrate how easy is to hide them.


*** Unless you can find a power output no one is using which is also close enough to the WIFI reception range (you REALLY shouldn't do that :P !) , you'll probably need your own mobile power supply. This can be easily achieved with a battery connected to your Pi's GPIO or a power bank connected to the Pi's micro USB 5V input.

Mastering Problem-Solving and Cultivating a Research Mindset in the ChatGPT Era (and why you still need to RTFM)

  In this post I'll present a technical problem (some will say it's probably a bug more than it is a feature) I had with a VR app, h...