Created
October 27, 2020 21:04
-
-
Save PsychoTea/253497050ff39ea10e248e9e593d1271 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import idc | |
def define_func(addr, name): | |
idc.MakeCode(addr) | |
idc.MakeFunction(addr) | |
idc.MakeNameEx(addr, name, idc.SN_NOWARN) | |
print("%s @ %s" % (name, hex(addr))) | |
def importr2file(path): | |
content = "" | |
with open(path, "r") as f: | |
content = f.readlines() | |
sym_count = 0 | |
for line in content: | |
if not line.startswith("f sym."): | |
continue | |
line = line.strip("\n") | |
split_line_arr = line.split(' ') | |
sym_name = split_line_arr[1][4:] | |
sym_addr = split_line_arr[3] | |
sym_addr_int = int(sym_addr, 16) | |
define_func(sym_addr_int, sym_name) | |
sym_count += 1 | |
print("defined %s syms" % str(sym_count)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment