summaryrefslogtreecommitdiff
path: root/servergreps/hercules/packets.py
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-06 17:06:24 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-06 17:06:24 +0300
commit8570baefa7d7177a77d8cc0559c9adda85a76661 (patch)
tree853f8dcfa4d5397503605aaab7bb3bb6ef7f33d4 /servergreps/hercules/packets.py
parent7d0cf91b6fd5d17cff33de03695d4689a7eaae65 (diff)
downloadevol-tools-8570baefa7d7177a77d8cc0559c9adda85a76661.tar.gz
evol-tools-8570baefa7d7177a77d8cc0559c9adda85a76661.tar.bz2
evol-tools-8570baefa7d7177a77d8cc0559c9adda85a76661.tar.xz
evol-tools-8570baefa7d7177a77d8cc0559c9adda85a76661.zip
servergreps: add checking for cleint to server packet sizes.
Diffstat (limited to 'servergreps/hercules/packets.py')
-rwxr-xr-xservergreps/hercules/packets.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/servergreps/hercules/packets.py b/servergreps/hercules/packets.py
index c1fa7d8..fd53673 100755
--- a/servergreps/hercules/packets.py
+++ b/servergreps/hercules/packets.py
@@ -112,7 +112,7 @@ def collectManaPlusInPackets(fileName, packetVersion):
packet = int(m.group("packet"), 16)
if packet > 0xb00 or packet == 0:
continue
- clientPacketsManaPlus[m.group("packet").lower()] = m.group("name")
+ clientPacketsManaPlus[m.group("packet").lower()] = (m.group("name"), int(m.group("len")), "nullptr")
sizes[m.group("packet").lower()] = m.group("len")
def collectManaPlusOutPackets(fileName, packetVersion):
@@ -131,8 +131,8 @@ def collectManaPlusOutPackets(fileName, packetVersion):
packet = int(m.group("packet"), 16)
if packet > 0xb00 or packet == 0:
continue
- clientPacketsManaPlus[m.group("packet").lower()] = m.group("name")
- clientPacketsManaPlusClient[m.group("packet").lower()] = m.group("name")
+ clientPacketsManaPlus[m.group("packet").lower()] = (m.group("name"), int(m.group("len")), m.group("function"))
+ clientPacketsManaPlusClient[m.group("packet").lower()] = (m.group("name"), int(m.group("len")), m.group("function"))
def collectClientPackets(fileName):
with open(fileName, "r") as f:
@@ -208,7 +208,7 @@ def printPackets(packetDir):
while data[0] == "0":
data = data[1:]
if packet in clientPacketsManaPlus:
- clientName = clientPacketsManaPlus[packet]
+ clientName = clientPacketsManaPlus[packet][0]
# if clientName not in manaplusUsedPacketsSet and clientName.find("_OUTDATED") <= 0:
# w.write("UNIMPLIMENTED ")
w.write(data + " client name: " + clientName)
@@ -235,7 +235,7 @@ def printPackets(packetDir):
with open(packetDir + "/clientpackets.txt", "w") as w:
for packet in clientPacketsManaPlusClient:
- clientName = clientPacketsManaPlusClient[packet]
+ clientName = clientPacketsManaPlusClient[packet][0]
if clientName not in manaplusUsedPacketsSet and clientName.find("_OUTDATED") <= 0:
w.write("PSESENT BUT UNIMPLIMENTED {0}\n".format(clientName))
@@ -265,10 +265,20 @@ def printPackets(packetDir):
rev.append("{0:4} {1:33} {2}".format("?", "UNIMPLIMENTED", packet))
# rev.append("{0:4} {1:>4} {2} UNIMPLIMENTED".format(packet, clientPackets[packet][0], clientPackets[packet][1]))
+ for packet in clientPacketsManaPlusClient:
+ if packet in clientPackets and clientPacketsManaPlusClient[packet][1] != clientPackets[packet][0]:
+ packet1 = clientPacketsManaPlusClient[packet]
+ packet2 = clientPackets[packet]
+ rev.append("WRONG SIZE {0:4} {1:33} {2:35} {3:4} vs {4:4}".format(packet,
+ packet1[0],
+ packet2[1],
+ packet1[1],
+ packet2[0]))
+
for packet in allPackets:
if packet not in clientPacketsManaPlusClient:
continue
- data = "{0:4} {1:33} ".format(packet, clientPacketsManaPlusClient[packet])
+ data = "{0:4} {1:33} ".format(packet, clientPacketsManaPlusClient[packet][0])
if packet in clientPackets:
data = data + clientPackets[packet][1]
else: