are these packets correct? Update: problem with reading.
I've been busy creating my own packet sniffer for silkroad. But I don't know if the packets are oke. because I use winPcap to sniff the packets and it has all those headers init so I had to strip them but I don't know if I got them all.
These are the first few packets which I got after I started the launcher.
These packet is right.
2 byte - data len
2 byte - opcode
2 byte - security bytes
after all packet is data.
You can check your data with and any open source emulator. ^^
Oke well I've got a new problem right now. (I didn't want to create a new thread so sorry for the double post)
I'm trying to read the packet size and the opcode but my reader returns in the 4th, 5th and the 7th packet wrong values. the 4th shows a wrong opcode the 5th are both values wrong and the 7th is the size wrong.
This is how it looks like:
as you can see the 4th packet says opcode = ffff9000 which should be 9000 only.
this is a little code snippet of my reader which I use to read the size and opcode. I got these from Jmerlin's sremu2 for just testing if it works.
Code:
template <typename T>
T reading(byte* stream, int& pos, int len)
{
if((int)(pos + sizeof(T)) > (int)len)
return (T)0;
T val = *(T*)&stream[pos];
pos += sizeof(T);
return val;
}
short packetReader::readWord(){
return reading<short>(_buffer,_cur,_size);
}
I'm using this readWord function for the packet size and opcode. I assume that correct.
owh and by the way I'm printing the size and opcode like this:
Code:
packetReader reader((byte*)data, size);
short psize = reader.readWord() + 6;
short opcode = reader.readWord();
short security = reader.readWord();
printf("packet size: %d\n", psize);
printf("opcode: %.4x\n", opcode);
I hope someone could help me with this problem.
thank you
EDIT: @lesderid Yeah I saw your packet documentation it's great But I would like to have something which I can use and update because your documentation would be incorrect if joymax changes something. and I need something to sniff ingame without using a loader or something like that. because most of the packet sniffers are build in loaders so you don't get the first few packets at startup and you have to wait for a new release if joymax updates their opcodes and with this one I ain't got those problems.
packetReader reader((byte*)data, size);
short psize = reader.readWord();
short opcode = reader.readWord();
short security = reader.readWord();
printf("packet size: %d\n", psize);
printf("opcode: %.4x\n", opcode);
try like this. ^^ you do not need +6 for psize
Thank you for your quick response.
It didn't solve my problem. I think I need to add + 6 because now I've got 6 bytes more in every packet than psize says. Like that 4th packet It says packet size: 0 but there are 6 bytes in it.
Thank you for your quick response.
It didn't solve my problem. I think I need to add + 6 because now I've got 6 bytes more in every packet than psize says. Like that 4th packet It says packet size: 0 but there are 6 bytes in it.
Well, this is how silkroad builts the packets(the header is always 6 bytes big, the green marked)
Code:
struct TPacket
{
[COLOR="Lime"] public ushort size;
public ushort opcode;
public byte securityCount;
public byte securityCRC;[/COLOR]
public fixed byte [COLOR="Red"]data[/COLOR][8096];
}
Code:
short psize = reader.readWord();
this size is not the packet size, its the size of the data.
if you add +6 you add the size of the header, too.so your 4th packet has just no data in it.
Well, this is how silkroad builts the packets(the header is always 6 bytes big, the green marked)
Code:
struct TPacket
{
[COLOR="Lime"] public ushort size;
public ushort opcode;
public byte securityCount;
public byte securityCRC;[/COLOR]
public fixed byte [COLOR="Red"]data[/COLOR][8096];
}
Code:
short psize = reader.readWord();
this size is not the packet size, its the size of the data.
if you add +6 you add the size of the header, too.so your 4th packet has just no data in it.
Thanks for explaining I get it now.
I still the problem with the reading I think it's just a problem with the reader itself so I'll make my own one too see if that works.
Reader for SRO is kinda easy.
Well, it is in C#. You just inherit the BinaryReader class and you override some functions. (like string reading)
I saw it in csremu but i'm using c++ so it's a bit more difficult:P btw when i print my packet like data[3],data[2] I get the right opcodes so it is a reading problem and not a prolbem with the data. I'll tell you guys if I got it working correctly but tips ect. are always welcome
I think C# coding much easier than C++
You can understand things more
You can read the last source files that Xsense uploaded
here
If you read and understand you can get much things and learn alot
I saw it in csremu but i'm using c++ so it's a bit more difficult:P btw when i print my packet like data[3],data[2] I get the right opcodes so it is a reading problem and not a prolbem with the data. I'll tell you guys if I got it working correctly but tips ect. are always welcome
Why don't you take a look at the boost library?
AFAIK, they have functions for reading etc. that are easy to adapt.
@saif1999 I'm using c++ because I don't like c#. And because It's slower with that whole .net framework stuff. but I'll take a look at the source of Xsense's emu.
@lesderid thanks I'll take a look in that library. because I can't figure out why the data isn't correctly readed. The opcode is now correct (I had to change short in unsigned short) but i don't want to use this reader to read the rest of the packet because it's unreliable if a few packets ain't readed the right way.
I saw it in csremu but i'm using c++ so it's a bit more difficult:P btw when i print my packet like data[3],data[2] I get the right opcodes so it is a reading problem and not a prolbem with the data. I'll tell you guys if I got it working correctly but tips ect. are always welcome
You don't need a reader for C++.
Having such a system would be like trying to code Python in C++.
Just take a look . And it's by far worth to read the whole thread... it was one the biggest threads I've seen about private server coding scene.
Hope it helps as it's more related to C++ than C#.
Correct way to do a speedhack. 06/27/2010 - CO2 Programming - 7 Replies Heya,
I was wondering what changed recently? Because in the earlier patches, this could be done the following way;
if (Client.AutoBot != null)
{
data.TimeStamp = client.LastJump + 900;
}
Done from TQServer->Proxy and TQClient->Proxy
Correct me if I'm wrong. 02/05/2010 - General Gaming Discussion - 0 Replies Correct me if I'm wrong, but there aren't any working wonderspeed and zylon trainers now right?
MySro Correct IP 05/18/2009 - SRO Private Server - 1 Replies Guys can someone give me the correct IP for MySro i searched and tryed some but no result...
Thanks in advance.
Pa Correct nmn toh~ 08/18/2008 - RF Online - 9 Replies Sir..pa correct nmn sa makakabasa n2..
ung sinasabi po ng iba na sa Search lng mahahanap ung mga hacks na gusto ko...
san ako mag Search d2 sa forums na toh oh sa iba??
pa correct ^^