def disas_thumb(buf, array_name='', row_width=16, fancy=False): insns = struct.unpack("H" * (len(buf) / 2), buf) out = "" pos = 0 for insn in insns: tmp = "" if fancy: tmp += colors.fg('cyan') tmp += "%.8x: " % (pos) if fancy: tmp += colors.fg('red') + colors.bold() tmp += "%08x " % (insn) if fancy: tmp += colors.end() + colors.fg('green') tmp += str(darm.disasm_thumb(insn)) if fancy: tmp += colors.end() out += " " + tmp + "\n" pos = pos + 2 return out
def disas_thumb(buf, array_name="", row_width=16, fancy=False): insns = struct.unpack("H" * (len(buf) / 2), buf) out = "" pos = 0 for insn in insns: tmp = "" if fancy: tmp += colors.fg("cyan") tmp += "%.8x: " % (pos) if fancy: tmp += colors.fg("red") + colors.bold() tmp += "%08x " % (insn) if fancy: tmp += colors.end() + colors.fg("green") tmp += str(darm.disasm_thumb(insn)) if fancy: tmp += colors.end() out += " " + tmp + "\n" pos = pos + 2 return out
def disas_str(addr, data, thumb_mode): out_insn = [] if thumb_mode == True: insns = struct.unpack("H" * (len(data) / 2), data) for insn in insns: out_insn.append(str(darm.disasm_thumb(insn))) else: insns = struct.unpack("I" * (len(data) / 4), data) for insn in insns: out_insn.append(str(darm.disasm_armv7(insn))) return out_insn