Richard Bucker

Reverse Engineering RestMQ

Posted at — Dec 6, 2011

RestMQ is no big secret. The source is available online and there is some doc too. The project I’m referring to was written in python using the Cyclone framework which depends on Twisted. I like both of those tools but they feel wrong for a project like this. It seems to me that the dependencies are too deep.That’s when I requested and was granted an account from the CPAN team. My intention is to build a version of RestMQ in perl using the Mojolicious framework. I originally thought to call it ‘RestMQ-pl’ and then I thought of ‘PerlMQ’ and I’m also lingering on ‘MojoMQ’. The last one makes sense if I create a separate core API than can be integrated into the Mojo base code. (when I learn it)The RestMQ code and doc is on par with just about every other open source project out there but there are some limits. One thing that is missing for me is enough code/doc that I can use as a requirements doc in order to implement the code in any language or any platform. So I am forced to install it and reverse engineer the behavior and the data.The other item that I’m struggling with is that this article is getting longer and longer. It’s hard to edit, get feedback and move on to the next idea… and quite possibly abandon the article if there is no interest. So for the purpose of this article I’m going to address installing RestMQ, Cyclone and Twisted on an OpenBSD 5.0 system which I have been using for general purpose development for the last few months.I tried to install RestMQ and it’s dependencies on an OpenBSD 5.0 system. My first attempt was a failure because the easy_install script reported that it was missing epoll.h which I’m pretty certain is a Linux kernel file and therefore is not going to be available on OpenBSD.My next stop is the Twisted website to see if they have a proper build script. That too failed because while Twisted was available in source form there were still too many dependencies that I did not want to chase after… and while I really do want some “full stack awareness” at this moment it’s off target for the mission. Get ‘er installed.I started my second attempt using an OpenBSD package:# OpenBSD 5.0pkg_add http://ftp.openbsd.org/pub/OpenBSD/5.0/packages/i386/py-twisted-web-11.0.0.tgzeasy_install cyclonewget https://github.com/gleicon/restmq.gitcd restmqpython ./setup.py installThis was not going to be enough. A couple of the scripts expect the bash shell to be in a different place. There are a couple ways to solve this and for an OpenBSD system the following is a severe cheat. One should really correct the code. Possibly change the static to use “env”. But in the meantime that too would be off mission. So this sym link will have to do for the moment.# need bash in the right placeln -s /usr/local/bin/bash /bin/bashLet’s see what happens next. From this point you should be able to follow the RestMQ instructions for starting and testing RestMQ… and it worked. Now for some reverse engineering.(The next article will roughly address the route table.)