inspect_jitsi.xmpp.stanza module#

Building the XML we send, safely.

Everything that goes into a stanza is untrusted: the display name, nickname and the room come from the person running the tool (a URL or command line argument can contain anything, including quotes, <, &, newlines, control characters or bytes that are not valid text at all), and the domains come from the deployment's own /config.js.

So no stanza is assembled by pasting a value into a string. Each one is built as an xml.etree.ElementTree.Element and serialized, which escapes &, <, >, quotes and line breaks wherever the value ends up. The one thing ElementTree does not do is to reject characters that XML 1.0 forbids (control characters, lone surrogates such as those Python uses for undecodable command line bytes, U+FFFE/U+FFFF). They can not be sent at all, not even as character references, so _clean replaces them with U+FFFD. Line breaks in text are sent as a line feed, which is what a parser would make of a carriage return anyway.

Whatever the input, what comes out is well-formed XML with the value in exactly the place it was meant for.

inspect_jitsi.xmpp.stanza.bind_request()[source]#

Ask the server to bind a resource.

Return type:

str

inspect_jitsi.xmpp.stanza.disco_info_query(room_jid)[source]#

Ask a room for its disco#info, which tells whether it exists.

Return type:

str

inspect_jitsi.xmpp.stanza.join_presence(occupant_jid, name)[source]#

Join a MUC as occupant_jid, disclosing name (XEP-0172) if given.

Return type:

str

inspect_jitsi.xmpp.stanza.leave_presence(occupant_jid)[source]#

Leave the MUC that occupant_jid is in.

Return type:

str

inspect_jitsi.xmpp.stanza.sasl_anonymous()[source]#

Ask to authenticate with SASL ANONYMOUS.

Return type:

str

inspect_jitsi.xmpp.stanza.stream_open(domain)[source]#

The RFC 7395 <open/> that starts (or restarts) a stream to domain.

Return type:

str