카테고리 없음
Get opcode via IDAPython
1q
2018. 9. 20. 17:42
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | from idautils import * from idaapi import * from idc import * from binascii import hexlify filename = GetInputFile() start = MinEA() end = MaxEA() cur_addr = start byte_a = bytearray() byte_s = list() while cur_addr <= end: buf = GetManyBytes(cur_addr, ItemSize(cur_addr)) try: byte_a.extend(buf) s_buf = hexlify(buf) byte_s.append(s_buf) except TypeError as e: # type == None pass cur_addr = NextHead(cur_addr, end) with open('opcode_{0}.bin'.format(filename), 'ab') as hxd: try: hxd.write(byte_a[0:]) except TypeError as e: # type == None pass buf = ''.join(byte_s) with open('str_opcode_{0}.log'.format(filename), 'a') as shxd: try: shxd.write(buf) except TypeError as e: # type == None pass | cs |
can add to specific list via bytearray.