XMPP Bot that logs all nickname changes
xmppbot acts as a XMPP client. It logs into a MUC (multi-user chat, AKA as chat room), observes all nickname changes and
logs each message in the MUC with the full JID (Jabber ID) of the author in the file xmppmessages.log.
Normal XMPP clients tend to display and log only the nickname of an author in a MUC and they do not log nickname
changes. That allows a participant to change their nickname, send a message, log off and there is no way to find out
what user really sent that message other than using this bot.
Python 3.2 or later and Python virtualenv.
Create a virtualenv:
virtualenv xmppbot
. ./xmppbot/bin/activate
Install required Python libraries:
cd <directory where you downloaded xmppbot>
pip install -r requirements.txt
Activate virtualenv:
. ./xmppbot/bin/activate
Run xmppbot:
./xmppbot.py <parameters>
If you want to run xmppbot permanently, use:
nohup ./xmppbot.py <parameters> 2>&1 >/dev/null &
or if you are using fish:
nohup ./xmppbot.py <parameters> ^/dev/null >/dev/null &
You must set the following command line parameters, otherwise the bot will ask for them on the terminal:
xmppbot creates two log files:
connectivity issues. The file is rotated daily and removed after 7 days.
timestamp. The file is rotated daily and removed after 30 days.
The logging configuration can easily be altered by editing the file logging.yaml. See
https://docs.python.org/3/library/logging.config.html for detailed instructions.
The bot seems to reconnect nicely when it loses a connections but it would need further testing.
The bot maps each nickname to a JID and stores it in a hashtable. That hashtable could grow very big over time.
It should be replaced by a cache that would expire each entry that hasn’t been updated in a couple of weeks.
Bot happily connects and never complains when you misspell the MUC address.