Aug 5, 2015

Use Raspberry Pi to scan smartphones

We use Raspberry Pi to scan the smartphone which enables the Wi-Fi connection. The data is uploaded to the server through ethernet.

1) connect the Pi with an ethernet cable, and set up a cable connection either from direct wired network or network bridge.

2) connect the Pi with a USB Wi-Fi dongle so that it can scan the smartphone.

3) Auto Login Configuration
  • Turn on the Raspberry Pi. For the first time, we need to manually type the username and password. The username is pi, and password is raspberry
  • sudo nano /etc/inittab

  • Find "1:2345:respawn:/sbin/getty 115200 tty1". And comment it by "#1:2345:respawn:/sbin/getty 115200 tty1"

  • Then type "1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1"

  • Ctrl+X to exit, and save the file

4) Running Python script on startup
  • Make a shell script "starter.sh": #!/bin/bash tcpdump -i mon0 -e -l type mgt subtype probe-req | python probe_request_gather.py &

  • chmod 755 starter.sh

  • Create a log directory under HOME: mkdir logs

  • sudo crontab -e

  • Write the line: @reboot sh /home/pi/bbt/launcher.sh >/home/pi/logs/cronlog 2>&1

  • Reboot the Pi to see if it works: sudo reboot

  • The error can be found in the log file: cd logs & cat cronlog

5) Tools installation
  • sudo apt-get update
  • sudo apt-get upgrade

  • sudo apt-get install libssl-dev libnl-3-dev libnl-genl-3-dev build-essential tcpdump iw ntpdate

  • Install aircrack-ng: wget http://download.aircrack-ng.org/aircrack-ng-1.2-beta1.tar.gz
    tar -zxvf aircrack-ng-1.2-beta1.tar.gz
    cd aircrack-ng-1.2-beta1
    sudo make
    sudo make install
    airodump-ng-oui-update

6) Now copy the Python script which is used to scan the smartphones and upload data, and “starter.sh” to a location, e.g., ~/Desktop/data_gather/.

7) Edit “~/.bashrc” to start the python script after startup
sudo /etc/init.d/ntp stop
sudo ntpdate sg.pool.ntp.org
sleep 5
sudo airmon-ng start wlan0
sudo airmon-ng start wlan1
sleep 5
sudo bash /home/pi/Desktop/data_gather/start.sh

8) Add a file “id.txt” in root directory “/” to specify the node ID.