Search code examples
node.jstcpxmpp

tcp xmpp malformed packet node.js


I'm trying to recreate an xmpp server for a game that was shutdown years ago but I have an issue with receiving packets.

The first 2 packets I receive are fine but when it gets to the third one it looks malformed, is this normal? If so could I get the payload out of this packet? I'm using the net module in Node.JS

Output:

Received Packet: <?xml version="1.0" ?><stream:stream to="127.0.0.1" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0" xml:lang="en">

Sent Packet: <stream:stream xmlns='jabber:client' xml:lang='en' xmlns:stream='http://etherx.jabber.org/streams' from='127.0.0.1' id='12345' version='1.0'><stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/></stream:features>

Received Packet: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>

Sent Packet: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>

Received Packet: ▬♥☺S☺O♥☺b��u�?�w��∟�s �Gt;/%T�P���m�(985▬‼32/♣♦§↕ ¶♠♥☺§st☻☻F

Solution

  • After the <proceed/> your connection is using TLS (cf. the relevant section of RFC 6120) and hence the data you receive is encrypted, which you appearantly do not decrypt.