Skip to content

Commit

Permalink
perf(str_ptr): Improve string pointer parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
0xjiayu committed Nov 6, 2022
1 parent 415fce1 commit f29815a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions str_ptr.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
import idc, idaapi
idaapi.require("common")

START_EA = 0x98C710
END_EA = 0x990F58
START_EA = 0x586B08 # first str pointer address
END_EA = 0x587C18 # last str pointer address

str_ptr_cnt = 0

curr_addr = START_EA
while curr_addr <= END_EA:
Expand All @@ -24,7 +26,10 @@
if idc.create_strlit(curr_str_addr, curr_str_addr + curr_str_len):
idaapi.auto_wait()

curr_str = idc.get_bytes(curr_str_addr, curr_str_len).decode()
print("@ 0x%x: %s" % (curr_str_addr, curr_str))
curr_str = idc.get_bytes(curr_str_addr, curr_str_len).decode("utf-8", errors="ignore")
print(f"@ {curr_str_addr:#x}: {curr_str}")
str_ptr_cnt += 1

curr_addr += 2 * common.ADDR_SZ

curr_addr += 2 * common.ADDR_SZ
print(f"\n=> Success to parse {str_ptr_cnt} string pointers")

0 comments on commit f29815a

Please sign in to comment.