Monday, November 15, 2010

Using NC to simulate prefix-free canonicalization

The rough sample of clients I looked at did not allow me to hack around with how is handled namespacing, and I did not want to play too much with the guts of an api to run this simple test.

So I simulated it with nc - to hack up a "client" to do the same.

Essentially took a socket dump of a 'valid' session between psi and wildfire server, and modified it simulate prefix-free canonicalization.

The actual flow was :

$ nc


This will open a socket to hostname:port, and allow us to read/write off the socket, neat.

Now we essentially just copy each line over, wait for response (if required) and on to next line.
Whitespace/newlines can be liberally sprinkled between lines for legibility.



--- start --

<!-- Initial stream requires xmlns="jabber:client" - else openfire aborts -->


<stream:stream xmlns:stream="http://etherx.jabber.org/streams" version="1.0" to="openfire.daigoro.net" xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns='jabber:client'>



<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">AG1yaWR1bABhYmMxMjM=</auth>



<!-- Post auth, while opening new stream, we DO NOT specify xmlns to jabber:client : essentially simulating a "prefix-free canonicalization" stream -->


<stream:stream xmlns:stream="http://etherx.jabber.org/streams" version="1.0" to="openfire.daigoro.net" xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace" >



<iq type="set" id="bind_1" xmlns='jabber:client'>
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<resource>direct_conn</resource>
</bind>
</iq>



<iq type="set" id="aad8a" xmlns='jabber:client'>
<session xmlns="urn:ietf:params:xml:ns:xmpp-session"/>
</iq>



<iq type="get" id="aad9a" xmlns='jabber:client'>
<query xmlns="jabber:iq:roster"/>
</iq>



<presence xmlns='jabber:client'>
<priority>5</priority>
<c xmlns="http://jabber.org/protocol/caps" node="http://psi-im.org/caps" ver="0.13-dev-rev2" ext="cs ep-notify html"/>
</presence>



--- end ---

No comments:

Post a Comment