Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

SL Protocol Reverse Engineering Team

Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
05-15-2006 09:34
From: Eddy Stryker
Since the protocol map is dynamically generated from a file each time Second Life or libsecondlife load, any time there is a protocol update you just grab the latest comm.dat from Second Life and feed it to libsecondlife. For a protocol update to break libsecondlife, it would require the addition or removal of adata type, a very significant number of features added or removed from the spec (this will throw off the keyword ordering), or a change in the comm.dat file format. Any of these changes would be a significant modification to both the client and servers, and Lindens are already letting us know of planned changes down the road so we can prepare. Luckily for our development efforts I think those major protocol changes are on the same roadmap as the Mono scripting backend and Havok 2 ;-).


I'm still wrapping my brain around how exactly the protocal works. Why is it built this way at all? It seems like bloat to me; pointless abstraction.

I've writen a little AutoIt script to parse the decrypted comms file to an xml file, and then have it insert whitespace so it's human readable (comlements MS). Could have writen it to be smarter but this does a nice job.

CODE

$text = FileRead ("output.txt")
$text = "<root>" & @CR & $text & "</root>"
$text = StringRegExpReplace ( $text, "[ ]*([{}])\1[ ]*", "\1");remove the spaces, they are a hastle to remove later.
$text = StringRegExpReplace ( $text, "\{([^{}]+)\1\}", "<tag text='\1'/>"&@CR);not needed, but makes things look nice
$text = StringRegExpReplace ( $text, "\{([^\r<{}]+)\1", "<tag text='\1'>"&@CR)
$text = StringRegExpReplace ( $text, "\}", "</tag>"&@CR)
$text = StringRegExpReplace ( $text, "\r([^\r<]+)\1", @CR&"<comment text='\1' />"&@CR)

FileDelete ("output2.txt" )
FileWrite ("output2.txt", $text)

$xml = ObjCreate("Microsoft.XMLDOM");makes nice whitespace.
$xml.async = "false"
if $xml.loadXML($text) Then
ConsoleWrite ( "Valid XML" &@CR )
Else;these only do anything for editors that support it (like scite)
ConsoleWrite ( "Invalid XML" &@CR )
EndIf
$xml.save("output.xml")
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Eddy Stryker
libsecondlife Developer
Join date: 6 Jun 2004
Posts: 353
05-15-2006 10:50
My main gripe with the protocol file is that part of it is ordered and part of it is unordered. Everything in the protocol relies heavily on ordering, for example the command names (tier one) correlate to a packet number that is their position in the text array. Kind of. There are four basic groups of packets; low, medium, high, and fixed (which is a subset of low). So the first low packet in the text file is identified with a 1, the second with a 2, etc. The first medium packet is identified with 1, so on and so forth. The fixed packets look like low packets, but they have a fixed position in the array, at the very end of it so no matter what protocol version the client or server are speaking they can still send those packets, which mostly deal with verifying the protocol version. But the block values (tier two) and field values (tier three) are randomly thrown in each packet with no regard as to ordering. All of the "keywords" are in a fixed array just like the command names, but the ordering of that array can't be gleaned from the comm.dat file as far as I can see. libsecondlife handles this by keeping a keywords.txt file that is just a list of all the keywords in order, which is thrown in to a map at run-time.
Geuis Dassin
Filming Path creator
Join date: 3 May 2006
Posts: 565
05-30-2006 15:12
Has anyone had luck in decoding the teleport protocol? I would like to see the communication process starting from when the client tells the server where to teleport to, to when the teleport finishes. Tried running snowcrash w/ latest version of SL but SL crashes when loading quicktime.
Eddy Stryker
libsecondlife Developer
Join date: 6 Jun 2004
Posts: 353
05-30-2006 20:09
From: Geuis Dassin
Has anyone had luck in decoding the teleport protocol? I would like to see the communication process starting from when the client tells the server where to teleport to, to when the teleport finishes. Tried running snowcrash w/ latest version of SL but SL crashes when loading quicktime.


I haven't had a chance to take a look, but we're going to have to use snowcrash to do it so hopefully this crash isn't the case for everyone. I know I had a crash on login with WinXP64 installed, but it worked fine on a 32-bit computer. Haven't tried with the latest version, if it's crashing maybe removing some of the system hooks would fix it.
Purrts Trumbo
Registered User
Join date: 7 Sep 2005
Posts: 22
07-27-2006 08:46
If you're having trouble with SL crashing when loading Quicktime. Look at the Quicktime options and turn off the DirectX calls.

This fixed it for me.
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
07-27-2006 09:18
Also, we're moving to using SLProxy instead of Snowcrash for anylizing client messages. SLProxy is written in C#, so its platform-agnostic, and it has some cool packet manipulation/injection features.

SLProxy doesn't use the odd windows hooks that Snowcrash does, so it should be much more stable.
==Chris
Takuan Daikon
choppy choppy!
Join date: 22 Jun 2006
Posts: 305
SLProxy
07-29-2006 23:06
From: Christopher Omega
Also, we're moving to using SLProxy instead of Snowcrash for anylizing client messages


I've been playing a bit with SLProxy, and I'm thrilled with it and the rest of libsecondlife for the most part (kudos!)

Great work, very exciting, and I can hardly wait to see the things that this will enable. I'd especially love to be able to add inventory backup and restore to combat the too-frequent sim roll-backs! Or svn support for lsl scripters =D

edited to remove comments on a percieved issue with libsl that turned out to be my own misunderstanding. rtfm, huh?
DoctorMike Soothsayer
He's not a real doctor.
Join date: 3 Oct 2005
Posts: 113
SLproxy and missing ChatConsole
10-04-2006 13:33
Just downloaded SLProxy zip file. No ChatConsole included, despite docs and when running Analyst I do get the proxy server bit, but typing in chat window does not seem to log packets to the console; by which I mean the command window opened when you run analyst. Could we have a tutorial for this?
_____________________
Performance Artist and educator
"Thinking outside the Prim"
Imp Xi
Registered User
Join date: 6 Oct 2006
Posts: 15
10-09-2006 12:21
Apparently you're supposed to route SL through the proxy.

Did you read the README?

That's the first place to start.


...



However, i've also had trouble. I can get the Analyst to show all the packets with the --log-all enabled, however I can't get it to recognize /log * or any other chat command in SL.

What's wrong?

Maybe an update is needed?
DoctorMike Soothsayer
He's not a real doctor.
Join date: 3 Oct 2005
Posts: 113
Read Me - read it
10-10-2006 01:03
Yup, did read the readme, but it was useless, sadly. Was answered off-line that the binary zip was incomplete, out of date and worthless. So, have been attempting to download C# etc in order to compile the sources; problems with access to MS web site, and other work has prevented progress thus far. Will report back if I have problems.
_____________________
Performance Artist and educator
"Thinking outside the Prim"
Baba Yamamoto
baba@slinked.net
Join date: 26 May 2003
Posts: 1,024
10-11-2006 15:12
http://www.libsecondlife.org/downloads/libsecondlife-latest.zip

If it's gonna work, you will find it there. That is compiled every night by automatic build script.

Please remember that this has not been updated for today's release just yet. SLProxy should work for chat console or other limited uses.
_____________________
Open Metaverse Foundation - http://www.openmetaverse.org

Meerkat viewer - http://meerkatviewer.org
1 2 3 4 5 6