README.md 2.4 KB
Newer Older
Manuel Leithner's avatar
Manuel Leithner committed
1
2
# bruh

3
4
5
6
7
8
9
10
11
12
13
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](https://lab.louiz.org/poezio/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:
```bash
git clone https://git.nwt.fhstp.ac.at/is211810/bruh.git
14
virtualenv bruh
15
16
17
18
19
cd bruh
source bin/activate
pip install -r requirements.txt
```

20
21
22
23
24
25
26
27
28
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.


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
## 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).

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

60
61
### Usage example

Manuel Leithner's avatar
Manuel Leithner committed
62
`python bruh.py --jid bruh@example.com --file /var/log/syslog --to you@example.com`