Fun with my RaspberryPI

Hello folks,

today I would like to share some fun stuff I did with my RaspberryPI. Two things I had in mind:

  1. I wanna have my RPi WiFi
  2. I would like to run aircrack-ng on it.

Ok easy things first: getting WiFi working with the RPi. I have a USB WiFi Adataper from ALFA (AWUS036H) which is pretty awesome for WiFi mischief 😛

Since I haven’t used my RPi, I first did a update and upgrade of the installed Raspberian OS system, to get the latest version.

sudo apt-get update
sudo apt-get upgrade

Then I started with installation of the wireless toolkit iw:

sudo apt-get install iw

I plugged in the WiFi USB adapter and did a ifconfig. I saw, that I already got an interface wlan0 😀 Having iw already installed, I checked the available WiFis with

iw wlan0 scan | grep SSID

and got a list of all available WiFi network within reach. In case you run a open network, or have access to one, you now can proceed with

iwconfig wlan0 essid yournetworkname
dhclient wlan0

By that, you set the SSID used by the adapter to the one of your WiFi hotspot and start the DHCP client to get an IP address. This should probably work and you are now connected.

In case you run your WiFi protected by WPA2 a little more work is necessary: you need to have wpa_supplicant on your system. If you have not yet, find it with apt and install it:

sudo apt-cache search wpa

gets you a list of all software releated to wpa. The last entry should be “wpasupplicant”, and install it with

sudo apt-get install wpasupplicant

Ok, now you need a config file, which specifies the network parameter for your WiFi hotspot you wanna use. Create a file “wpa_supplicant.conf” and provide these information:

cd /etc/
vim wpa_supplicant.conf

 

# allow frontend (e.g., wpa_cli) to be used by all users in 'pi' group
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=pi
#
# home network; allow all valid ciphers
network={
ssid="yourNetworkSSID"
scan_ssid=1
key_mgmt=WPA-PSK
psk="YourSecretPasswortHere"
}

For more examples please visit this page: http://linux.die.net/man/5/wpa_supplicant.conf

Now you are nearly done and ready for a first test run. Start wpa_supplicant in debug mode to test whether a connection can be established:

wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf -d

If that is successfull, you can cancel it by pressing Ctrl-C and start the wpa_supplicant in background:

wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf -B

You can check if the connection was successfull established with

wpa_cli status

In order to get an IP address for the new wlan0 interface, you have to start the DHCP client:

dhclient wlan0

after some time you new interface should list also an IP address when you do “ifconfig”.

In case your wlan0 should be automatically setup and running after your reboot your RPi, you have to change /etc/network/interfaces and add the lines for wlan0 and the entry in the first line for auto:

auto lo wlan0 eth0

iface lo inet loopback
iface eth0 inet dhcp
iface wlan0 inet dhcp
  wpa-ssid YourSSIDHere
  wpa-psk YourSecretKeyHere

please be aware you have to intend the two lines with wpa.

Installing aircrack-ng on RPi

First I tried it with the normal version of aircrack-ng from the webpage (http://www.aircrack-ng.org/doku.php?id=install_aircrack) but got an error while compiling. Then I found this discussion:
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=9&t=4792

A user suggested the installation of aircrack-ng via the svn repository sources:

apt-get install subversion
svn co http://trac.aircrack-ng.org/svn/trunk aircrack-ng
cd aircrack-ng
make
make install
airodump-ng-oui-update

and that also worked for me 😀 Next I have to do some checks with that installation and will report if I found more fun stuff. I hope you learned sth. Check back for more 😀

Cheers

norbert

Advertisements

2 thoughts on “Fun with my RaspberryPI

  1. Thank you ! I was able to get wifi working with the commands:
    iwconfig wlan0 essid yournetworkname
    dhclient wlan0

    …but have to do it after each startup….tried putting the commands in the Interfaces file but that didn’t work (I prefer to not use wpa for my application)

    …would appreciate any ideas on how I can automate the two commands for boot up.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s