Z
Zuher Laith
Guest
Hey everyone,
I have a TCP server connection (tcp client & server), that communicate using tcp packets, encrypted ones
The server takes the packet In, decrypt it, and able to send a packet out back to the client same way
the data mostly contains Byte,Int32,Int64,Int16, and I've been told its raw binary I think,
Mainly, for ex. this is the code for reading an incoming packet when it gets triggered (packets have OP codes at the start of them)
[PacketHandler(RealmServerOpCode.RemoveItem)] //5006 (OP CODE)
public static void RemoveItemRequest(IRealmClient client, RealmPacketIn packet)
{
Console.WriteLine(packet.ToHexDump());
packet.Position -= 9;
var inv = packet.ReadByte(); //default : 2Len : 1
var cell = packet.ReadInt16(); //default : 20Len : 4
var count = packet.ReadInt16(); //default : 1Len : 4
var data1 = packet.ReadInt16(); //real count
var data2 = packet.ReadInt16();
Console.WriteLine(inv + "," + count + "," + cell + ",," + data1 + "," + data2); //data output in 3 var's
}
So basically at the first line of the function is getting the HexDump of this packet (to know what's the client sending)
this is what we get:
////////// SENDING COUNT5,SLOT6,INV1 we get: ////////////////////
{SERVER} Packet: (0x138E) RemoveItem PacketSize = 47
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|8E 13 C4 51 FF E8 DF 88 00 00 96 F5 4D 30 B4 A1 |...Q........M0..|
|76 A1 FB 84 16 F7 53 0D BE 15 06 00 00 00 02 05 |v.....S.........|
|00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 |............... |
-------------------------------------------------------------------
S => C : {0}ItemRemovedFromInventory
6,512,0,,1,0
In this Hex-data I have 3 numbers for (count,slot,inventory), and inventory(inv) is either (2,1) but reading it as Int16 gives this (512,256), means 2=512, 1=256
This Hex includes the data init 6,5,1(slot,count,inv), but I don't know how to read them..
The output of console is 6,512,0 (6 is the slot, 512 is probably the inv, 0 is not valid)
As for the code of RealmPacketIn, its a function here in github (RealmPacketIn.cs, RealmPacketOut.cs)
In Conclusion
I want to figure out what the packets contains of data, what am I Dealing With, I need someone to put me in the right point
Any help is really appreciated...
Thank you.
Continue reading...
I have a TCP server connection (tcp client & server), that communicate using tcp packets, encrypted ones
The server takes the packet In, decrypt it, and able to send a packet out back to the client same way
the data mostly contains Byte,Int32,Int64,Int16, and I've been told its raw binary I think,
Mainly, for ex. this is the code for reading an incoming packet when it gets triggered (packets have OP codes at the start of them)
[PacketHandler(RealmServerOpCode.RemoveItem)] //5006 (OP CODE)
public static void RemoveItemRequest(IRealmClient client, RealmPacketIn packet)
{
Console.WriteLine(packet.ToHexDump());
packet.Position -= 9;
var inv = packet.ReadByte(); //default : 2Len : 1
var cell = packet.ReadInt16(); //default : 20Len : 4
var count = packet.ReadInt16(); //default : 1Len : 4
var data1 = packet.ReadInt16(); //real count
var data2 = packet.ReadInt16();
Console.WriteLine(inv + "," + count + "," + cell + ",," + data1 + "," + data2); //data output in 3 var's
}
So basically at the first line of the function is getting the HexDump of this packet (to know what's the client sending)
this is what we get:
////////// SENDING COUNT5,SLOT6,INV1 we get: ////////////////////
{SERVER} Packet: (0x138E) RemoveItem PacketSize = 47
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|8E 13 C4 51 FF E8 DF 88 00 00 96 F5 4D 30 B4 A1 |...Q........M0..|
|76 A1 FB 84 16 F7 53 0D BE 15 06 00 00 00 02 05 |v.....S.........|
|00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 |............... |
-------------------------------------------------------------------
S => C : {0}ItemRemovedFromInventory
6,512,0,,1,0
In this Hex-data I have 3 numbers for (count,slot,inventory), and inventory(inv) is either (2,1) but reading it as Int16 gives this (512,256), means 2=512, 1=256
This Hex includes the data init 6,5,1(slot,count,inv), but I don't know how to read them..
The output of console is 6,512,0 (6 is the slot, 512 is probably the inv, 0 is not valid)
As for the code of RealmPacketIn, its a function here in github (RealmPacketIn.cs, RealmPacketOut.cs)
In Conclusion
I want to figure out what the packets contains of data, what am I Dealing With, I need someone to put me in the right point
Any help is really appreciated...
Thank you.
Continue reading...