summaryrefslogtreecommitdiff
path: root/servergreps/hercules/src/threeceam.py
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-19 18:01:33 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-19 22:52:14 +0300
commit1ec0f534c8f38c605f638282b4432e558106d699 (patch)
treeb068a98f8aac0aada6869d6e3f2ba3835fcd56ee /servergreps/hercules/src/threeceam.py
parent59b06bd0e6054ee42e4fb159b8ef44a50d3fb720 (diff)
downloadevol-tools-1ec0f534c8f38c605f638282b4432e558106d699.tar.gz
evol-tools-1ec0f534c8f38c605f638282b4432e558106d699.tar.bz2
evol-tools-1ec0f534c8f38c605f638282b4432e558106d699.tar.xz
evol-tools-1ec0f534c8f38c605f638282b4432e558106d699.zip
servergreps: move out packet search shared code into utils.
Diffstat (limited to 'servergreps/hercules/src/threeceam.py')
-rwxr-xr-xservergreps/hercules/src/threeceam.py66
1 files changed, 1 insertions, 65 deletions
diff --git a/servergreps/hercules/src/threeceam.py b/servergreps/hercules/src/threeceam.py
index e7b41c4..ad1341d 100755
--- a/servergreps/hercules/src/threeceam.py
+++ b/servergreps/hercules/src/threeceam.py
@@ -25,19 +25,6 @@ class Threeceam:
namedPacketre = re.compile(
"((\t|[ ])*)(?P<name>[\w0-9_]+)([ ]*)=" +
"([ ]*)0x(?P<value>[0-9a-fA-F]+)")
- ourPacketre = re.compile(
- "(WFIFOW|WBUFW)([ ]*)[(]([ ]*)([\w>_-]+),([ ]*)" +
- "(?P<offset>0)([ ]*)[)]([ ]*)=([ ]*)0x(?P<packet>[0-9a-fA-F]+)([ ]*)[;]")
- ourPacketre2 = re.compile("PacketType([ ]*)=([ ]*)(?P<name>[\w_]+);")
- ourPacketre3 = re.compile(
- "(WFIFOW|WBUFW)([ ]*)[(]([ ]*)([\w>_-]+),([ ]*)" +
- "(?P<offset>0)([ ]*)[)]([ ]*)=([ ]*)(?P<packet>[0-9\w]+)([ ]*)[;]")
- ourPacketre4 = re.compile(" 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]+),")
@@ -99,34 +86,7 @@ class Threeceam:
elif filt.search(file1):
with open(file2, "r") as f:
for line in f:
- m = self.ourPacketre4.findall(line)
- if len(m) > 0:
- for str in m:
- data = str[2]
- 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[2]
- 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[3]
- 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)
+ Utils.getOutPackets(line, self)
m = self.outPacketLoginre.findall(line)
if len(m) > 0:
for str in m:
@@ -134,30 +94,6 @@ class Threeceam:
while len(data) < 4:
data = "0" + data
self.loginPacketNameToId["PACKET_ID_" + str[1]] = data
- m = self.ourPacketre.findall(line)
- if len(m) == 0:
- m = self.ourPacketre3.findall(line)
- if len(m) > 0:
- for str in m:
- if str[9] == "0":
- continue
- data = str[9]
- if data == "cmd":
- continue
- while len(data) < 4:
- data = "0" + data
- self.addServerPacket(data)
- m = self.ourPacketre2.findall(line)
- if len(m) > 0:
- for str in m:
- if str[2] == "0":
- continue
- data = str[2]
- if len(data) > 2 and data[0:2] == "0x":
- data = data[2:]
- while len(data) < 4:
- data = "0" + data
- self.addServerPacket(data)
m = self.serverpacketLoginOutre.findall(line)
if len(m) > 0:
for str in m: