diff options
Diffstat (limited to 'servergreps/hercules/src')
-rwxr-xr-x | servergreps/hercules/src/brathena.py | 2 | ||||
-rwxr-xr-x | servergreps/hercules/src/hercules.py | 2 | ||||
-rwxr-xr-x | servergreps/hercules/src/idathena.py | 2 | ||||
-rwxr-xr-x | servergreps/hercules/src/ragemu.py | 2 | ||||
-rwxr-xr-x | servergreps/hercules/src/rathena.py | 2 | ||||
-rwxr-xr-x | servergreps/hercules/src/reporter.py | 26 | ||||
-rwxr-xr-x | servergreps/hercules/src/server.py | 57 | ||||
-rwxr-xr-x | servergreps/hercules/src/threeceam.py | 2 |
8 files changed, 95 insertions, 0 deletions
diff --git a/servergreps/hercules/src/brathena.py b/servergreps/hercules/src/brathena.py index f9dfb38..efc6b80 100755 --- a/servergreps/hercules/src/brathena.py +++ b/servergreps/hercules/src/brathena.py @@ -59,6 +59,8 @@ class Brathena: def addServerPacket(self, data): + if data == "000j": + return if data in self.namedPackets: for val in self.namedPackets[data]: if int(val, 16) > 4096: diff --git a/servergreps/hercules/src/hercules.py b/servergreps/hercules/src/hercules.py index d069005..f9999b1 100755 --- a/servergreps/hercules/src/hercules.py +++ b/servergreps/hercules/src/hercules.py @@ -66,6 +66,8 @@ class Hercules: def addServerPacket(self, data): + if data == "000j": + return if data in self.namedPackets: for val in self.namedPackets[data]: if int(val, 16) > 4096: diff --git a/servergreps/hercules/src/idathena.py b/servergreps/hercules/src/idathena.py index 298d2ca..96825e6 100755 --- a/servergreps/hercules/src/idathena.py +++ b/servergreps/hercules/src/idathena.py @@ -60,6 +60,8 @@ class Idathena: def addServerPacket(self, data): + if data == "000j": + return if data == "cmde": return if data in self.namedPackets: diff --git a/servergreps/hercules/src/ragemu.py b/servergreps/hercules/src/ragemu.py index 47811a4..020d47c 100755 --- a/servergreps/hercules/src/ragemu.py +++ b/servergreps/hercules/src/ragemu.py @@ -59,6 +59,8 @@ class Ragemu: def addServerPacket(self, data): + if data == "000j": + return if data in self.namedPackets: for val in self.namedPackets[data]: if int(val, 16) > 4096: diff --git a/servergreps/hercules/src/rathena.py b/servergreps/hercules/src/rathena.py index 1a0718b..c6019a4 100755 --- a/servergreps/hercules/src/rathena.py +++ b/servergreps/hercules/src/rathena.py @@ -60,6 +60,8 @@ class Rathena: def addServerPacket(self, data): + if data == "000j": + return if data == "cmde": return if data in self.namedPackets: diff --git a/servergreps/hercules/src/reporter.py b/servergreps/hercules/src/reporter.py index a073975..af05a65 100755 --- a/servergreps/hercules/src/reporter.py +++ b/servergreps/hercules/src/reporter.py @@ -254,3 +254,29 @@ class Reporter: for packet in idathena.outPacketsSorted: if packet not in hercules.packetsSet: w.write("Exists only in idAthena: " + packet + "\n") + + def reportServer(self, hercules, server): + with open(self.packetDir + "/" + hercules.reportName + "_" + server.dirName + "_outpackets.txt", "w") as w: + for packet in server.outPacketsSorted: + if packet not in hercules.outPacketsSorted: + w.write("Exists only in " + server.dirName + ": " + packet + "\n") + with open(self.packetDir + "/" + hercules.reportName + "_" + server.dirName + "_inpackets.txt", "w") as w: + for packet in server.inPacketsSorted: + if packet not in hercules.inPacketsSorted: + w.write("Exists only in " + server.dirName + ": " + packet + "\n") + with open(self.packetDir + "/" + server.dirName + "_" + hercules.reportName + "_outpackets.txt", "w") as w: + fail = False + for packet in hercules.outPacketsSorted: + if packet not in server.outPackets: + fail = True + w.write("Exists only in Hercules: " + packet + "\n"); + if fail == False: + w.write("Server include all hercules packets\n") + with open(self.packetDir + "/" + server.dirName + "_" + hercules.reportName + "_inpackets.txt", "w") as w: + fail = False + for packet in hercules.inPacketsSorted: + if packet not in server.inPackets: + fail = True + w.write("Exists only in Hercules: " + packet + "\n"); + if fail == False: + w.write("Server include all hercules packets\n") diff --git a/servergreps/hercules/src/server.py b/servergreps/hercules/src/server.py new file mode 100755 index 0000000..c70d411 --- /dev/null +++ b/servergreps/hercules/src/server.py @@ -0,0 +1,57 @@ +#! /usr/bin/env python2 +# -*- coding: utf8 -*- +# +# Copyright (C) 2015-2016 Evol Online +# Author: Andrei Karas (4144) + +import os +import re + +class Server: + packetre = re.compile( + "([ ]*)HEADER_(?P<type>[A-Z][A-Z])_(?P<name>[A-Z0-9_]+)([ ]*)=" + + "([ ]*)0x(?P<packet>[0-9a-fA-F]+),") + + def __init__(self): + self.outPackets = set() + self.inPackets = set() + self.outPacketsSorted = [] + self.inPacketsSorted = [] + self.idToName = dict() + + def collectPackets(self): + with open("../links/" + self.dirName + "/packets.txt", "r") as f: + for line in f: + m = self.packetre.search(line) + if m is not None: + data = m.group("packet").lower() + packetType = m.group("type") + partName = m.group("name") + if len(data) > 2 and data[:2] == "0x": + data = data[2:] + while len(data) < 4: + data = "0" + data + if packetType in ("CA", "CH", "CZ"): + self.inPackets.add(data) + if packetType in ("AC", "HC", "ZC"): + self.outPackets.add(data) + self.idToName[data] = "HEADER_{0}_{1}".format(packetType, partName) + + + def sortOutPackets(self): + for packet in self.outPackets: + self.outPacketsSorted.append(packet) + self.outPacketsSorted.sort() + + + def sortInPackets(self): + for packet in self.inPackets: + self.inPacketsSorted.append(packet) + self.inPacketsSorted.sort() + + + def processPackets(self, dirName): + self.dirName = dirName + self.collectPackets() + self.sortInPackets() + self.sortOutPackets() diff --git a/servergreps/hercules/src/threeceam.py b/servergreps/hercules/src/threeceam.py index 3639f47..bf45ed4 100755 --- a/servergreps/hercules/src/threeceam.py +++ b/servergreps/hercules/src/threeceam.py @@ -61,6 +61,8 @@ class Threeceam: def addServerPacket(self, data): + if data == "000j": + return if data == "cmde" or data == "packet" or data == "PacketType" or data == "packet_type" or data == "packet_num": return if data in self.namedPackets: |