Skip to content

Instantly share code, notes, and snippets.

@PsychoTea
Created October 27, 2020 21:04
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save PsychoTea/253497050ff39ea10e248e9e593d1271 to your computer and use it in GitHub Desktop.
Save PsychoTea/253497050ff39ea10e248e9e593d1271 to your computer and use it in GitHub Desktop.
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