Page 3 of 5

Re: Packets: Reading and Understanding

Posted: Fri Jan 23, 2009 4:18 pm
by John Adams
Ok, I wasn't sure if we needed to make fields for size_ratio and size_multiplier_ratio in the server DB. If not, great. :D

Regarding "not like live", because I parsed and loaded the data for Timorous Deep, went and stood next to the NPCs in the newbie area, and logged into live. Not one of them matched, wearing the same outfit, or the right model/color exactly. That is what started this whole thing, man. I did a 1:1 comparison with my very own eyes - my data to Live, and it was not a match.

Weeks later, I just don't really care anymore if a sarnak merchant is wearing a blue vest in live and a pink one in Emu.

Re: Packets: Reading and Understanding

Posted: Fri Jan 23, 2009 4:20 pm
by LethalEncounter
Yah the colors were off because the green/blue values were swapped, but everything else should be fine. If not please let me know and I'll take a look at it.

Re: Packets: Reading and Understanding

Posted: Fri Jan 23, 2009 4:26 pm
by John Adams
Well shit, is that all that was? I seriously need a nice solid wall to bang my head against. ;)

I will give the Spawns another pop and take a look this weekend. I am trying to bash this Structs stuff firmly into my brain before I forget... cuz, you know how I am. :/

Thanks for all the explanations heh. Someday we can make a wiki article out of it all :shock:

Re: Packets: Reading and Understanding

Posted: Sat Jan 24, 2009 11:45 pm
by Zcoretri
When unpacking, do you have to put the whole packet into the array? or can it just be part of the packet?

Re: Packets: Reading and Understanding

Posted: Sun Jan 25, 2009 12:00 am
by Bion
The whole thing but not the date time and all that just all the hex codes under that. if you still need a way to strip the hex codes and put commas in and the 0x's you can use this script i wrote in autoit :)

Run it and copy your packet TO YOUR WINDOWS CLIPBOARD and hit F6, then paste it FROM YOUR WINDOWS CLIPBOARD where you want it.
http://www.box.net/shared/s5tcm0g6yh when you want to exit the program just hit f4 basically it runs in the background it also puts a icon in your tray when it is running so you can pause it or exit it from there.

you can use the exe or download autoit and run the script it is all in there.

edit: bion ---changed post to be more clear as to where to copy to and paste from. thanks Zcoretri

Re: Packets: Reading and Understanding

Posted: Sun Jan 25, 2009 1:46 pm
by Zcoretri
Bion wrote:The whole thing but not the date time and all that just all the hex codes under that. if you still need a way to strip the hex codes and put commas in and the 0x's you can use this script i wrote in autoit :) run it and copy your packet and hit F6 then paste it where you want it.http://www.box.net/shared/s5tcm0g6yh when you want to exit the program just hit f4 basically it runs in the background it also puts a icon in your tray when it is running so you can pause it or exit it from there.

you can use the exe or download autoit and run the script it is all in there.
Instructions here are kinda vague Bion. Where am I supposed to paste my packet? One of the supplied files? a new file?
More info please.

Re: Packets: Reading and Understanding

Posted: Sun Jan 25, 2009 1:54 pm
by Bion
oh no that script just preps the packet so you can paste it into the array you are making. LE talked about that on the first page

Re: Packets: Reading and Understanding

Posted: Sun Jan 25, 2009 2:18 pm
by Zcoretri
HUH?

What I'm asking is what do I do with this

Code: Select all

0000:	01 EC 63 00 00 00 09 00 00 00 00 00 00 00 00 00 ..c.............
0010:	00 00 01 00 00 00 91 00 3A 01 01 00 00 00 3E D4 ........:.....>.
0020:	EF C1 D7 FF 3A 2C 00 00 00 00 09 00 00 00 00 00 ....:,..........
to get this

Code: Select all

0x01, 0xEC, 0x63, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
,0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x91, 0x00, 0x3A, 0x01, 0x01, 0x00, 0x00, 0x00, 0x3E, 0xD4
,0xEF, 0xC1, 0xD7, 0xFF, 0x3A, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00
with the items you provided

Re: Packets: Reading and Understanding

Posted: Sun Jan 25, 2009 2:41 pm
by Bion
you can either run the exe I provided when it runs you will see it in the taskbar tray

find a packet you want to unpack like what you posted

Code: Select all

0000:   01 EC 63 00 00 00 09 00 00 00 00 00 00 00 00 00 ..c.............
0010:   00 00 01 00 00 00 91 00 3A 01 01 00 00 00 3E D4 ........:.....>.
0020:   EF C1 D7 FF 3A 2C 00 00 00 00 09 00 00 00 00 00 ....:,..........
once it is copied and is in your clipboard hit F6

then you can paste it like

Code: Select all

0x01,0xEC,0x63,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x91,0x00,0x3A,0x01,0x01,0x00,0x00,0x00,0x3E,0xD4,0xEF,0xC1,0xD7,0xFF,0x3A,0x2C,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x00,0x00
you can do this as long as it is running just copy and hit f6 and then you can paste it where you need to. you can hit F4 to exit the program or exit it from the tray.
there are also the source there so you can download the autoit software and compile it with that if you want.

Re: Packets: Reading and Understanding

Posted: Sun Jan 25, 2009 2:56 pm
by Zcoretri
Bion wrote:The whole thing but not the date time and all that, just all the hex codes under that. If you still need a way to strip the hex codes and put commas in and the 0x's you can use this script I wrote in autoit. Run it and copy your packet TO YOUR WINDOWS CLIPBOARD and hit F6, then paste it FROM YOUR WINDOWS CLIPBOARD where you want it. http://www.box.net/shared/s5tcm0g6yh
When you want to exit the program, just hit f4. Basically it runs in the background it also puts a icon in your tray when it is running so you can pause it or exit it from there.

You can use the exe or download autoit and run the script it is all in there.
Thanks Bion, that's all i was looking for...edited your quote that will serve as instructions for this.

Re: Packets: Reading and Understanding

Posted: Sun Jan 25, 2009 4:54 pm
by Zcoretri
Bion...the first byte gets stripped from the final output. Just something i've noticed

Re: Packets: Reading and Understanding

Posted: Sun Jan 25, 2009 5:10 pm
by Bion
are you copying the whole thing? The regexp is looking for a space then the 2 hex codes if there is no space then it will not pick it up

Code: Select all

0000:	00 09 00 00 A9 7D 00 01 00 00 00 11 41 75 54 33 .....}......AuT3
0010	66 4B 58 37 67 41 34 45 48 57 69 67 00 00 00    fKX7gA4EHWig...

Code: Select all

0x00,0x09,0x00,0x00,0xA9,0x7D,0x00,0x01,0x00,0x00,0x00,0x11,0x41,0x75,0x54,0x33,0x66,0x4B,0x58,0x37,0x67,0x41,0x34,0x45,0x48,0x57,0x69,0x67,0x00,0x00,0x00

Re: Packets: Reading and Understanding

Posted: Sun Jan 25, 2009 5:16 pm
by Zcoretri
must have been missing the space

Re: Packets: Reading and Understanding

Posted: Thu Jan 29, 2009 5:56 pm
by John Adams
Ok, I have given this my best shot, and I'm still not seeing it... sorry, but I need some help.

Certain items are being set with a skill_id_req/req2 = 4294967295 (FF FF FF FF). I tried over and over to get the packet unpacked so I can see what those values really are (if the max int32 is incorrect), but I keep coming up with crap.

Here is the raw packet for one of the items.

Code: Select all

-- OP_ClientCmdMsg::OP_EqInstructionWindowCmd --
12/7/2008 22:17:35
199.108.11.41 -> 192.168.0.3
0000:	01 37 E5 00 00 00 FF 27 02 00 00 00 00 FE 24 00 .7.....'......$.
0010:	00 00 00 00 FF FF FF FF FF FF FF FF 00 00 00 00 ................
0020:	00 00 8D CB 00 00 6B 6C 70 15 95 E8 4A 36 74 9B ......klp...J6t.
0030:	DD 1E 92 01 02 68 00 00 00 00 00 00 00 00 00 00 .....h..........
0040:	00 00 00 00 00 00 00 00 00 00 00 00 64 14 00 00 ............d...
0050:	00 FF FF FF FF FF FF FF FF 00 00 00 03 00 00 00 ................
0060:	05 0C 0A 00 00 02 12 42 69 6C 65 20 45 6E 74 77 .......Bile Entw
0070:	69 6E 65 64 20 54 6F 6D 65 18 54 69 6E 6B 65 72 ined Tome.Tinker
0080:	65 64 20 4E 65 63 6B 20 48 65 61 74 65 72 61 74 ed Neck Heaterat
0090:	6F 72 00 00 D8 66 9B 6D B6 FB 7F 00 14 00 01 00 or...f.m........
00A0:	00 00 00 00 00 00 00 00 00 00 0F 53 74 75 72 64 ...........Sturd
00B0:	79 20 42 61 63 6B 70 61 63 6B 2F 00 41 20 62 61 y Backpack/.A ba
00C0:	63 6B 70 61 63 6B 20 70 72 6F 76 69 64 65 64 20 ckpack provided 
00D0:	74 6F 20 6D 65 20 74 6F 20 62 65 67 69 6E 20 6D to me to begin m
00E0	79 20 74 72 61 69 6E 69 6E 67 2E                y training.
I turned it into the uchar blah[] as instructed:

Code: Select all

uchar blah[] = {0x01,0x37,0xE5,0x00,0x00,0x00,0xFF,0x27,0x02,0x00,0x00,0x00,0x00,0xFE,0x24,0x00
,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00
,0x00,0x00,0x8D,0xCB,0x00,0x00,0x6B,0x6C,0x70,0x15,0x95,0xE8,0x4A,0x36,0x74,0x9B
,0xDD,0x1E,0x92,0x01,0x02,0x68,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x14,0x00,0x00
,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x03,0x00,0x00,0x00
,0x05,0x0C,0x0A,0x00,0x00,0x02,0x12,0x42,0x69,0x6C,0x65,0x20,0x45,0x6E,0x74,0x77
,0x69,0x6E,0x65,0x64,0x20,0x54,0x6F,0x6D,0x65,0x18,0x54,0x69,0x6E,0x6B,0x65,0x72
,0x65,0x64,0x20,0x4E,0x65,0x63,0x6B,0x20,0x48,0x65,0x61,0x74,0x65,0x72,0x61,0x74
,0x6F,0x72,0x00,0x00,0xD8,0x66,0x9B,0x6D,0xB6,0xFB,0x7F,0x00,0x14,0x00,0x01,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x53,0x74,0x75,0x72,0x64
,0x79,0x20,0x42,0x61,0x63,0x6B,0x70,0x61,0x63,0x6B,0x2F,0x00,0x41,0x20,0x62,0x61
,0x63,0x6B,0x70,0x61,0x63,0x6B,0x20,0x70,0x72,0x6F,0x76,0x69,0x64,0x65,0x64,0x20
,0x74,0x6F,0x20,0x6D,0x65,0x20,0x74,0x6F,0x20,0x62,0x65,0x67,0x69,0x6E,0x20,0x6D
,0x79,0x20,0x74,0x72,0x61,0x69,0x6E,0x69,0x6E,0x67,0x2E};
And then ran it through the unpacker:

Code: Select all

uchar* blah2 = new uchar[1000];
Unpack(blah, blah2, 1000, 939);
DumpPacket(blah2, 1000);
and what I got was this:

Code: Select all

   0: 27 02 00 00 00 00 FE 00 - 00 00 00 00 00 00 00 00  | '...............
  16: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
  32: 00 00 00 00 00 00 00 00 - 00 00 00 FF FF FF FF FF  | ................
  48: FF FF CB 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
  64: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
  80: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
  96: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 112: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 128: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 144: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 160: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 176: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 192: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 208: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 224: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 240: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 256: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 272: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 288: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 304: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 320: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 336: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 352: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 368: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 384: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 400: 00 00 00 00 00 E8 00 4A - 00 36 00 00 00 00 00 00  | .......J.6......
 416: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 432: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 448: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 464: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 480: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 496: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 512: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 528: DD 1E 00 92 01 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 544: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 560: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 576: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 592: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 608: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 624: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 640: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 656: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 672: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 688: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 704: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 720: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 736: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 752: 00 00 00 00 00 00 00 00 - 00 FF FF FF FF FF FF FF  | ................
 768: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 784: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 800: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 816: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 832: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 848: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 864: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 880: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 896: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 912: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 928: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 944: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 960: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  | ................
 976: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 CD CD CD  | ................
 992: CD CD CD CD CD CD CD CD                            | ........
Somehow, that doesn't jive.

What am I doing wrong?

Re: Packets: Reading and Understanding

Posted: Fri Jan 30, 2009 1:47 am
by Zcoretri
You have to start the unpack from the point of packed data

Code: Select all

    -- OP_ClientCmdMsg::OP_EqInstructionWindowCmd --
    12/7/2008 22:17:35
    199.108.11.41 -> 192.168.0.3
    0000:   01 37 E5 00 00 00 FF 27 02 00 00 00 00 FE 24 00 .7.....'......$.
    0010:   00 00 00 00 FF FF FF FF FF FF FF FF 00 00 00 00 ................
    0020:   00 00 8D CB 00 00 6B 6C 70 15 95 E8 4A 36 74 9B ......klp...J6t.
    0030:   DD 1E 92 01 02 68 00 00 00 00 00 00 00 00 00 00 .....h..........
    0040:   00 00 00 00 00 00 00 00 00 00 00 00 64 14 00 00 ............d...
    0050:   00 FF FF FF FF FF FF FF FF 00 00 00 03 00 00 00 ................
    0060:   05 0C 0A 00 00 02 12 42 69 6C 65 20 45 6E 74 77 .......Bile Entw
    0070:   69 6E 65 64 20 54 6F 6D 65 18 54 69 6E 6B 65 72 ined Tome.Tinker
    0080:   65 64 20 4E 65 63 6B 20 48 65 61 74 65 72 61 74 ed Neck Heaterat
    0090:   6F 72 00 00 D8 66 9B 6D B6 FB 7F 00 14 00 01 00 or...f.m........
    00A0:   00 00 00 00 00 00 00 00 00 00 0F 53 74 75 72 64 ...........Sturd
    00B0:   79 20 42 61 63 6B 70 61 63 6B 2F 00 41 20 62 61 y Backpack/.A ba
    00C0:   63 6B 70 61 63 6B 20 70 72 6F 76 69 64 65 64 20 ckpack provided
    00D0:   74 6F 20 6D 65 20 74 6F 20 62 65 67 69 6E 20 6D to me to begin m
    00E0   79 20 74 72 61 69 6E 69 6E 67 2E                y training.
In this case:
01 = compressed
37 = OP code for OP_ClientCmdMsg
E5 00 00 00 = packed size
FF = op code is greater than 255
27 02 = OP code for OP_EqInstructionWindowCmd
So I would assume the packed data will start after the op code, but I think it depends on the struct? Still trying to learn this stuff myself :)
What data struct are you using?