def testAsproxMarshalling(self): report_as_dict = self.asprox_disassembly.toDict() assert report_as_dict["status"] == "ok" assert report_as_dict["base_addr"] == 0x8D0000 assert report_as_dict["statistics"]["num_instructions"] == 15706 assert report_as_dict[ "sha256"] == "db8a133fed1b706608a4492079b702ded6b70369a980d2b5ae355a6adc78ef00" reimported_report = SmdaReport.fromDict(report_as_dict)
def testCutwailMarshalling(self): report_as_dict = self.cutwail_disassembly.toDict() assert report_as_dict["status"] == "ok" assert report_as_dict["base_addr"] == 0x4000000 assert report_as_dict["statistics"]["num_instructions"] == 1611 assert report_as_dict[ "sha256"] == "a348a0ddfab135d152b684d561a3215ab6c472570facd3d75aa2c7ee845a8e2b" # compare our manual file loading with unmapped buffer assert self.cutwail_disassembly.num_instructions == self.cutwail_unmapped_disassembly.num_instructions reimported_report = SmdaReport.fromDict(report_as_dict)
def _createErrorReport(self, start, exception): report = SmdaReport(config=self.config) report.smda_version = self.config.VERSION report.status = "error" report.execution_time = self._getDurationInSeconds(start, datetime.datetime.utcnow()) report.message = traceback.format_exc(exception) return report
def _disassemble(self, binary_info, timeout=0): self._start_time = datetime.datetime.utcnow() self._timeout = timeout self.disassembly = self.disassembler.analyzeBuffer( binary_info, self._callbackAnalysisTimeout) return SmdaReport(self.disassembly, config=self.config)