# Micha Gorelick

programmer, builder & astronaut

make your dumbphone a lot smarter
Well, I thought it was about time to post something, so let me show you this little project I've been tinkering with. It basically allows me to control my server with a cellphone. This can be applied to any computer with python installed and can do really anything (right now I have it search/download bittorrent files).

It basically works by creating a master thread on the server that constantly checks some secured twitter account for directed messages. This basically means that you can send a directed message to some secured user through twitter from your cell phone and when the computer reads this message it will act on it.

The following is the main code: it creates a main thread on the computer listening for new messages. When a new message is found, a new thread is created and the correct command is executed (the commands are defined in the configuration file which will come soon). The benefit to creating new threads is that the task can be halted later by initiating a stop command (the stop commands are hard programmed and are automatically generated for each configuration defined command).

And the following is a sample from the configuration file:

The commands use regex in order to extract keywords. So basically, I can SMS 'd user say hello there' and my computer will initiate the command flite -t "hello there" once it receives it! I also have the output of each command regulated by the 'output' parameter on each command. It can either notify me when the command starts, when it ends, or it can send me the output of the command (or, of course, none of the above).

Now, the interesting part is the bittorrent section. Here I send the keywords to another little program I made (really just a bunch of regex and rss tricks... I'll include it at the end). This program returns the URL of the highest seeded match to the keywords from IsoHunt.com. This is sent to transmission and my server starts downloading the torrent! (I use Transmission for bittorrent on my server with the Clutch web UI) So essentially, if a friend recommends a movie (that is in the public domain, of course ;) when I am out, I can tell my server to start downloading it so it will be ready when I am home.

Also, I can set my server to start a reverse-ssh connection to any IP. This is great because I can keep my router locked down but still connect to my server from the outside. Note: normally this sets my server to set up a reverse connection to an intermediary server so that everyone can be behind a firewall, but I'd like to keep the location of this server unknown for now.

Finally, the following is the source for pyisohunt.py. It was a true hack so don't expect clean code!

Well, I don't really know what else to say about this... ask questions and I'll be sure to give you more details than you ever wanted!