Posted by: peter

Harald Welte, has written on his blog about operating an Open Source GSM network at the recent HAR2009 conference. Photographs and a description and of the setup, run under license of the Dutch regulatory authority, are provided; essentially the setup consisted of a pair of BTS’ (Base Transceiver Stations) running at 100mW transmit power each and tied to a tree. In turn these provided access to the Base Station Controller (BSC), in this case a Linux server in a tent running OpenBSC. The system authenticated users with a token sent via SMS; in total 391 users subscribed to the service and were able to use their phones as if they were on any other network. Independent researchers are increasingly examining GSM networks and equipment, Welte’s work proves that GSM is in the realm of the hackers now and that this realm of mobile networking could be set for a few surprises in the future.

I just discovered Pyrit which takes a step ahead in attacking WPA-PSK and WPA2-PSK, the protocols that protect today’s public WIFI-airspace.

Pyrit‘s implementation allows to create massive databases, pre-computing part of the WPA/WPA2-PSK authentication phase in a space-time-tradeoff. The performance gain for real-world-attacks is in the range of three orders of magnitude which urges for re-consideration of the protocol’s security. Exploiting the computational power of Many-Core- and other platforms through ATI-Stream, Nvidia CUDA, OpenCL and VIA Padlock, it is currently by far the most powerful attack against one of the world’s most used security-protocols.

I continue to be amazed by the widely varied uses that these hardware graphics accelerators can be put to!

Posted by: peter
Today I had to knock up a quick web app to return the newest available file to an http based update client based on various criteria. Now this is a pretty typical scenario which almost any software company has to deal with once they have software deployed in the field that has some type of online update functionality built in so I’m not exactly blazing any trails here and didn’t expect to have any major problems.

However, as any developer knows, there is always something which puts a kink in what should have been a walk in the park. In this case it was the fact that our software versions don’t have a fixed number of digits after each decimal point (Something we have in common with many other projects, including the Linux kernel). This particular kink means that a table full of version numbers will not be returned in the order you expect when you use django‘s ORM order_by() clause (Which relies on the underlying PostgreSQL‘s ORDER BY clause). Given the list ‘1.0.0’, ‘1.0.10’, ‘1.10.0’, ‘1.0.9’ and told to sort in ascending order it will return ‘1.0.0’, ‘1.0.10’, ‘1.0.9’, ‘1.10.0’ instead of the expected ‘1.0.0’, ‘1.0.9’, ‘1.0.10’, ‘1.10.0’.

Python’s sorted() function also has the same problem:


>>> a = [‘1.0.0’, ‘1.0.10’, ‘1.10.0’, ‘1.0.9’]

>>> print sorted(a)
[‘1.0.0’, ‘1.0.10’, ‘1.0.9’, ‘1.10.0’]


This caused me to do quite a bit of digging around on google which pulled up a whole bunch of different ways to do what is apparently called a “natural sort” as apposed to an ascii based sort on a list. In the end I settled on the sort_nicely() function from the article Sorting for Humans : Natural Sort Order only to have it pointed out by some of the guys on #python that it could end up comparing int objects with string objects. Thanks to a little bit of coaching I finally ended up with the following naturallysorted() function which should be a drop in replacement for the python sorted() function:


def naturallysorted(L, reverse=False):
“”” Similar functionality to sorted() except it does a natural text sort
which is what humans expect when they see a filename list.
“””
convert = lambda text: (”, int(text)) if text.isdigit() else (text, 0)
alphanum = lambda key: [ convert(c) for c in re.split(‘([0-9]+)’, key) ]
return sorted(L, key=alphanum, reverse=reverse)


As a comparison here is the same list processed by sorted() and naturallysorted():


>>> a = [‘1.0.0’, ‘1.0.10’, ‘1.10.0’, ‘1.0.9’]

>>> print sorted(a)
[‘1.0.0’, ‘1.0.10’, ‘1.0.9’, ‘1.10.0’]

>>> print sorted(a, reverse=True)
[‘1.10.0’, ‘1.0.9’, ‘1.0.10’, ‘1.0.0’]

>>> print naturallysorted(a)
[‘1.0.0’, ‘1.0.9’, ‘1.0.10’, ‘1.10.0’]

>>> print naturallysorted(a, reverse=True)
[‘1.10.0’, ‘1.0.10’, ‘1.0.9’, ‘1.0.0’]
Posted by: peter
When doing embedded network development, its typical that you have the embedded device you work on connected to one network interface (eth1) while you are simultaneously connected to your corporate or home LAN and the internet via another interface (eth0 or wlan0).

The thing about embedded development is that you spend a lot of time rebooting the embedded device with new firmware which sends your PC’s network interface down and up which triggers a new DHCP request on that interface, which then proceeds to time out (often there is no DHCP server on the embedded device) before you have to manually assign the same static IP that you were using on the interface a few seconds before.

As it turns out there is a way to tell NetworkManager to keep its mitts off of a particular interface. Firstly, find the udi of the interface with the ‘lshal’ command. eg:

udi = ‘/org/freedesktop/Hal/devices/net_00_05_1b_ac_6c_03’
info.capabilities = {‘net’, ‘net.80203’, ‘wake_on_lan’} (string list)
info.category = ‘net.80203’ (string)
info.interfaces = {‘org.freedesktop.Hal.Device.WakeOnLan’} (string list)
info.parent = ‘/org/freedesktop/Hal/devices/usb_device_7a6_8515_0001_if0’ (string)
info.product = ‘Networking Interface’ (string)
info.subsystem = ‘net’ (string)
info.udi = ‘/org/freedesktop/Hal/devices/net_00_05_1b_ac_6c_03’ (string)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = ‘net’ (string)
linux.sysfs_path = ‘/sys/devices/pci0000:00/0000:00:1d.7/usb7/7-1/7-1.6/7-1.6:1.0/net/eth1’ (string)
net.80203.mac_address = 21939121155 (0x51bac6c03) (uint64)
net.address = ‘00:05:1b:ac:6c:03’ (string)
net.arp_proto_hw_id = 1 (0x1) (int)
net.interface = ‘eth1’ (string)
net.linux.ifindex = 5 (0x5) (int)
net.originating_device = ‘/org/freedesktop/Hal/devices/usb_device_7a6_8515_0001_if0’ (string)
org.freedesktop.Hal.Device.WakeOnLan.method_argnames = {”, ”, ‘enable’} (string list)
org.freedesktop.Hal.Device.WakeOnLan.method_execpaths = {‘hal-system-wol-supported’, ‘hal-system-wol-enabled’, ‘hal-system-wol-enable’} (string list)
org.freedesktop.Hal.Device.WakeOnLan.method_names = {‘GetSupported’, ‘GetEnabled’, ‘SetEnabled’} (string list)
org.freedesktop.Hal.Device.WakeOnLan.method_signatures = {”, ”, ‘b’} (string list)


Then add this udi as an un-managed device to the [keyfile] section of ‘/etc/NetworkManager/nm-system-settings.conf’. eg:

[keyfile]
unmanaged-devices=/org/freedesktop/Hal/devices/net_00_05_1b_ac_6c_03


It should take effect immediately, and you shouldn’t even need to restart NetworkManager.

Note: Thanks to tambeti on #opensuse-gnome for the tip.
Tags:
Posted by: peter

This week brought us two very interesting Open Source announcements: