Open WiFi Finder

Open WiFi Finder

Get some super powers and detect open WiFi networks around you!

Summary

Sometimes, it’s nice to feel like a Hollywood hacker and flex your superpowers! With this project, we will see how to detect if there’s a non-secure wifi around us. This is also handy when you travel and don’t have your usual places to connect to the Internet. You could be walking down the street until the GrovePi+ finds a coffee place or a restaurant that offers free WiFi. This is often referred to as ‘wardriving

With Great Powers Comes Great Responsibility

Knowing where there are open wifi networks is fine. Using those open networks for your own needs is most likely NOT fine, and may even be illegal. Better safe than sorry. Gain the knowledge but don’t use it unless given explicit permission by the wifi owner.

What you'll need for this project:

  1. a Raspberry Pi (and the usual:
    1. SD card,
    2. power supply,
    3. wifi dongle)
  2. a GrovePi+ board
  3. a GrovePi+ compatible LED
  4. a GrovePi+ compatible buzzer
  5. a GrovePi+ compatible LCD RGB screen

Or you could all this by getting the Starter Kit or, if you already have a Raspberry Pi, you could get the Base Kit

Recommended:

  1. a cell phone charger for stealth mode

Step 0: Starting Point

We are going to assume that your GrovePi is already set up and going. If it is not the case, please follow the steps outlined in our Get Started with the Grovepi Tutorial

Go through the first four points at the very least.

  1.  Connect the GrovePi to the Raspberry Pi
  2.  Setup the Software
  3. Connect your computer to the GrovePi
  4. Update & Test the GrovePi

You may want to go through the basic examples available on the same page, just to make yourself familiar with the GrovePi+.

Step 1: Hardware Assembly

With the Raspberry Pi and GrovePi+ already assembled, the SD card and WiFi dongle in place:

  1. plug the LED into port D3
  2. plug the buzzer into port D2
  3. plug the LCD screen into port I2C-1
  4. plug the WiFi dongle into one of the USB ports (not seen in the picture)
  5. if you have a GrovePi+ protective case, please use it, as this project is meant to be taken outside.

Step 3: Software Side of Things

If you’re running the latest Raspbian for Robots, the code for this project should already be on your SD card. You will find it in the GrovePi folder on the Desktop, then Projects, then Open_Wifi_Finder.  The full path is as follows:

/home/pi/Desktop/GrovePi/Projects/Open_Wifi_Finder/wifi_finder.py

Note that you do not need to navigate to the Open_Wifi_Folder via the desktop interface, as the program needs to be launched from a command prompt anyway. This step is only to see if you have the code already, or if you wish to see what the code does.

Step 5: Getting WiFi Powers

Wifi detection needs another library that is not currently on your SD card. A library is a file that contains a lot of functionality, and we need one that can handle some wifi detection for us.

Start up a terminal window, and let’s get those new powers by typing the following

sudo pip install wifi

Raspbian will then pull in the appropriate piece of software for us.

Step 6: Launching our New Powers

First we need to launch a terminal. If you’re using SSH to control your Pi, you’re already using the equivalent of a terminal. If you’re using the Desktop, or VNC, then you have to double click the Terminal icon.

You then have to go to where the code is kept, by using the cd command (for change directory, the old way of saying change folder) followed by the path to the code

cd /home/pi/Desktop/GrovePi/Projects/Open_Wifi_Finder

Capital letters are important. Pro tip: after each ‘/’, you can type the first two letters then the TAB key. Raspbian will autocomplete the name for you, if there’s no conflict.

Then launch the code by entering

sudo python wifi_finder.py

If there’s an open wifi nearby, you will be alerted promptly!

Step 7: Taking our project on the road

If we want to take our project outside where we can get the info from stores or neighbors, we have one extra step to do. After all, we don’t want to bring a screen and a keyboard to launch the software! So let’s make it that it runs right away when the Pi boots up.  This way, we only need to power up the Pi/GrovePi with a cell phone charger, and everything will work on its own.

There are many approaches to making something start at boot time, but here’s one of them.

  1. Copy the files into your home directory. That way, we will save the original files, and will simplify our paths.cp /home/pi/Desktop/GrovePi/Projects/Open_Wifi_Finder/wifi_finder.py ~/.
  2. let’s create a start file
    nano start.sh
    The contents of start.sh will be#!/bin/bash
    sudo python /home/pi/wifi_finder.py
    Type Ctrl-X to exit, followed by ‘y’ and the enter key
    Start script for Open Wifi Finder
  3. Now we need to edit rc.local which Raspbian Wheezy uses to know which programs need to start at boot.sudo nano /etc/rc.localScroll down to the end of the file, and add the following lines right at the bottomsudo sh /home/pi/start.sh
    exit 0
    If the exit 0 line is already there, do not add another one.
    Autoboot for Open WIfi Finder

That’s it! Reboot and test!

To reboot, you can type the following in a terminal window:
sudo reboot

How to get the code for this project:

The easiest way to get the code is to update your Dexter Industries software through the “DI Software Update”. When you do this, all of the code files for new projects like this will show up!

File Path

When you run the DI Software Update, this project will be automatically downloaded onto your SD card and can be found in this location:

Starting from the Desktop, navigate to GrovePi/Projects/Open_Wifi_Finder

From a command line, navigate to /home/pi/Desktop/GrovePi/Projects/Open_Wifi_Finder

Downloadable File:

You can get the file from Github, by entering the following in a Terminal window

sudo wget https://raw.githubusercontent.com/DexterInd/GrovePi/master/Projects/Open_Wifi_Finder/wifi_finder.py

How to get the code for this project:

If you are not using the Dexter Industries custom software, Raspbian for Robots, and you still want to download this file, you can download it here.

Need help?

Have a question or a problem?  Post it on the forums and we’ll help you out.