Posted by: peter

While there seems to be a lot of information around explaining how to migrate an existing disk image to VirtualBox from both Xen and VMWare, I couldn’t find a single article explaining how to migrate away from VirtualBox. After a lot a google searches (most revealing an obsolete program called “vditool”) and reading quite a lot of documentation I found the VBoxManage clonehd command which allows you to convert a VDI disk image into a RAW disk image that is able to be used by Xen. To save everyone else the time, the syntax is:

VBoxManage clonehd image1.vdi image1.raw —format RAW

Tags:
Posted by: peter

The unspoken truth about managing geeks

  • IT wants to help me.
  • I should keep an open mind.
  • IT is not my personal tech adviser, nor is my work computer my personal computer.
  • IT people have lives and other interests.

Few people notice this, but for IT groups respect is the currency of the realm. IT pros do not squander this currency. Those whom they do not believe are worthy of their respect might instead be treated to professional courtesy, a friendly demeanor or the acceptance of authority. Gaining respect is not a matter of being the boss and has nothing to do with being likeable or sociable; whether you talk, eat or smell right; or any measure that isn’t directly related to the work. The amount of respect an IT pro pays someone is a measure of how tolerable that person is when it comes to getting things done, including the elegance and practicality of his solutions and suggestions. IT pros always and without fail, quietly self-organize around those who make the work easier, while shunning those who make the work harder, independent of the organizational chart.”

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’]