An OMEMO-enabled XMPP bot that tails a log file and sends new lines to a given contact in encrypted form
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Manuel Leithner e039dd5f00 Important tip for multiple instances in README... 2 years ago
.gitignore Initial commit 2 years ago
LICENSE Added licensing information, installation instructions and usage example 2 years ago
README.md Important tip for multiple instances in README... 2 years ago
bruh.py Added licensing information, installation instructions and usage example 2 years ago
requirements.txt Initial commit 2 years ago

README.md

bruh

An OMEMO-enabled XMPP bot that tails a log file and sends new lines to a given contact in encrypted form.

Heavily based on the slixmpp-omemo example. In fact, for the most part this code is just an extension of it.

Licensed under the GPLv3, see LICENSE.

Installation

Clone this repository, ideally set up a virtualenv for it, and install the requirements:

git clone https://git.nwt.fhstp.ac.at/is211810/bruh.git
virtualenv bruh
cd bruh
source bin/activate
pip install -r requirements.txt

Additionally, you should have an existing XMPP account for the bot to use. Ideally, the bot account and your recipient should be added to each other's roster and subscribed to each other's presence (although this might not be necessary in all cases).

To verify the correct functionality, run the bot as instructed below and send any message from your recipient account to the bot. Errors about not being in the trusted device list are normal when you do this first, but should disappear upon sending any subsequent messages.

Usage

If you are using a virtualenv, make sure to activate it first by typing source bin/activate in this folder!

python bruh.py [-h] [-q] [-d] [-j JID] [-p PASSWORD] [-f FILE_NAME] [-t WATCH_DEST_JID] [--data-dir DATA_DIR]

An OMEMO-enabled XMPP bot that tails a log file and sends new lines to a given contact in encrypted form.
It also serves as an echo bot.

optional arguments:
  -h, --help            show this help message and exit
  -q, --quiet           set logging to ERROR
  -d, --debug           set logging to DEBUG
  -j JID, --jid JID     JID to use
  -p PASSWORD, --password PASSWORD
                        password to use
  -f FILE_NAME, --file FILE_NAME
                        Log file to watch
  -t WATCH_DEST_JID, --to WATCH_DEST_JID
                        JID of the user to send new lines to
  --data-dir DATA_DIR   data directory

If the --jid or --password parameter is missing, they will be requested interactively.

To tail a log file, provide the --file and --to parameters. If these two parameters are not provided, the bot reverts to a simple echo bot (equivalent to the upstream version it is based on).

Do not run multiple bots using the same data directory or you will experience issues with OMEMO.

Usage example

python bruh.py --jid bruh@example.com --file /var/log/syslog --to you@example.com