Created
February 21, 2022 12:46
-
-
Save cw2k/cc271251c6ee6877a4f8cb55d130e823 to your computer and use it in GitHub Desktop.
IDA Rename all functions
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
''' | |
This is a Hexrays IDA Pro 7 (Python 3.x)script | |
It'll locate all | |
DBG_Func(L"NewFSACheck"); | |
and name the function house this call accordingly | |
char NewFSACheck() {... | |
Well idc.get_operand_value() returns 'none'? | |
Read here about it https://reverseengineering.stackexchange.com/q/25301/30100 | |
''' | |
def GetString(ea): | |
return idc.get_strlit_contents( ea, -1, get_str_type( ea ) ) | |
def GetStringArg1( ea_func ): | |
arg1 = idaapi.get_arg_addrs( ea_func ) | |
StrOff = idc.get_operand_value( arg1[0], 1 ) | |
return GetString( StrOff ).decode('utf-8') | |
def SetFuncName( ea_Call__DBG_Func ): | |
NewName = GetStringArg1( ea_Call__DBG_Func ) | |
FuncToRename = idc.get_func_attr(ea_Call__DBG_Func, FUNCATTR_START) | |
#NewName=f'{NewName}_{FuncToRename:04X}' | |
idc.set_name( FuncToRename, NewName ) | |
print("0x%x %s" % ( FuncToRename, NewName )) | |
DBG_Func = idc.get_name_ea_simple("DBG_Func") | |
for Call__DBG_Func in CodeRefsTo(DBG_Func, 0): | |
SetFuncName( Call__DBG_Func ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment