Formatting
This commit is contained in:
1 parent
2abe34e88c
commit
d9199a3e2a
11 files changed
+667
-582
No files matched your search
+1
-3
@@ -1,12 +1,10 @@
|
||||
class IRC:
|
||||
|
||||
options = None
|
||||
writeFile = None
|
||||
|
||||
def onEnable(self, parser):
|
||||
|
||||
parser.add_option("-q", "--irc-out-file", dest="ircDump", default="ircdump.txt",
|
||||
help="file to dump messages to")
|
||||
help="file to dump messages to")
|
||||
|
||||
def onDisable(self):
|
||||
if (self.writeFile != None):
|
||||
|
||||
+8
-10
@@ -2,23 +2,21 @@ 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("-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")
|
||||
|
||||
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):
|
||||
@@ -28,7 +26,7 @@ class PacketDumper:
|
||||
packet = copy.deepcopy(receivedPacket)
|
||||
if (self.writeFile != None):
|
||||
if (packetID == "\x33" or packetID == "\x38"):
|
||||
packet = {'ChunkPlaceHolder' : 0}
|
||||
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')
|
||||
|
||||
Reference in new issue
Block a user