Sometimes, live sucks / Somebody with a Nu-Thera in ?

A friend has autist child, and she came a my house last week asking me if I can help her. She want me to buy over the net a B6 vitamin call Nu-Thera. This can sound really strange isn’t it ? Why should use internet to buy this kind of vitamin ?

In fact there is many reasons:

  • The doctor doesn’t seems to know, this stuff. Ok but most of autism forum I found on the net, say that this kind of medecin can provide a huge benefit for this. Look at here
  • There is no distributor in France.. That’s bull-shit !!

So, I decide to buy a 30 day treatment at Kirkmanlabs, everything is ok, I received a recipe. But 1 day after, they send me a email, complaining the credit card number is wrong, and ask me to contact them at the office. Ok fine, but I’m living in France ! I sent 2 emails without any answer.

Today:

  • I hate automated email server
  • I hate credit card
  • Why I didn’t check this fucking stuff twice !!

Kismet + GPSDrive + MySQL + Python = Google Earth Wlan Map

Last week I decided to build a map of the wireless access point in the Town. It is not really easy to find the right tools, so I decided to write this little Howto.

To archive this goal you need severals tools:

Kismet

First install Kismet. You need a wireless card that support RFMon in monitor mode. I think Madwifi cards, and patched Orinoco are the only ones that support this.

Launch Kismet, and now check for a given AP that kismet know the best level..

If everything is ok, edit the kismet config file and set gps=try

GPSDrive

Download and install the latest CVS version of GPSDrive (I have some issues with the latest tgz and kismet). The next step is to have a GPS working with gpsd. Most GPS will work, I bought a cheap one with a USB cord on ebay.

Simply launch gpsd, and after gpsdrive. You should see the reception level in GPSDrive.

MySQL

To use Kismet + GPSDrive, you need to have a MySQL database. In fact GPSDrive will ask to kismet the new APs, and dump this informations in a MySQL db. You can find the create.sql in GPSDrive sources.

mysql -u root -p < ./create.sql

This will add a user : gast / gast

First try

Ok, now launch GPSDrive and set the ‘use SQL’ (or edit the config file), and quit.

Now to start the whole stuff:

  • Plug the wireless antenna (this is better for wardriving ;)
  • Plug the GPS
  • Launch gpsd (be carefull to have enought satellite in view)
  • Launch Kismet (it should tell you, it find the GPS…)
  • Launch GPSDrive (it should display a little kismet logo on bottom)
  • Now, you’re ready to go, walk down the street you should see new APs on the GPSDrive map.
http://www.brest-wireless.net/albums/Misc/full_gpsdrive.sized.jpg

After the trip: Google Earth

Ok, now you have a lot of points in your database.. And GPSDrive have a little troubles to display them.. After a little time, i decided to install Google Earth, and look at the way to add new points on the map..

This, is quite simple, all i need to do is to extract data form the SQL, and build a xml file that contain all the points. I decided to write gpsdriveToGoogleEarth.py. This quick and dirty script will generate a file ‘ap.kml’. Now simply launch Google Earth and open this file. You will see something like this:

http://www.brest-wireless.net/albums/Misc/google_earth.sized.jpg

The main issue for me, is that Google Earth doesn’t support Linux right now so I need to dual-boot.. But this provide a easy way to build the card without too much pain. And i can share the Google Earth file others guys simply.

WARNING

I do this only for the fun, so don’t try to hack wireless access point using this howto, this is not the goal !

– Enjoy

Howto to patch a wireless card to add a connector

I spend a little time to write an article on the Brest Wireless website about various hack to add a connector to a PCMCIA, or USB card.

You can find it out here

a PCMCIA:

http://www.brest-wireless.net/albums/AntenneDivers/dsc01302.sized.jpg

a USB one:

http://www.brest-wireless.net/albums/AntenneDivers/dsc01383.sized.jpg

– Enjoy :)

Jamendo: Free Music download

If you’re looking for some good music in your RSS newsreader, I guess you should look here :)

http://www.jamendo.com/img/logo-en-mauriz02.png

Some french groups are really kool.

AMOS wifi homemade antenna

This is perhaps one of my best homemade antenna.

http://www.brest-wireless.net/albums/AntenneAmos/amos05.sized.jpg
http://www.brest-wireless.net/albums/AntenneAmos/amos06.sized.jpg

I found the original design here: http://yu1aw.ba-karlsruhe.de/Amos.pdf

You can find my construction guide on Brest Wireless website at
http://www.brest-wireless.net/wiki/materiel:amos

My conclusion:

First:

  • Take care of this antenna, I broke the first balun while testing :(
  • and the balun is the hardest part to do

Tests :

  • 13db of gain
  • and a really big beam 120° !
  • the “hot spot” of this antenna is in the middle instead what we usually see in
    omnidirectionnal. So the best height for this antenna is the same as computer.
    And this is a good news.

I usually use a biquad antenna inside my appartement, because my AP is in one corner. Biquad (or patch) offer a performance boost compare to a omnidirectionnal antenna (tested with a 8db doradus). This is mainly due to the reflections with the walls of the room inducted by the omni.

But I need to say that AMOS antenna beat all antennas I tested before in this indoor conditions. It has a larger beam (120°) and a strong front / rear insolation.

The AMOS antenna offer the best parts of the pach / quad and omnidirectionnal antennas for indoor. But take care that vertical angle is not really large so it will perhaps not work for a entire flat :).

Hacking your window manager with Python

I was looking for a way to hack my window manager in Python. I want to use special piece of code to handle the window placement, or display stuffs in the background..

It looks like pyxfce meet my needs, so I decided to give it a try. The first thing to do is to build the latest svn of xfce. Next step play with the python wrapper.

Update: You don’t need the latest version (svn) of xfce. pyxfce works w/ xfce 4.2.1. The debian package is broken, as rely on a old libxfcegui (4.1)

Update 2: Debian package is fixed right now :)

Here is a little example of what you can do without too much pain. This script wait for every new window, and stack it on the same workspace as previous other windows of the same app. For example, the emacs windows is launched of the workspace ’4′, all other emacs windows will be displayed on this workspace.

import sys
import xfce4
import gtk

black_list = ['xfrun4','Terminal']

def newWinHandler(screen,win):
    name =  win.get_resource_name()
    if name not in black_list:
       for w in screen.get_windows():
           if w != win and w.get_resource_name() == name:
              dest = w.get_workspace()
              win.move_to_workspace( dest )
              break

screen = xfce4.netk.screen_get_default()
screen.connect("window-opened",newWinHandler)
gtk.main()

The major issue of pyxfce is the lack of documentation, you can do a lot of stuffs with it like creating custom xfce applications, but i didn’t find anything about this.

Send hand-crafted Ethernet Frames in Python (ARP for example)

Tonight I decided to send ARP flood over the wireless link to find who is using it. This is a strange thing .. ok but it works pretty fine and quickly ..

First step is to build the custom packet.. I tested several suffs and i decided to keep the dpkt package. It support a large subset of packets and is easy to use. (Nobody for a MSN parser ?:)

The next step is to send and wait for answers. This has been a bit harder, meanly because I spent a long time looking how to send Ethernet Frames (not IP packets).
In other words, how RAW sockets works in python.

Here a small answer.

soc = socket.socket(socket.PF_PACKET, socket.SOCK_RAW) #create the raw-socket
soc.bind(("ath0",0x0806)) # ether type for ARP

soc.send(handly_crafted_packet)
data = soc.receive(1024)
...

If you want a full example, checkout the arp-flood script I wrote.

from Patents import blocker

try:
    myApp.run()
except (Patents.Violations,pat_id):
    mail.send("patents@eu.eu","The patent ID:%s in software: %s" % (pat_id,myApp.signature) )



STOP Software Patents

Extract GPS from Kismet log with ElementTree

I have read a lot of noise about ElementTree but never really used it. Tonight i need to extract a bunch of GPS data from a kismet log file. Let’s give it a try

from elementtree import ElementTree

data = open('Kismet-May-22-2005-4.xml','r').read()

detection = ElementTree.XML(data)

for node in detection.getchildren():
try:
print "SSID: " + node.find('SSID').text,
except AttributeError:pass  #hidden SSID
print "BSSID: " +  node.find('BSSID').text,
gps = node.find('gps-info')
print "Lon: " + gps.find('max-lon').text +  " Lat: "  + gps.find('max-lat').text

Really simple, and seems to offer really good speed. I now have another weapon for every day work.

Arpwatch on WRT54G

While running my access point in public mode, i want to know when people log in. This can be a good way to find intruders too, but not my purpose.
I decided to run arpwatch on my linksys access point, but this is not so easy ..

1) Mail

First you need to have sendmail on the WRT. So install mini_sendmail. Add a file /usr/sbin/sendmail that contains:

#!/bin/sh
/usr/sbin/mini_sendmail -t -sIP_of_your_mail_relay

Check that it ‘s working..

2) Arpwatch

Run arpwatch on the WRT throught this script:

#!/bin/sh
IFNAME=$(nvram get wifi_ifname)

case $1 in
start)
touch /tmp/arpwatch.dat
arpwatch -f /tmp/arpwatch.dat -i $IFNAME
;;
stop)
killall arpwatch
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac

exit $?

3) Check

Wait a bit, connect to your wifi, look at your email on the gateway. (root@gw) you will see something like this:

From: root@openwrt.local.net
Subject: new station

hostname: <unknown>
ip address: 192.168.2.1
ethernet address: 0:f:66:c7:b5:b1
ethernet vendor: <unknown>
timestamp: Tuesday, January 18, 2000 14:34:01 +0000

Enjoy :)