Last active
December 27, 2019 01:58
-
-
Save williballenthin/540f615dd9d54de47dc52b0ca60522c1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
import idaapi | |
import idautils | |
def rename_sub_functions(fva, prefix): | |
sub_funcs = set([]) | |
for f in idautils.Functions(): | |
for xref in idautils.XrefsTo(f): | |
subf = idaapi.get_func(xref.frm) | |
if not subf: | |
continue | |
if subf.startEA == fva: | |
sub_funcs.add(f) | |
break | |
for sub_func in sub_funcs: | |
current_name = idc.GetFunctionName(sub_func) | |
if current_name.startswith(prefix): | |
continue | |
new_name = prefix + current_name | |
idc.MakeName(sub_func, new_name) | |
if __name__ == '__main__': | |
rename_sub_functions(idc.ScreenEA(), "test_") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment