From charlesreid1

Line 64: Line 64:
...that's it for now, folks. KISS.
...that's it for now, folks. KISS.


===Script===
===Boot Script (Problems)===


Add the location of the following script to the contents of the file <code>/etc/rc.local</code>:
Add the location of the following script to the contents of the file <code>/etc/rc.local</code>:
Line 84: Line 84:


Remember to <code>chmod +x</code> and put it somewhere like <code>~/scripts</code>.
Remember to <code>chmod +x</code> and put it somewhere like <code>~/scripts</code>.
'''NOPE.'''
This script was breaking when the besside-ng command was run. The wlan0 device would be in monitor mode, and the directories created in the script would exist, but the besside process was not running. When I tried running the script, I had about a 50% success rate, and the other 50% of the time I saw this error:
<pre>
root@pi$ ./doit.sh
Current MAC:  d6:6f:a6:84:02:8d (unknown)
Permanent MAC: 7c:dd:90:8f:ca:8c (Shenzhen Ogemray Technology Co., Ltd.)
New MAC:      d2:19:29:cd:66:6c (unknown)
Interface wlan1:
ioctl(SIOCGIFINDEX) failed: No such device
besside-ng: wi_open(): No such device
</pre>
<pre>
root@pi$ ./doit.sh
Current MAC:  d2:19:29:cd:66:6c (unknown)
Permanent MAC: 7c:dd:90:8f:ca:8c (Shenzhen Ogemray Technology Co., Ltd.)
New MAC:      de:ea:53:78:a1:71 (unknown)
Interface wlan1:
ioctl(SIOCGIFINDEX) failed: No such device
besside-ng: wi_open(): No such device
</pre>


===Reboot to Test===
===Reboot to Test===

Revision as of 17:12, 20 August 2016

Outfitting a Snailcase with wifi gear and a Raspberry Pi.

The intention here is to create a platform that's more sophisticated than just running Kismet on the phone and seeing what wifi networks are in what location. The intention here is to create a more robust data-gathering platform that can be outfitted with more sensors: larger wifi antennas, spectrum analyzers, drives, batteries, etc.

The Setup: Prototype 1

To set up the wifi snailcase for prototype 1, my plans were to implement the following (very simple) gear setup:

  • Raspberry Pi with USB wifi antenna
  • Portable battery pack to power the Raspberry Pi

These were mounted inside of a Pelican case. The intention was to run a wifi monitoring program - replicating a simple setup like Kismet. Remember, for the first phase, the motto is always KISS.

Raspberry Pi Preparation

I utilized an older Raspberry Pi model B+ that I had for this project. Here is the rundown of commands I used and steps I took to prepare the Pi for this project.

Installing Raspbian OS

First, I did not want to use the Kali Raspberry Pi image, as it has a long history of weird issues that take hours to troubleshoot. I went with Raspbian.

Insert the SD card, use diskutil or fdisk to find it, and overwrite the disk with the image file using dd (careful! don't just copy and paste!):

sudo dd bs=1m if=2016-05-27-raspbian-jessie.img of=/dev/disk1

That'll take about 45 minutes. Once that's finished, you can keep the SD card inserted in your laptop, and modify the boot partition, specifically the file cmdline.txt, and add the following text to the end: ip=169.254.247.111 (the last two numbers are completely arbitrary). This will hard-code the Pi's IP address, and will allow you to directly plug your laptop into the Pi to SSH in (using a crossover cable, which is just a normal networking cable) to make sure everything is working, and configure the Wifi.

Once that's finished, SSH in:

$ ssh pi@169.254.247.111

Follow the steps on the Linux/Wireless page (modifying /etc/wpa_supplicant/wpa_supplicant.conf and /etc/network/interfaces) to hard-code wifi credentials into the Pi and allow it to connect to wifi.

Now your Raspberry Pi is ready to connect itself to wifi when it is turned on.

Insert a wifi adapter into the Pi, turn everything off, and turn everything back on. The Pi should not need the crossover cable anymore. Wait for it to join the network. Use nmap to find it if you need to.

Prepare OS

Once you can connect to the Pi over the local network, check it is connected to the internet:

$ ping linux.org

Follow the steps on the Raspberry Pi post-install page: Kali_Raspberry_Pi/Post-Install

$ sudo apt-get -y update
$ sudo apt-get -y dist-upgrade

Pack a lunch. It'll take a while.

Install Software

Now, to install the software we need. Here's a list:

  • Macchanger: apt-get install macchanger
  • Aircrack: apt-get install aircrack-ng

...that's it for now, folks. KISS.

Boot Script (Problems)

Add the location of the following script to the contents of the file /etc/rc.local:

#!/bin/sh

ifconfig wlan0 down
iwconfig wlan0 mode monitor
macchanger -r wlan0
ifconfig wlan0 up

sleep 5s

mkdir -p ~/box/08-19_besside/
cd ~/box/08-19_besside/
besside-ng -W wlan1

Remember to chmod +x and put it somewhere like ~/scripts.

NOPE.

This script was breaking when the besside-ng command was run. The wlan0 device would be in monitor mode, and the directories created in the script would exist, but the besside process was not running. When I tried running the script, I had about a 50% success rate, and the other 50% of the time I saw this error:

root@pi$ ./doit.sh
Current MAC:   d6:6f:a6:84:02:8d (unknown)
Permanent MAC: 7c:dd:90:8f:ca:8c (Shenzhen Ogemray Technology Co., Ltd.)
New MAC:       d2:19:29:cd:66:6c (unknown)
Interface wlan1:
ioctl(SIOCGIFINDEX) failed: No such device
besside-ng: wi_open(): No such device
root@pi$ ./doit.sh
Current MAC:   d2:19:29:cd:66:6c (unknown)
Permanent MAC: 7c:dd:90:8f:ca:8c (Shenzhen Ogemray Technology Co., Ltd.)
New MAC:       de:ea:53:78:a1:71 (unknown)
Interface wlan1:
ioctl(SIOCGIFINDEX) failed: No such device
besside-ng: wi_open(): No such device

Reboot to Test

Now you can reboot to test it out. You should see wlan0 in monitor mode, and if you run ps aux | grep besside you should see the process running.

Flags