Added plugins!

Moved packet dumping to its own plugin
Removed now unused font
This commit is contained in:
Ammar Askar committed 2012-12-17 19:32:18 +05:00
1 parent 43f86d09f5
commit 9f076a6f37
5 files changed
+113 -24

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
import string
import copy
class PacketDumper:
options = None
writeFile = None
def onEnable(self, parser):
parser.add_option("-d", "--dump-packets",
action="store_true", dest="dumpPackets", default=False,
help="run with this argument to dump packets")
parser.add_option("-o", "--out-file", dest="filename", default="dump.txt",
help="file to dump packets to")
def onDisable(self):
if (self.writeFile != None):
self.writeFile.close()
def optionsParsed(self, parsedOptions):
self.options = parsedOptions
if (self.options.dumpPackets):
self.writeFile = open(self.options.filename, 'w')
def packetReceive(self, packetID, receivedPacket):
packet = copy.deepcopy(receivedPacket)
if (self.writeFile != None):
if (packetID == "\x33" or packetID == "\x38"):
packet = {'ChunkPlaceHolder' : 0}
if (packetID == "\x03"):
packet['Message'] = filter(lambda x: x in string.printable, packet['Message'])
self.writeFile.write(hex(ord(packetID)) + " : " + str(packet) + '\n')