xmpp-echo-bot

XMPP/Jabber echo bot (written in sed)
授权协议 Readme
开发语言 SHELL
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 淳于乐池
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

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 works — Test

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.
 相关资料
  • go-xmpp 是另外一个 XMPP 协议的 GO 语言实现。

  • MatriX 是 eXtensible Messaging and Presence Protocol (XMPP, 也叫 Jabber) 的开发包,采用 C# 编写,可用于 .NET 平台和 Sliverlight 技术。MatriX 提供完全的 .NET、.NET Compact 框架和 Sliverlight 支持。 示例代码:  // basic send message examplev

  • cl-xmpp 是 Common Lisp 实现的一个 XMPP 协议支持的开发包。

  • xmpp-go 是 Go 语言实现的兼容 XMPP 协议的客户端和服务器端。

  • 问题内容: 我将要开发一个具有近实时聊天功能的网站。我知道可以使用xmpp或websocket协议来实现。我也知道xmpp协议是在1999年开发的,我想它应该已经很成熟了。另一方面,websocket协议是在2011年开发的。 如果xmpp能够很好地处理实时对话,那么对websocket的需求是什么? 两种协议之间的主要区别是什么? 我什么时候应该选择其中一个呢? 问题答案: 简短的答案是“两者”

  • nativescript-xmpp-client Installation tns install nativescript-xmpp-client Usage import {Client, IQ} from "nativescript-xmpp-client";.... const client = new Client({ websocket: {url: 'ws://127.0