summaryrefslogtreecommitdiff
path: root/servergreps
diff options
context:
space:
mode:
Diffstat (limited to 'servergreps')
-rwxr-xr-xservergreps/hercules/src/brathena.py14
-rwxr-xr-xservergreps/hercules/src/hercules.py14
-rwxr-xr-xservergreps/hercules/src/idathena.py14
-rwxr-xr-xservergreps/hercules/src/manaplus.py2
-rwxr-xr-xservergreps/hercules/src/ragemu.py14
-rwxr-xr-xservergreps/hercules/src/rathena.py14
-rwxr-xr-xservergreps/hercules/src/reporter.py18
-rwxr-xr-xservergreps/hercules/src/threeceam.py14
8 files changed, 102 insertions, 2 deletions
diff --git a/servergreps/hercules/src/brathena.py b/servergreps/hercules/src/brathena.py
index 2ef51a2..f9dfb38 100755
--- a/servergreps/hercules/src/brathena.py
+++ b/servergreps/hercules/src/brathena.py
@@ -31,6 +31,9 @@ class Brathena:
"(WFIFOW|WBUFW)([ ]*)[(]([ ]*)([\w>_-]+),([ ]*)" +
"(?P<offset>0)([ ]*)[)]([ ]*)=([ ]*)(?P<packet>[0-9\w]+)([ ]*)[;]")
ourPacketre4 = re.compile("int cmd([ ]*)=([ ]*)0x(?P<packet>[0-9a-fA-F]+);")
+ ourPacketre5 = re.compile(
+ "(WFIFOW|WBUFW)([ ]*)[(]([ ]*)([\w>_-]+),([ ]*)" +
+ "(count[*]p_len)([ ]*)[)]([ ]*)=([ ]*)(?P<packet>[0-9\w]+)([ ]*)[;]")
outPacketLoginre = re.compile(
"([ ]*)PACKET_ID_(?P<name>[A-Z0-9_]+)([ ]*)=" +
"([ ]*)0x(?P<packet>[0-9a-fA-F]+),")
@@ -62,6 +65,10 @@ class Brathena:
return
self.packetsSet.add(val)
else:
+ if len(data) > 2 and data[:2] == "0x":
+ data = data[2:]
+ while len(data) < 4:
+ data = "0" + data
try:
if int(data, 16) > 4096:
return
@@ -89,6 +96,13 @@ class Brathena:
while len(data) < 4:
data = "0" + data
self.addServerPacket(data)
+ m = self.ourPacketre5.findall(line)
+ if len(m) > 0:
+ for str in m:
+ data = str[9]
+ while len(data) < 4:
+ data = "0" + data
+ self.addServerPacket(data)
m = self.outPacketLoginre.findall(line)
if len(m) > 0:
for str in m:
diff --git a/servergreps/hercules/src/hercules.py b/servergreps/hercules/src/hercules.py
index 7c1b230..d069005 100755
--- a/servergreps/hercules/src/hercules.py
+++ b/servergreps/hercules/src/hercules.py
@@ -33,6 +33,9 @@ class Hercules:
"(WFIFOW|WBUFW)([ ]*)[(]([ ]*)([\w>_-]+),([ ]*)" +
"(?P<offset>0)([ ]*)[)]([ ]*)=([ ]*)(?P<packet>[0-9\w]+)([ ]*)[;]")
ourPacketre4 = re.compile("int cmd([ ]*)=([ ]*)0x(?P<packet>[0-9a-fA-F]+);")
+ ourPacketre5 = re.compile(
+ "(WFIFOW|WBUFW)([ ]*)[(]([ ]*)([\w>_-]+),([ ]*)" +
+ "(count[*]p_len)([ ]*)[)]([ ]*)=([ ]*)(?P<packet>[0-9\w]+)([ ]*)[;]")
outPacketLoginre = re.compile(
"([ ]*)PACKET_ID_(?P<name>[A-Z0-9_]+)([ ]*)=" +
"([ ]*)0x(?P<packet>[0-9a-fA-F]+),")
@@ -69,6 +72,10 @@ class Hercules:
return
self.packetsSet.add(val)
else:
+ if len(data) > 2 and data[:2] == "0x":
+ data = data[2:]
+ while len(data) < 4:
+ data = "0" + data
try:
if int(data, 16) > 4096:
return
@@ -96,6 +103,13 @@ class Hercules:
while len(data) < 4:
data = "0" + data
self.addServerPacket(data)
+ m = self.ourPacketre5.findall(line)
+ if len(m) > 0:
+ for str in m:
+ data = str[9]
+ while len(data) < 4:
+ data = "0" + data
+ self.addServerPacket(data)
m = self.outPacketLoginre.findall(line)
if len(m) > 0:
for str in m:
diff --git a/servergreps/hercules/src/idathena.py b/servergreps/hercules/src/idathena.py
index f8c046f..298d2ca 100755
--- a/servergreps/hercules/src/idathena.py
+++ b/servergreps/hercules/src/idathena.py
@@ -32,6 +32,9 @@ class Idathena:
"(?P<offset>0)([ ]*)[)]([ ]*)=([ ]*)(?P<packet>[0-9\w]+)([ ]*)[;]")
ourPacketre4 = re.compile("int cmd([ ]*)=([ ]*)0x(?P<packet>[0-9a-fA-F]+);")
ourPacketre5 = re.compile("int cmde([ ]*)=([ ]*)0x(?P<packet>[0-9a-fA-F]+);")
+ ourPacketre6 = re.compile(
+ "(WFIFOW|WBUFW)([ ]*)[(]([ ]*)([\w>_-]+),([ ]*)" +
+ "(count[*]p_len)([ ]*)[)]([ ]*)=([ ]*)(?P<packet>[0-9\w]+)([ ]*)[;]")
outPacketLoginre = re.compile(
"([ ]*)PACKET_ID_(?P<name>[A-Z0-9_]+)([ ]*)=" +
"([ ]*)0x(?P<packet>[0-9a-fA-F]+),")
@@ -65,6 +68,10 @@ class Idathena:
return
self.packetsSet.add(val)
else:
+ if len(data) > 2 and data[:2] == "0x":
+ data = data[2:]
+ while len(data) < 4:
+ data = "0" + data
try:
if int(data, 16) > 4096:
return
@@ -99,6 +106,13 @@ class Idathena:
while len(data) < 4:
data = "0" + data
self.addServerPacket(data)
+ m = self.ourPacketre6.findall(line)
+ if len(m) > 0:
+ for str in m:
+ data = str[9]
+ while len(data) < 4:
+ data = "0" + data
+ self.addServerPacket(data)
m = self.outPacketLoginre.findall(line)
if len(m) > 0:
for str in m:
diff --git a/servergreps/hercules/src/manaplus.py b/servergreps/hercules/src/manaplus.py
index 56fd11c..5a52e1b 100755
--- a/servergreps/hercules/src/manaplus.py
+++ b/servergreps/hercules/src/manaplus.py
@@ -40,7 +40,7 @@ class ManaPlus:
continue
self.inPackets[m.group("packet").lower()] = \
(m.group("name"), int(m.group("len")), "nullptr")
- self.sizes[m.group("packet").lower()] = m.group("len")
+ self.sizes[m.group("packet").lower()] = int(m.group("len"))
def collectOutPackets(self, fileName, packetVersion):
diff --git a/servergreps/hercules/src/ragemu.py b/servergreps/hercules/src/ragemu.py
index 90dbf35..47811a4 100755
--- a/servergreps/hercules/src/ragemu.py
+++ b/servergreps/hercules/src/ragemu.py
@@ -31,6 +31,9 @@ class Ragemu:
"(WFIFOW|WBUFW)([ ]*)[(]([ ]*)([\w>_-]+),([ ]*)" +
"(?P<offset>0)([ ]*)[)]([ ]*)=([ ]*)(?P<packet>[0-9\w]+)([ ]*)[;]")
ourPacketre4 = re.compile("int cmd([ ]*)=([ ]*)0x(?P<packet>[0-9a-fA-F]+);")
+ ourPacketre5 = re.compile(
+ "(WFIFOW|WBUFW)([ ]*)[(]([ ]*)([\w>_-]+),([ ]*)" +
+ "(count[*]p_len)([ ]*)[)]([ ]*)=([ ]*)(?P<packet>[0-9\w]+)([ ]*)[;]")
outPacketLoginre = re.compile(
"([ ]*)PACKET_ID_(?P<name>[A-Z0-9_]+)([ ]*)=" +
"([ ]*)0x(?P<packet>[0-9a-fA-F]+),")
@@ -62,6 +65,10 @@ class Ragemu:
return
self.packetsSet.add(val)
else:
+ if len(data) > 2 and data[:2] == "0x":
+ data = data[2:]
+ while len(data) < 4:
+ data = "0" + data
try:
if int(data, 16) > 4096:
return
@@ -89,6 +96,13 @@ class Ragemu:
while len(data) < 4:
data = "0" + data
self.addServerPacket(data)
+ m = self.ourPacketre5.findall(line)
+ if len(m) > 0:
+ for str in m:
+ data = str[9]
+ while len(data) < 4:
+ data = "0" + data
+ self.addServerPacket(data)
m = self.outPacketLoginre.findall(line)
if len(m) > 0:
for str in m:
diff --git a/servergreps/hercules/src/rathena.py b/servergreps/hercules/src/rathena.py
index ec71d5b..1a0718b 100755
--- a/servergreps/hercules/src/rathena.py
+++ b/servergreps/hercules/src/rathena.py
@@ -32,6 +32,9 @@ class Rathena:
"(?P<offset>0)([ ]*)[)]([ ]*)=([ ]*)(?P<packet>[0-9\w]+)([ ]*)[;]")
ourPacketre4 = re.compile("int cmd([ ]*)=([ ]*)0x(?P<packet>[0-9a-fA-F]+);")
ourPacketre5 = re.compile("int cmde([ ]*)=([ ]*)0x(?P<packet>[0-9a-fA-F]+);")
+ ourPacketre6 = re.compile(
+ "(WFIFOW|WBUFW)([ ]*)[(]([ ]*)([\w>_-]+),([ ]*)" +
+ "(count[*]p_len)([ ]*)[)]([ ]*)=([ ]*)(?P<packet>[0-9\w]+)([ ]*)[;]")
outPacketLoginre = re.compile(
"([ ]*)PACKET_ID_(?P<name>[A-Z0-9_]+)([ ]*)=" +
"([ ]*)0x(?P<packet>[0-9a-fA-F]+),")
@@ -65,6 +68,10 @@ class Rathena:
return
self.packetsSet.add(val)
else:
+ if len(data) > 2 and data[:2] == "0x":
+ data = data[2:]
+ while len(data) < 4:
+ data = "0" + data
try:
if int(data, 16) > 4096:
return
@@ -99,6 +106,13 @@ class Rathena:
while len(data) < 4:
data = "0" + data
self.addServerPacket(data)
+ m = self.ourPacketre6.findall(line)
+ if len(m) > 0:
+ for str in m:
+ data = str[9]
+ while len(data) < 4:
+ data = "0" + data
+ self.addServerPacket(data)
m = self.outPacketLoginre.findall(line)
if len(m) > 0:
for str in m:
diff --git a/servergreps/hercules/src/reporter.py b/servergreps/hercules/src/reporter.py
index 1bfc116..a073975 100755
--- a/servergreps/hercules/src/reporter.py
+++ b/servergreps/hercules/src/reporter.py
@@ -89,7 +89,7 @@ class Reporter:
w.write("\n")
rev = []
- with open(self.packetDir + "/client_wrongpacketsizes.txt", "w") as w:
+ with open(self.packetDir + "/client_wrongoutpacketsizes.txt", "w") as w:
for name in manaplus.outMsgNameToId:
packet = manaplus.outMsgNameToId[name]
# for packet in manaplus.outPackets:
@@ -179,6 +179,22 @@ class Reporter:
w.write(data)
w.write("\n")
+ with open(self.packetDir + "/client_wronginpacketsizes.txt", "w") as w:
+ for packet in hercules.getLenPackets:
+ if packet in manaplus.sizes:
+ if hercules.knownLenPackets[packet] != manaplus.sizes[packet]:
+ w.write("{0:4} client={1:4} vs server={2:4}\n".format(
+ packet,
+ manaplus.sizes[packet],
+ hercules.knownLenPackets[packet]))
+ else:
+ if packet in hercules.knownLenPackets:
+ w.write("{0:4} client=missing vs server={1:4}\n".format(
+ packet,
+ hercules.knownLenPackets[packet]))
+ else:
+ w.write("{0:4} client=missing vs server=missing\n".format(
+ packet))
def reportHercules(self, hercules):
with open(self.packetDir + "/" + hercules.reportName + "_issues.txt", "w") as w:
diff --git a/servergreps/hercules/src/threeceam.py b/servergreps/hercules/src/threeceam.py
index 7d4c73d..3639f47 100755
--- a/servergreps/hercules/src/threeceam.py
+++ b/servergreps/hercules/src/threeceam.py
@@ -33,6 +33,9 @@ class Threeceam:
ourPacketre4 = re.compile("int cmd([ ]*)=([ ]*)0x(?P<packet>[0-9a-fA-F]+);")
ourPacketre5 = re.compile("int cmde([ ]*)=([ ]*)0x(?P<packet>[0-9a-fA-F]+);")
ourPacketre6 = re.compile(" (packet|packet_num|PacketType|packet_type)([ ]*)=([ ]*)0x(?P<packet>[0-9a-fA-F]+);")
+ ourPacketre7 = re.compile(
+ "(WFIFOW|WBUFW)([ ]*)[(]([ ]*)([\w>_-]+),([ ]*)" +
+ "(count[*]p_len)([ ]*)[)]([ ]*)=([ ]*)(?P<packet>[0-9\w]+)([ ]*)[;]")
outPacketLoginre = re.compile(
"([ ]*)PACKET_ID_(?P<name>[A-Z0-9_]+)([ ]*)=" +
"([ ]*)0x(?P<packet>[0-9a-fA-F]+),")
@@ -66,6 +69,10 @@ class Threeceam:
return
self.packetsSet.add(val)
else:
+ if len(data) > 2 and data[:2] == "0x":
+ data = data[2:]
+ while len(data) < 4:
+ data = "0" + data
try:
if int(data, 16) > 4096:
return
@@ -107,6 +114,13 @@ class Threeceam:
while len(data) < 4:
data = "0" + data
self.addServerPacket(data)
+ m = self.ourPacketre7.findall(line)
+ if len(m) > 0:
+ for str in m:
+ data = str[9]
+ while len(data) < 4:
+ data = "0" + data
+ self.addServerPacket(data)
m = self.outPacketLoginre.findall(line)
if len(m) > 0:
for str in m: