Tcpdump rules !

Tcpdump is clearly one of my favorite tool. Here a little example to filter the traffic of my OSPF router.

tcpdump -i eth0 ip[9] == 89

And the result:

12:43:48.219432 IP p2b.soif.fr > OSPF-ALL.MCAST.NET: OSPFv2, Hello (1), length: 48
12:43:48.560817 IP wrt.soif.fr > OSPF-ALL.MCAST.NET: OSPFv2, Hello (1), length: 48

Wonderfull no ? :)

Homemade Wifi Antenna ?

I never do that before, but some guys give me this really fancy antenna.

http://www.brest-wireless.net/albums/AntenneCornet/cornet_usam_1.sized.jpg
http://www.brest-wireless.net/albums/AntenneCornet/cornet_usam_2.sized.jpg

Check out Brest Wireless photo album for more infos

Update: I tested this last night. In fact the gain of this beautifull antenna
is around 17dB. Yes ! 17dB for a homemade antenna is pretty high, no ? I really like this stuff

Update 2: Please check other post for additionnal infos about homemade antennas

– Enjoy wireless at home ;)

Glade-2 to .py

In a past life, I spent a lot of time with gtk-1 and glade (for a commercial app). After this experience, I tested several approach:

  • PyQT (using QTDesigner)
  • wxPython (w/ wxGlade)
  • Glade 2 + libglade

Here is my personnal feeling:

  • PyQT, is really great. But I really don’t like the licence. And since I work in a school, using this kind of licence with students is bad idea
  • wxPython + wxGlade is a great tool too. But but as usuall w/ wxPython the generated code isn’t cross-platform friendly. (And on Linux, the look is really bad ..)
  • Glade is a simple, and effective, but using libglade (loading the .glade at startup) isn’t really my favorite approach.

In my past life, we used to build IHM w/ glade-1 and produce the python code from a little script. This is easy and efficient. (and a newbie can learn python-gtk easily). I have been looking for the same stuff in gtk2 for a while. And last day, I found the article Writing PyGTK applications in a visual way . This is exactly what I’m looking for! So big thanks Tigrux !

Tsunami and Cisco

I have been a long time what a "tsunami" is. After recent news, I guess everybody know what this evil is about.

Do you think Cisco will still use "tsunami" as default for ESSID for their wireless products ? I haven’t a aironet card on my desk right now, but believe me, the default ESSID for access point, and wireless card made by Cisco is: tsunami.

Beside, this sound a pretty good name for a wireless product, I really believe it’s the worst to choose now.

If someone as a aironet card, perhaps he can post the default iwconfig result here.

Extract soundtrack (MP3) from DVD with mplayer

I ‘m wondering if i gonna add a mplayer tips here ? :)

To extract a mp3 from a DVD, the easy way is to use transcode

transcode -i /dev/dvd -x dvd -T 1,2,1 -a 0 -y raw -m track22.mp3

But sometimes, this doesn’t works.. in fact I get a random transcode segfault. As mplayer is the perfect video kniffe. I decided to test this w/ mplayer

mplayer -ao pcm dvd://1 -chapter 22

This won’t build a .mp3 but a big wave file, not matter lame is my friend anyways.

PS: The latest transcode should fix the issue, but I’m unable to build it on my debian. libavcodec2-dev is broken. (Wondering why i’m still using this distro … :(

– thanks #mplayer for the help (as usual)

Keyboard shortcut with Python-Xlib

I use this little script on another computer for a while. Meanly to remote drive my xmms throught the xmms python module. Anyway I just write this little intro here, perhaps other people may be interested..

This litte script use Xlib python module to grab keys. If the key is special key on my laptop, i use it to change the sound level. This is a short example, not a definitive app.

from Xlib.display import Display
from Xlib import X
import oss

# custom keys from my dell D400 Laptop
vol_plus  = 176
vol_moins = 174

keys = [vol_plus,vol_moins]

def changeVolume(aValue):
	mixer = oss.open_mixer()
	symbol = oss.SOUND_DEVICE_LABELS.index('Vol  ')
	left,right  = mixer.read_channel(symbol)

	avg = (left + right) / 2
	if (avg + aValue) >= 0:
		mixer.write_channel(symbol,(left + aValue,right + aValue))
	mixer.close()

def handle_event(aEvent):
	keycode = aEvent.detail
	if aEvent.type == X.KeyPress:
		if keycode == vol_moins:
			changeVolume(-2)
		elif keycode == vol_plus:
			changeVolume(+2)

def main():
	# current display
	disp = Display()
	root = disp.screen().root

	# we tell the X server we want to catch keyPress event
	root.change_attributes(event_mask = X.KeyPressMask)

	for keycode in keys:
		root.grab_key(keycode, X.AnyModifier, 1,X.GrabModeAsync, X.GrabModeAsync)

	while 1:
		event = root.display.next_event()
		handle_event(event)

if __name__ == '__main__':
	main()

As you can see, this is really trivial, and simple to hack XFree w/ python :)
I need to send special thanks to the python-Xlib author, because he does a great job, and he help me a lot the first time I hacked this.