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.

Apr 7, 2015

Configuration for passive Wi-Fi

Gateway node for smart tracking

File 8 4 15 2 14 32 am Configurations for gateway node:

1) configure Wi-Fi username and password:

sudo vi /etc/wpa_supplicant/wpa_supplicant.conf

2) update server address:

cd ~/Desktop/data_gather

sudo vi probe_request_gather.py

Then, modify "SERVER_ADDRESS"

Feb 2, 2015

Dia cannot be run on Yosemite

After I upgrade my Mac OS to Yosemite, Dia can not run. From a developer forum, I see the solution.

Run this command in X11 to run Dia from command line:

DISPLAY=:0 /Applications/Dia.app/Contents/Resources/bin/dia

Nov 10, 2014

A test for my Arduino working with NRF24L01+PA transceiver

There are two computers, one is called Joker and the other is called Batman. They use Morse code to communicate. The microcontroller is Arduino and the wireless transceiver is NRF24L01+PA. I find that sometimes it works fine especially at night when few people are in the lab, but sometimes transmission failed (both of them can not talk to each other or just one-way communication works). Not sure if the reason is the interference from wifi.

Sep 29, 2014

A simple office desk safety alarm system

Something you need: 1 arduino microcontroller, 1 breadboard, 1 LED, 1 PIR sensor and some wires.