tools: Add a script to rename functions in IDA

This commit is contained in:
Léo Lam 2020-09-08 19:22:26 +02:00
parent 3c06896cfe
commit 2857102a43
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
# Renames functions in an IDA database to match the function names
# in the decompiled source code.
# This script needs to be compatible with Python 2.7.
import csv
import idc
import os
csv_path = os.path.join(os.path.dirname(__file__), "../data/uking_functions.csv")
MARKERS = ("|", "?", "!")
with open(csv_path, "r") as f:
reader = csv.reader(f)
for fn in reader:
addr = int(fn[0], 16)
decomp_name = fn[3]
if not decomp_name:
continue
# Get rid of status markers.
if decomp_name[-1] in MARKERS:
decomp_name = decomp_name[:-1]
idc.MakeName(addr, decomp_name)