summaryrefslogtreecommitdiff
path: root/servergreps/hercules
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-19 02:53:39 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-19 22:52:13 +0300
commite76a4ba3be73a740f5a903a7b905811252843cb4 (patch)
treeaa0d2e4347afdd0f9c1fa5f0dd232bb30b2c8a54 /servergreps/hercules
parenteff5b9c1a25beda55bfb2e142745d9ce2c9d69ac (diff)
downloadevol-tools-e76a4ba3be73a740f5a903a7b905811252843cb4.tar.gz
evol-tools-e76a4ba3be73a740f5a903a7b905811252843cb4.tar.bz2
evol-tools-e76a4ba3be73a740f5a903a7b905811252843cb4.tar.xz
evol-tools-e76a4ba3be73a740f5a903a7b905811252843cb4.zip
servergreps: add to all servers for detect getting packet sizes.
And into hercules forks also parsing actual packet sizes in packets.h
Diffstat (limited to 'servergreps/hercules')
-rwxr-xr-xservergreps/hercules/src/brathena.py24
-rwxr-xr-xservergreps/hercules/src/idathena.py13
-rwxr-xr-xservergreps/hercules/src/ragemu.py24
-rwxr-xr-xservergreps/hercules/src/rathena.py13
-rwxr-xr-xservergreps/hercules/src/threeceam.py13
5 files changed, 82 insertions, 5 deletions
diff --git a/servergreps/hercules/src/brathena.py b/servergreps/hercules/src/brathena.py
index b93d18e..8c0e204 100755
--- a/servergreps/hercules/src/brathena.py
+++ b/servergreps/hercules/src/brathena.py
@@ -20,6 +20,8 @@ class Brathena:
inPackets = dict()
functionToId = dict()
loginPacketNameToId = dict()
+ getLenPackets = set()
+ knownLenPackets = dict()
namedPacketre = re.compile(
"((\t|[ ])*)(?P<name>[\w0-9_]+)([ ]*)=" +
@@ -45,6 +47,11 @@ class Brathena:
lclifPacketre = re.compile(
"([ ]*)[{][ ]PACKET_ID_CA_(?P<name>[A-Z0-9_]+),([^,]+)," +
"([ ]*)[&](?P<function>[0-9a-zA-Z_>-]+)([ ]*)[}],")
+ packetLenre = re.compile(
+ "packet_db[\\[]0x(?P<packet>[0-9a-fA-F]+)[\\]].len")
+ clientpacketLenre = re.compile(
+ "(\t*)packet[(]0x(?P<packet>[0-9a-fA-F]+),(?P<len>[\w-]+)" +
+ "[)]")
def collectNamedPackets(self, fileName):
with open(fileName, "r") as f:
@@ -145,6 +152,15 @@ class Brathena:
data = str[2]
data = self.loginPacketNameToId[data]
self.addServerPacket(data)
+ m = self.packetLenre.findall(line)
+ if len(m) > 0:
+ for str in m:
+ data = str.lower()
+ if len(data) > 2 and data[0:2] == "0x":
+ data = data[2:]
+ while len(data) < 4:
+ data = "0" + data
+ self.getLenPackets.add(data)
def sortOutPackets(self):
@@ -164,6 +180,12 @@ class Brathena:
self.inPackets[data] = \
(int(m.group("len")), m.group("function"))
self.functionToId[m.group("function")] = data
+ m = self.clientpacketLenre.search(line)
+ if m is not None:
+ data = m.group("packet").lower()
+ while len(data) < 4:
+ data = "0" + data
+ self.knownLenPackets[data] = int(m.group("len"))
def collectCharInPackets(self, charFilePackets):
@@ -203,5 +225,5 @@ class Brathena:
proc.run("char", "pincode.c");
proc.run("login", "login.c");
proc.run("map", "clif.c");
- proc.defines = "-DPACKETVER=" + packetVersion + " -Dpacket\\(id,size,...\\)=packet\\(id,size,__VA_ARGS__\\)"
+ proc.defines = "-DPACKETVER=" + packetVersion + " -Dpacket\\(...\\)=packet\\(__VA_ARGS__\\)"
proc.run("map", "packets.h");
diff --git a/servergreps/hercules/src/idathena.py b/servergreps/hercules/src/idathena.py
index a52b1d2..4b51b52 100755
--- a/servergreps/hercules/src/idathena.py
+++ b/servergreps/hercules/src/idathena.py
@@ -20,6 +20,7 @@ class Idathena:
inPackets = dict()
functionToId = dict()
loginPacketNameToId = dict()
+ getLenPackets = set()
namedPacketre = re.compile(
"((\t|[ ])*)(?P<name>[\w0-9_]+)([ ]*)=" +
@@ -46,6 +47,8 @@ class Idathena:
lclifPacketre = re.compile(
"([ ]*)[{][ ]PACKET_ID_CA_(?P<name>[A-Z0-9_]+),([^,]+)," +
"([ ]*)[&](?P<function>[0-9a-zA-Z_>-]+)([ ]*)[}],")
+ packetLenre = re.compile(
+ "packet_db[\\[]0[\\]][\\[]0x(?P<packet>[0-9a-fA-F]+)[\\]].len")
def collectNamedPackets(self, fileName):
with open(fileName, "r") as f:
@@ -136,7 +139,6 @@ class Idathena:
while len(data) < 4:
data = "0" + data
self.addServerPacket(data)
-
m = self.ourPacketre2.findall(line)
if len(m) > 0:
for str in m:
@@ -155,6 +157,15 @@ class Idathena:
data = str[2]
data = self.loginPacketNameToId[data]
self.addServerPacket(data)
+ m = self.packetLenre.findall(line)
+ if len(m) > 0:
+ for str in m:
+ data = str.lower()
+ if len(data) > 2 and data[0:2] == "0x":
+ data = data[2:]
+ while len(data) < 4:
+ data = "0" + data
+ self.getLenPackets.add(data)
def sortOutPackets(self):
diff --git a/servergreps/hercules/src/ragemu.py b/servergreps/hercules/src/ragemu.py
index e46d15b..15f20d0 100755
--- a/servergreps/hercules/src/ragemu.py
+++ b/servergreps/hercules/src/ragemu.py
@@ -20,6 +20,8 @@ class Ragemu:
inPackets = dict()
functionToId = dict()
loginPacketNameToId = dict()
+ getLenPackets = set()
+ knownLenPackets = dict()
namedPacketre = re.compile(
"((\t|[ ])*)(?P<name>[\w0-9_]+)([ ]*)=" +
@@ -45,6 +47,11 @@ class Ragemu:
lclifPacketre = re.compile(
"([ ]*)[{][ ]PACKET_ID_CA_(?P<name>[A-Z0-9_]+),([^,]+)," +
"([ ]*)[&](?P<function>[0-9a-zA-Z_>-]+)([ ]*)[}],")
+ packetLenre = re.compile(
+ "packet_db[\\[]0x(?P<packet>[0-9a-fA-F]+)[\\]].len")
+ clientpacketLenre = re.compile(
+ "(\t*)packet[(]0x(?P<packet>[0-9a-fA-F]+),(?P<len>[\w-]+)" +
+ "[)]")
def collectNamedPackets(self, fileName):
with open(fileName, "r") as f:
@@ -145,6 +152,15 @@ class Ragemu:
data = str[2]
data = self.loginPacketNameToId[data]
self.addServerPacket(data)
+ m = self.packetLenre.findall(line)
+ if len(m) > 0:
+ for str in m:
+ data = str.lower()
+ if len(data) > 2 and data[0:2] == "0x":
+ data = data[2:]
+ while len(data) < 4:
+ data = "0" + data
+ self.getLenPackets.add(data)
def sortOutPackets(self):
@@ -164,6 +180,12 @@ class Ragemu:
self.inPackets[data] = \
(int(m.group("len")), m.group("function"))
self.functionToId[m.group("function")] = data
+ m = self.clientpacketLenre.search(line)
+ if m is not None:
+ data = m.group("packet").lower()
+ while len(data) < 4:
+ data = "0" + data
+ self.knownLenPackets[data] = int(m.group("len"))
with open(lclifPackets, "r") as f:
for line in f:
m = self.lclifPacketre.search(line)
@@ -217,5 +239,5 @@ class Ragemu:
proc.run("map", "clif.c");
proc.run("login", "lclif.p.h");
proc.run("login", "lclif.c");
- proc.defines = "-DPACKETVER=" + packetVersion + " -Dpacket\\(id,size,...\\)=packet\\(id,size,__VA_ARGS__\\)"
+ proc.defines = "-DPACKETVER=" + packetVersion + " -Dpacket\\(...\\)=packet\\(__VA_ARGS__\\)"
proc.run("map", "packets.h");
diff --git a/servergreps/hercules/src/rathena.py b/servergreps/hercules/src/rathena.py
index 28c6c2e..4ff10f4 100755
--- a/servergreps/hercules/src/rathena.py
+++ b/servergreps/hercules/src/rathena.py
@@ -20,6 +20,7 @@ class Rathena:
inPackets = dict()
functionToId = dict()
loginPacketNameToId = dict()
+ getLenPackets = set()
namedPacketre = re.compile(
"((\t|[ ])*)(?P<name>[\w0-9_]+)([ ]*)=" +
@@ -46,6 +47,8 @@ class Rathena:
lclifPacketre = re.compile(
"([ ]*)[{][ ]PACKET_ID_CA_(?P<name>[A-Z0-9_]+),([^,]+)," +
"([ ]*)[&](?P<function>[0-9a-zA-Z_>-]+)([ ]*)[}],")
+ packetLenre = re.compile(
+ "packet_db[\\[]0[\\]][\\[]0x(?P<packet>[0-9a-fA-F]+)[\\]].len")
def collectNamedPackets(self, fileName):
with open(fileName, "r") as f:
@@ -136,7 +139,6 @@ class Rathena:
while len(data) < 4:
data = "0" + data
self.addServerPacket(data)
-
m = self.ourPacketre2.findall(line)
if len(m) > 0:
for str in m:
@@ -155,6 +157,15 @@ class Rathena:
data = str[2]
data = self.loginPacketNameToId[data]
self.addServerPacket(data)
+ m = self.packetLenre.findall(line)
+ if len(m) > 0:
+ for str in m:
+ data = str.lower()
+ if len(data) > 2 and data[0:2] == "0x":
+ data = data[2:]
+ while len(data) < 4:
+ data = "0" + data
+ self.getLenPackets.add(data)
def sortOutPackets(self):
diff --git a/servergreps/hercules/src/threeceam.py b/servergreps/hercules/src/threeceam.py
index 77e1f19..e7b41c4 100755
--- a/servergreps/hercules/src/threeceam.py
+++ b/servergreps/hercules/src/threeceam.py
@@ -20,6 +20,7 @@ class Threeceam:
inPackets = dict()
functionToId = dict()
loginPacketNameToId = dict()
+ getLenPackets = set()
namedPacketre = re.compile(
"((\t|[ ])*)(?P<name>[\w0-9_]+)([ ]*)=" +
@@ -47,6 +48,8 @@ class Threeceam:
lclifPacketre = re.compile(
"([ ]*)[{][ ]PACKET_ID_CA_(?P<name>[A-Z0-9_]+),([^,]+)," +
"([ ]*)[&](?P<function>[0-9a-zA-Z_>-]+)([ ]*)[}],")
+ packetLenre = re.compile(
+ "packet_db[\\[]0[\\]][\\[]0x(?P<packet>[0-9a-fA-F]+)[\\]].len")
def collectNamedPackets(self, fileName):
with open(fileName, "r") as f:
@@ -144,7 +147,6 @@ class Threeceam:
while len(data) < 4:
data = "0" + data
self.addServerPacket(data)
-
m = self.ourPacketre2.findall(line)
if len(m) > 0:
for str in m:
@@ -163,6 +165,15 @@ class Threeceam:
data = str[2]
data = self.loginPacketNameToId[data]
self.addServerPacket(data)
+ m = self.packetLenre.findall(line)
+ if len(m) > 0:
+ for str in m:
+ data = str.lower()
+ if len(data) > 2 and data[0:2] == "0x":
+ data = data[2:]
+ while len(data) < 4:
+ data = "0" + data
+ self.getLenPackets.add(data)
def sortOutPackets(self):