def __init__(self, crash): """ @type crash: Crash @param crash: L{Crash} object to store into the database. """ # Timestamp and signature. self.timestamp = datetime.datetime.fromtimestamp(crash.timeStamp) self.signature = pickle.dumps(crash.signature, protocol=0) # Marshalled Crash object, minus the memory dump. # This code is *not* thread safe! memoryMap = crash.memoryMap try: crash.memoryMap = None self.data = buffer(Marshaller.dumps(crash)) finally: crash.memoryMap = memoryMap # Exploitability test. self.exploitability_rating, \ self.exploitability_rule, \ self.exploitability_desc = crash.isExploitable() # Exploitability test as an integer result (for sorting). self.exploitable = [ "Not an exception", "Not exploitable", "Not likely exploitable", "Unknown", "Probably exploitable", "Exploitable", ].index(self.exploitability_rating) # Platform description. self.os = crash.os self.arch = crash.arch self.bits = crash.bits # Event description. self.event = crash.eventName self.pid = crash.pid self.tid = crash.tid self.pc = crash.pc self.sp = crash.sp self.fp = crash.fp self.pc_label = crash.labelPC # Exception description. self.exception = crash.exceptionName self.exception_text = crash.exceptionDescription self.exception_address = crash.exceptionAddress self.exception_label = crash.exceptionLabel self.first_chance = crash.firstChance self.fault_type = crash.faultType self.fault_address = crash.faultAddress self.fault_label = crash.faultLabel self.fault_disasm = CrashDump.dump_code(crash.faultDisasm, crash.pc) self.stack_trace = CrashDump.dump_stack_trace_with_labels( crash.stackTracePretty) # Command line. self.command_line = crash.commandLine # Environment. if crash.environment: envList = crash.environment.items() envList.sort() environment = '' for envKey, envVal in envList: # Must concatenate here instead of using a substitution, # so strings can be automatically promoted to Unicode. environment += envKey + '=' + envVal + '\n' if environment: self.environment = environment # Debug string. self.debug_string = crash.debugString # Notes. self.notes = crash.notesReport()
def __init__(self, crash): """ @type crash: Crash @param crash: L{Crash} object to store into the database. """ # Timestamp and signature. self.timestamp = datetime.datetime.fromtimestamp( crash.timeStamp ) self.signature = pickle.dumps(crash.signature, protocol = 0) # Marshalled Crash object, minus the memory dump. # This code is *not* thread safe! memoryMap = crash.memoryMap try: crash.memoryMap = None self.data = buffer( Marshaller.dumps(crash) ) finally: crash.memoryMap = memoryMap # Exploitability test. self.exploitability_rating, \ self.exploitability_rule, \ self.exploitability_desc = crash.isExploitable() # Exploitability test as an integer result (for sorting). self.exploitable = [ "Not an exception", "Not exploitable", "Not likely exploitable", "Unknown", "Probably exploitable", "Exploitable", ].index(self.exploitability_rating) # Platform description. self.os = crash.os self.arch = crash.arch self.bits = crash.bits # Event description. self.event = crash.eventName self.pid = crash.pid self.tid = crash.tid self.pc = crash.pc self.sp = crash.sp self.fp = crash.fp self.pc_label = crash.labelPC # Exception description. self.exception = crash.exceptionName self.exception_text = crash.exceptionDescription self.exception_address = crash.exceptionAddress self.exception_label = crash.exceptionLabel self.first_chance = crash.firstChance self.fault_type = crash.faultType self.fault_address = crash.faultAddress self.fault_label = crash.faultLabel self.fault_disasm = CrashDump.dump_code( crash.faultDisasm, crash.pc ) self.stack_trace = CrashDump.dump_stack_trace_with_labels( crash.stackTracePretty ) # Command line. self.command_line = crash.commandLine # Environment. if crash.environment: envList = crash.environment.items() envList.sort() environment = '' for envKey, envVal in envList: # Must concatenate here instead of using a substitution, # so strings can be automatically promoted to Unicode. environment += envKey + '=' + envVal + '\n' if environment: self.environment = environment # Debug string. self.debug_string = crash.debugString # Notes. self.notes = crash.notesReport()