RFID is good for me ?

Ok, everybody know that RFID is the latest hype stuff. While looking for french studies on this, I discover this

Yes, they will pay 380 000 Euro to put RFID in 95 000 Paris’ trees ! While a lot of poeple have some really bad life condition. I’m wondering what we can do with this money instead of paying 4 Euro per tree for this stuff.

This is a pretty weird world we are living in ..

Howto to Talk with GoogleTalk in Python

I guess everybody know GoogleTalk right now. Linux users like me knows that it ‘s only a Jabber server with SIP extension. Like a lot of people seems to use this, I decided to switch from MSN(suxTm) to this Jabber server, beside it lacks a lot of Jabber features (like offline messaging )

But, how can I send a message to my Gmail Talk in less 10 lines of code. I decided to look at xmpppy .. Ok I get a strange issue w/ secure login ..

As I already use gajim, I decided to look at this code.. Hum, look strange it has the same xmpp module, with the same API, but this one is working.

import xmpp

login = 'Your.Login' # @gmail.com
pwd   = 'YourPassword'

cnx = xmpp.Client('gmail.com')
cnx.connect( server=('talk.google.com',5223) )

cnx.auth(login,pwd, 'botty')

cnx.send( xmpp.Message( "YourFriend@gmail.com" ,"Hello World form Python" ) )

As you can see this is small and simple :) The only issue is to find the right module, and hope the xmpppy will fix that soon.

(In fact gajim team seems to fork the xmpp code due to lack of support. This bug already exists in the xmpppy bug list )

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

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.