Trepia is a cool idea. It's an IM client that finds other people and sorts them by their proximity to you. But while it's a great idea, the client sucks, and it's not open source, so I can't fix its annoying problems myself. So, I decided to take some time to reverse engineer the protocol in hopes that somebody will write a better Trepia client. Maybe we'll be able to run it on *nix soon!
If you discover anything else, please post the additional information in a comment.
Prologue
I coded up a simple proxy server that would write out the packets as hex dumps, but most of that work turned out to be unnecessary, because Trepia actually uses uncompressed, unencrypted XML to communicate with the server. So I spent a bit of time reverse engineering the Trepia protocol. I've only put about 2 hours into it, but I'm hoping other people will take this information and run with it.
Overview
To create a new account in Trepia, the NEWACCT packet is used. After that, when you connect to Trepia, the client sends the CONNECT packet, to which the server replies with the LOGIN packet. From there, it's a loop that simply processes incoming packets. I believe it doesn't need to store any state about packets seen/expected for its basic operation. The exceptions are when logging in, creating a new account, or downloading the current user's profile.
Servers
The default trepia server is located at 207.44.192.59 and runs a Trepia server on ports 8201 through 8210.
[update] The server IP seems to have changed to 66.98.134.44.
Data Types
Trepia uses the following data types:Type | Description | Example |
---|---|---|
Integer | An unbroken block of digits | 1245 |
String | A block of text, encoded using XML entities. Line breaks, etc are also encoded as entities. Line breaks are encoded as a single 
 | me & joe went to the store
it wasn't fun |
MAC Address | A unique identifier for a network interface | 00-50-BA-75-10-F7 |
Hex data | An unbroken string of lowercase hex characters | ee9356e428dd9507b32715da7235 |
Base64 data | A solid block of data encoded as base64 | /9j/4AAQSkZJRgAQSkZJRgABAB== |
Location | An integer that specifies a person's location. I've noticed that people close to me have closer numbers, so the distance between people may be simple subtraction operation between their locations. However, it doesn't sound like it would work, so I'm not sure about that. UNKNOWN FORMAT | 1055792857 |
Packet format
Each packet is an XML block. The root tag specifies the packet type. Inside the root tag are immediate children, usually labeled 'a', 'b', 'c', 'd', etc. These children make up the parameters for the packet. So far, most children have been in a consistent order. However, the ones dealing with profiles or user data (ie DATAREPLY) have not always been in a consistent order. So, it's best not to rely on the order of the child nodes.
In the tables below, parameters are listed in the order the are generally sent/received by the official client.
Incoming Packets (packets from server to client)
Index: LOGIN | MEMBER | LOCATION | QUERY | DATAREPLY | NIX | PROFILE | RATEDOutgoing packets
Packet: LOGIN, Node: L, Parameters: 3
The LOGIN packet is sent in response to a CONNECT packet or a NEWACCT packet.
Parameter | Type | Meaning |
---|---|---|
a | Integer | Status: 0 - login successful, 1 - login incorrect, 2 - nickname taken (during registration), 4 - outdated client version?, OTHERS? |
b | Location | Your current location |
c | Integer | UNKNOWN, always 2 so far |
<L> <a>0</a> <b>1055973014</b> <c>2</c> </L>Packet: MEMBER, Node: M, Parameters: 4
The MEMBER packet is sent to add/update users in the user list.
Parameter | Type | Meaning |
---|---|---|
a | Integer | User ID |
b | Location | User's location |
c | Integer | UNKNOWN, usually small numbers (1-4), but sometimes not. profile/update type? 1 - profile only?, 2/else - profile+picture? |
d | Integer | UNKNOWN, can be empty? |
<M> <a>12592</a> <b>1055792857</b> <c>2</c> <d>1738</d> </M>Packet: LOCATION, Node: R, Parameters: 2
The LOCATION packet is sent to update the location/insta-blog note for a user.
Parameter | Type | Meaning |
---|---|---|
a | Integer | User ID |
b | String | User's location/note |
<R> <a>1004</a> <b>Memory Leaks Fixed: NEW TREPIA</b> </R>Packet: QUERY, Node: Q, Parameters: 2
The QUERY packet is sent when a user sends a message to you.
Parameter | Type | Meaning |
---|---|---|
a | Integer | User ID |
b | String | User's message |
<Q> <a>12592</a> <b>test message</b> </Q>Packet: DATAREPLY, Node: O, Parameters: variable, 2+
The DATAREPLY packet is sent by the server in response to DATAREQ packets sent by the client.
Many of these fields can be missing or empty.
Parameter | Type | Meaning |
---|---|---|
a | Integer | User ID |
b | Location | User's location |
c | Integer | UNKNOWN, small numbers, always seems to accompany image data |
d | String | User name |
e | String | Email address |
f | String | Homepage URL |
g | String | First name |
h | String | Last name |
i | Integer (String?) | ICQ number |
j | String | AIM ID |
k | String | MSN ID |
l | String | Yahoo ID |
m | Integer | Age |
n | String | Gender (M/F) |
o | String | Profile text |
p | String | Current location/insta-blog note? |
q | Base64 | Image file encoded as base64 - so far has been jpeg but may be other formats |
r | String | Country |
s | String | State/Province |
t | String | City |
u | String | Language(s) |
v | String | School |
w | String | Company |
x | String | Location (dropdown box) |
<O> <a>11263</a> <p>georgia</p> <b>1055298503</b> <d>USERNAME</d> <m>25</m> <n>M</n> <g>First</g> <h>Last</h> <o>Network & Systems engineer (Cisco, Solaris, Linux, FreeBSD)</o> <e>spraycj@club2206.com</e> <i>164494238</i> <j>aaronkclark</j> <k>cryptojones@hotmail.com</k> <l>aaronkclark</l> <f>http://www.taoknights.org/aaronkclark</f> <r>United States</r> <s>TX</s> <t>San Antonio</t> <u>English</u> <v>School</v> <w>Company</w> <x>US -> Georgia -> Atlanta</x> </O>example 2 - photo data
<O> <a>7510</a> <c>1</c> <q>/9j/4AAQSkZJRgAB...kZJR</q> </O>Packet: NIX, Node: N, Parameters: 1
The NIX packet is sent by the server when a user has logged off.
Parameter | Type | Meaning |
---|---|---|
a | Integer | User ID |
<N><a>5272</a></N>Packet: PROFILE, Node: P, Parameters: 2
The PROFILE packet is sent by the server in response to the PROFREQ packet. The client can send an UPDPROF packet to alter the profile.
Parameter | Type | Meaning |
---|---|---|
a | Integer | User ID |
b | String | User's password, sent as plaintext |
c | String | Email address |
d | String | Homepage URL |
e | String | First name |
f | String | Last name |
g | Integer (String?) | ICQ number |
h | String | AIM ID |
i | String | MSN ID |
j | String | Yahoo |
k | Integer | Age |
l | String | Gender (M/F) |
m | String | Profile text |
n | Base64 | photo data - base64 encoded image file |
o | String | Country |
p | String | State/province |
q | String | City |
r | String | Language(s) |
s | String | School |
t | String | Company |
u | String | Location (dropdown box) |
<P> <a>Adam</a> <b>PASSWORD</b> <k>21</k> <l>M</l> <e>Adam</e> <f>M</f> <m>this is my profile</m> <c>adamm@san.rr.com</c> <g>27630686</g> <h></h> <i></i> <j></j> <d>http://www.adammil.net/</d> <o>USA</o> <p>CA</p> <q>San Diego</q> <r>English, Japanese</r> <s></s> <t></t> <u>US -> California -> San Diego</u> <n>/9j/4AAQ...qS5tz//Z</n> </P>Packet: RATED, Node: V, Parameters: 2
The RATED packet is sent when another user has rated you.
Parameter | Type | Meaning |
---|---|---|
a | Integer | User ID |
b | Integer | Rating (1 - Cool, 2 - Interesting, etc) |
<V><a>12592</a><b>1</V>
Outgoing Packets (packets from client to server)
Index: CONNECT | DATAREQ | MSG | PROFREQ | UPDPROF | UPDNOTE | RATEUSER | NEWACCTIncoming packets
Packet: CONNECT, Node: C, Parameters: 5
The CONNECT packet is sent as soon as the client connects to the server. The server replies with the LOGIN packet.
Parameter | Type | Meaning |
---|---|---|
a | MAC Address | Your MAC address |
b1 | MAC Address | UNKNOWN, gateway MAC address??? |
c | String | Your User ID |
d | Hex data | MD5 hash of the password |
e | String | Client version |
<C> <a>00-07-95-EA-E1-CE</a> <b1>00-50-BA-75-10-F7</b1> <c>AdamM</c> <d>bfad699370b9c64abd7ec844813fc4e1</d> <e>2.51</e> </C>Packet: DATAREQ, Node: D, Parameters: 2
The DATAREQ packet is sent by the client to request data about a particular user. The server will respond with corresponding DATAREPLY packets.
Parameter | Type | Meaning |
---|---|---|
a | Integer | User ID |
b | Integer | Data requested, 1 - profile, 2 - photo, POSSIBLY OTHERS |
<D> <a>7965</a> <b>1</b> </D>Packet: PROFREQ, Node: I, Parameters: 0
The PROFREQ packet is sent when the client wants to request its own profile. The server replies with a PROFILE packet.
<I></I>Packet: MSG, Node: F, Parameters: 2
The MSG packet is sent by the client when the client wants to send a message to another user.
Parameter | Type | Meaning |
---|---|---|
a | Integer | User ID |
b | String | Message to send to user |
<F> <a>12592</a> <b>send message to pf</b> </F>Packet: UPDPROF, Node: K, Parameters: variable
The UPDPROF packet is sent when the client wants to update its profile.
The parameters consist of the items to change and the new values.
Parameter | Type | Meaning |
---|---|---|
a | String | User's password, sent as plaintext |
b | String | Email address |
c | String | Homepage URL |
d | String | First name |
e | String | Last name |
f | Integer (String?) | ICQ number |
g | String | AIM ID |
h | String | MSN ID |
i | String | Yahoo |
j | Integer | Age |
k | String | Gender (M/F) |
l | String | Profile text |
m | Base64 | photo data - base64 encoded image file |
n | String | Country |
o | String | State/province |
p | String | City |
q | String | Language(s) |
r | String | School |
s | String | Company |
t | String | Location (dropdown box) |
<K> <a>password</a> <f>27630686</f> <m/> <t>US -> California -> San Jose</t> </K>Packet: UPDNOTE, Node: G, Parameters: 1
The UPDNOTE packet is sent when the client wants to update its location/insta-blog note.
Parameter | Type | Meaning |
---|---|---|
a | String | New note |
<G><a>change my blog note</a></G>Packet: RATEUSER, Node: U, Parameters: 2
The RATEUSER packet is sent when the client wants to rate another user.
Parameter | Type | Meaning |
---|---|---|
a | Integer | User ID |
b | Integer | Rating (1 - Cool, 2 - Interesting, etc) |
<U><a>12592</a><b>1</U>Packet: NEWACCT, Node: J, Parameters: 14
The NEWACCT packet is sent to create a new Trepia account. The server will reply with a LOGIN packet.
Many of these fields may be empty, but I think none can be omitted.
Parameter | Type | Meaning |
---|---|---|
a | MAC Address | Your MAC address |
b | MAC Address | UNKNOWN, gateway MAC address??? |
c | String | Client version |
d | String | User name |
e | String | Password in plain text |
f | String | Email address |
g | String | Homepage URL |
h | String | First name |
i | String | Last name |
j | Integer | Age |
k | String | Gender (M/F) |
l | String | Profile text |
m | Base64 data | Base64 encoded image file |
n | String | Location (from dropdown box) |
<J> <a>00-07-95-EA-E1-CE</a> <b1>00-50-BA-75-10-F7</b1> <c>2.51</c> <d>Adam</d> <e>password</e> <f>adamm@san.rr.com</f> <g>http://www.adammil.net/</g> <h>Adam</h> <i>Foo</i> <j>21</j> <k>M</k> <l>my profile</l> <m>/9j/4AAQ...+Jpgf//Z</m> <n>US -> California -> San Diego</n> </J>
Comments
No comments yet.