Hi, don't know if I'm posting in the right section, but packet and memory editing are a bit common, so.
Actually, I'm facing to a wall since I tried a whole day to extract one or multiples GUIDs from a packet. I found some patterns (this one, is the best I made but can fail %x%xA0%x-040C).
Problem, is that I can't found a pattern totally reliable, you will understand with examples below.
For example, I want to extract item GUIDs from this fake packet :
Code:
6D 32 01 00 00 00 0F A0 6F AD 3E 9C 04 0C 02 00 00 00 0F A0 2E 8B 1A 5C 04 0C
If I apply this pattern, it works without fail :
Code:
for guid in string.gmatch(UnsplitBytes(data), "%x%xA0%x-040C") do
print(guid);
end
-- Output : 0F A0 6F AD 3E 9C 04 0C - 0F A0 2E 8B 1A 5C 04 0C
But with those packet, it fails :
Code:
6D 32 00 00 A0 02 00 00 0F A0 6F AD 3E 9C 04 0C 00 00 00 00 00 00 0F A0 2E 8B 1A 5C 04 0C
6D 32 00 00 0A 06 00 00 0F A0 6F AD 3E 9C 04 0C 00 00 00 00 00 00 0F A0 2E 8B 1A 5C 04 0C
Code:
for guid in string.gmatch(UnsplitBytes(data), "%x%xA0%x-040C") do
print(guid);
end
-- Output : 00 A0 02 00 00 0F A0 6F AD 3E 9C 04 0C - 0F A0 2E 8B 1A 5C 04 0C
-- Output : 0 0A 02 00 00 0F A0 6F AD 3E 9C 04 0C - 0F A0 2E 8B 1A 5C 04 0C
Note : I remove all spaces between each bytes before apply the pattern.
So, I can't find how to handle this problem.
Thanks for any help.
GUID structure (simplified) for whos don't know (don't know if in memory, this is the same) :
Code:
AA BB XX (CC) 04 DD
AA = GUID length (also named GUID Low Mask).
01 for 1 byte
03 for 2 bytes
07 for 3 bytes
0F for 4 bytes
...
BB = ID length (also named GUID High Mask).
A0 if no ID
A1 for 1 byte
A3 for 2 bytes
A7 for 3 bytes
...
XX = Object GUID
CC = Object ID (some objects don't require their ID in their GUID, like Items or Players).
04 = Constant, doesn't change.
DD = Object Type ID (Item, GameObject, Unit...).
If I take a GUID from my examples above :
[0F] [A0] [2E 8B 1A 5C] [04] [0C]
[2E 8B 1A 5C] = Item GUID (of 4 bytes).
[0F] = because the GUID is 4 bytes.
[A0] = because there is no ID for an item GUID.
[04] = always the same.
[0C] = Item Type ID