Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- import sys
- class event:
- def __init__(self, timestamp, hex, description):
- self.timestamp = timestamp
- self.hex = hex
- self.description = description
- def __str__(self):
- return self.timestamp+ ","+ self.hex + "," + self.description
- eventlog = []
- filename = sys.argv[1]
- fh = open(filename)
- exfilename = filename[0:filename.find(".")] + ".csv"
- full = ""
- for line in fh:
- timestamp = line[line.find("[")+1:line.find(" ")]
- hex = line[line.find(" ")+1:line.find("]")]
- description = line[line.find("] ")+2:line.find("\n")]
- e = event(timestamp,hex,description)
- eventlog.append(e)
- fh.close()
- for each in eventlog:
- if "FFFF" not in each.hex:
- full += str(each) + "\n"
- print(exfilename)
- new = open(exfilename,'w')
- new.write(full)
- new.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement