• Stars
    star
    148
  • Rank 249,983 (Top 5 %)
  • Language sed
  • Created over 6 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

XMPP/Jabber echo bot (written in sed)

XMPP Echo Bot

Do you know that situation, you really really need an XMPP echo bot, but you don’t have access to high-level tools like Python to write one? All you have is openssl, bash, dig, stdbuf and sed? Then this tool is for you.

This is an XMPP echo bot written in (mostly) sed. Bash is used to do the pre-authentication setup (look up DNS records, establish TLS via openssl s_client). sed processes the XML stream and handles all interaction with the server on the XMPP level. Yes, this kinda parses XML in sed.

Tested to work against Prosody 0.9.

Usage

./echoz.sh user@domain password

Supported Features

Testimonials

  • This is crazy, I haven't crashed it yet!Matthew Wild
  • I'm frightened. It's only two steps away from gaining consciousness.Georg Lukas
  • I am simultaneously appalled and in awe. wowLance
  • With Echoz.sed, we were able to reduce our XMPP Echo server costs by 90% compared to our previous TeX-based solution. — Leon
  • While simple and limited, sed is sufficiently powerful for a large number of purposes.Wikipedia
  • oh my god this actually worksTest

Implementation Details

  • We use tr to convert > to \n -- since sed is line (or NUL) based, there’s not really another way to parse XMPP XML (which generally never contains newlines) with sed.
  • TLS is handled outside of sed for similar reasons. And to keep my sanity (some people might question whether I still have any bit of sanity left).
  • Likewise, SRV lookup and composition of the authentication data is entirely handled in bash. This also means that only PLAIN SASL authentication is supported -- SCRAM requires a level of interactivity which would be extremely hard to achieve in sed (not impossible though; we would "just" have to implement base64 and sha1-hmac in sed).
  • Since XMPP is a protocol where the client speaks first, we need to hand sed some initial input to allow it to generate a "line" of output (the stream header). We do that with bash, and use that opportunity to pass some configuration to the sed program (namely JID and authentication string).

Design Considerations

  • We considered using xml2 to convert the XML stream into events; however, it turns out that 2xm[ doesn’t like stream resets. Also, using the tr approach also allows us to detect the end of elements, which is useful for various purposes.

More Repositories

1

aioxmpp

An XMPP library for use with Python 3.5+ asyncio.
Python
218
star
2

muchopper

25
star
3

xmpp-http-upload

An external HTTP upload (XEP-0363) implementation for use with e.g. Prosody
Python
23
star
4

aioopenssl

(START-)TLS-capable transport using OpenSSL for asyncio
Python
15
star
5

xmpp-crowd

The crowd of SleekXMPP/aioxmpp based bots which make my life easier.
Python
12
star
6

xmpp-blackbox-exporter

A Prometheus blackbox-like thing to probe XMPP services
Go
11
star
7

gnome-shell-extensions-mediaplayer

A mediaplayer indicator for the gnome-shell.
JavaScript
8
star
8

xsudo

Script to execute a X11 command as different user. Alternative to kdesudo/gksudo.
Shell
8
star
9

cuteborg

Third-party frontend to borgbackup (CLI and Qt)
Python
7
star
10

python3-openttd

Pure-python client implementation for the OpenTTD admin network interface.
Python
7
star
11

aiosasl

Pure-python, protocol-agnostic SASL implementation for asyncio
Python
6
star
12

dragonstash-golang

Transparent caching file system overlay written with FUSE and Golang.
Go
5
star
13

ansible-pulseaudio

An ansible role for a dedicated pulseaudio server (not running as root, but still offering network services during the whole uptime)
5
star
14

tagger

Songbird addon to manage and modify metadata.
JavaScript
5
star
15

rxml

4
star
16

covid

Preprocessing tools for various covid data to send it to InfluxDB for a nice dashboard
Rust
4
star
17

thorium

Thorium Scripting Language
Pascal
4
star
18

borgrdr

This repository moved to Codeberg. https://codeberg.org/jssfr/borgrdr
4
star
19

xmppobserve-web

Wait for it.
Python
3
star
20

ManiacLab

A boulder dash clone with awesome physics. And explosives. And lasers.
C++
3
star
21

lcdd

daemon to remote-control something connected via serial using XMPP (e.g. a Sparkfun SerLCD with FTDI USB adapter); You may want to look at the successor hint instead.
C
3
star
22

backupcopter

a follow-up on rsnapshot, written in python with some more flexibility, out-of-the-box support for atomic btrfs backups, cryptsetup and more
Python
3
star
23

ir-gate

Infrared remote control sniffer/forwarder/injecter
2
star
24

jitsi-meet-role

Install jitsi-meet on a Debian system
2
star
25

hint

Home Information Terminal — a multi-part system providing sensor and other information
C
2
star
26

tt3d

Freeform transport organization game
Pascal
2
star
27

greylist

A greylisting implementation (for postfix) in Python, with simple overrun DoS protection
Python
2
star
28

while-to-sed

A transpiler from the academic turing-complete WHILE language to sed
Python
2
star
29

librust-prosody-util-stanza

Drop-in replacement for Prosody util.stanza written in Rust
Rust
1
star
30

urncat

C
1
star
31

xmppoke-queue

Python
1
star
32

sig11

Small, thread-safe signal library for C++11 onwards.
C++
1
star
33

fuse-medialib

Scans a directory for files with metadata and mounts the created media library as a fuse filesystem.
Python
1
star
34

shader-preprocessor

A simple but extensible preprocessor for use with GLSL shaders.
C++
1
star
35

gametoolset

A freepascal library to manage data and data access.
Pascal
1
star
36

rust-lisp

Rust
1
star
37

ffengine

C++
1
star
38

siglyze

Open source signal analysis tool. See sigvize for a graphical frontend.
Pascal
1
star
39

timeaccount

Because sometimes you just have to NIH.
Python
1
star
40

borg-pull-wrappers

Wrapper executables for fancy borgbackup pull architectures
Go
1
star
41

sigvize

Open source visualization frontend for siglyze.
1
star
42

2048-ai

An artificial intelligence for the 2048 game, including an engine to run your own AIs.
Python
1
star