NoshBar's Dumping Ground

(Helper)MonkeyBot C++


(Helper)MonkeyBot is a free note-taker/reminder/download-helper program with an instant-messenger interface, avoiding opening firewall ports, or having to SSH in to start a download on your home PC.

You basically use Google Talk to tell a program on your home PC to store/retrieve information for you, or to download files.

MonkeyBot is open source under the ZLib license, using SQLite and the Gloox XMPP library, which uses GnuTLS.


  • Store messages with different built-in/custom categories, e.g.,
    todo:Kill everyone
  • Show and delete existing messages
  • Do full text searches through messages, optionally showing only URLs from messages that return a match, e.g.,
  • Start downloads remotely, e.g.,
  • Uses the widely-supported XMPP protocol (so Google Talk works like a charm)
  • No need to open an incoming port on your firewall, as the client connects out
  • Single-web-page PHP utility to view and filter messages in a browser

How to use


  • You will need a dedicated MonkeyBot chat account, so go ahead and create one e.g.,
  • Add the new account as a chat contact so that you can see the MonkeyBot account in your IM Client.
  • Download a binary compiled for your platform:
    32-Bit Ubuntu 10.10 here
    32-Bit Windows here


  • For Linux, install libgloox (Ubuntu/Debian: run "sudo apt-get install libgloox wget" from a command-line, or use Synaptic Package Manager)
  • For Windows, download a Win32 wget binary and put it in a folder that is in the system-wide path variable.

Starting the program:

  • Either double-click the monkeybot executable, or run it from a command-line
  • Enter the MonkeyBot username, in this case,
  • Enter the password for the MonkeyBot account
  • Enter your account address as the one to listen to (MonkeyBot will not obey anyone else)
  • Enter your secret handshake phrase. MonkeyBot will ignore anything until the magic phrase is typed.

Once that is done, you should see your GoMonkeyBotGo@gmail account come online in your chat window.
As soon as you type your magic phrase, you should see the MonkeyBot reply with "Listening...", indicating it is ready for commands.

Note that the following command-line options are available:
-u monkeybot-username
-p monkeybot-password
-g monkeybot-owner
-h secret-handshake-phrase
-f download-folder
-s chat-server (if not
-d name-of-local-SQLite-database
-c handshake-confirm-message (if "Listening..." does not suit)

Viewing entries:

  • A PHP file called "monkeyview.php" is included to view the data in a browser.
  • A working PHP installation with PHPSqlite installed is required.
    (Ubuntu: sudo apt-get install php5 php5-sqlite)
  • To view and delete entries, you will need a web server installed. Assuming it shows pages from "/var/www/", you can put monkeyview.php and monkey.db in "/var/www/monkeybot", then browse to
  • To only view new entries, you do not need a web server installed, you can simply change to the folder containing monkey.db and run:
    php monkeyview.php > /tmp/out.html && firefox /tmp/out.html


Download minimal source package for Linux here
Download complete source package for Windows here (contains GnuTLS and Gloox dependencies)

The source package includes the SQLite source code, as we need to compile it with Full Text Search enabled, which not all distributions do by default

Compiling on Ubuntu:

  • Extract the minimal MonkeyBot source code to somewhere, e.g., /tmp/monkeybot
    cd /tmp
    mkdir monkeybot
    cd monkeybot
    tar -zxvf ~/Downloads/monkeybot_Linux_source_v0.1.tar.gz
  • Install dependencies
    sudo apt-get install gcc g++ libgloox-dev
    Change to the folder containing the extracted source and run the build script
    cd /tmp/monkeybot/Bot/MonkeyBot/
  • After a few seconds, you should see an "ls" command showing that the binary built successfully.

Compiling on Windows:

This is where it gets a bit shady black-magicy, I will figure out what's going on later, but for now:
  • Extract the full MonkeyBot source code to somewhere, e.g, c:\temp\monkeybot\
  • Using Visual Studio 2010, open the c:\temp\monkeybot\Bot\depends\gloox\gloox.sln
  • Build the DEBUG version (the RELEASE version crashes for some reason)
  • Using Visual Studio 2010, open the c:\temp\monkeybot\Bot\MonkeyBot.sln
  • Build the DEBUG version (the RELEASE version crashes for some reason)

Gloox relies on GnuTLS.
gnutls does not ship with a .lib file that gloox needs to link to, so one can be created by opening a Visual Studio command prompt and changing to the gnutls\bin folder and running:
lib /def:libgnutls-26.def
To build gloox from the source distribution, you need to upgrade the workspace/solution file to 2010, and make sure you:
1. remove tlsserver.cpp and tlsserver.h from the solution
2. add HAVE_GNUTLS to the preprocessor define list
3. make sure ssize_t is defined in some gross way, either a typedef, or if you're feeling particularly nasty: add "#define ssize_t signed long" to the top of tlsgnutlsbase.h