Beispiel #1
0
 def testReport(self):
     disasm = Disassembler(config)
     report = disasm.getDisassemblyReport(self.asprox_disassembly)
     assert report["status"] == "ok"
     assert report["base_addr"] == 0x8D0000
     assert report["summary"]["num_instructions"] == 15706
     assert report[
         "sha256"] == "db8a133fed1b706608a4492079b702ded6b70369a980d2b5ae355a6adc78ef00"
Beispiel #2
0
def disassembleFile(file_path, base_addr, map_file=False):
    print("now analyzing {}".format(file_path))
    loader = FileLoader(file_path, map_file=map_file)
    file_content = loader.getData()
    disasm = Disassembler(config)
    start = time.clock()
    try:
        disassembly = disasm.disassemble(file_content, base_addr, timeout=config.TIMEOUT)
        report = disasm.getDisassemblyReport(disassembly)
        report["filename"] = os.path.basename(file_path)
        print(disassembly)
    except Exception as exc:
        print("-> an error occured (", str(exc), ").")
        report = {"status":"error", "meta": {"traceback": traceback.format_exc(exc)}, "execution_time": time.clock() - start}
    return report