<s> import idaapi <EOL> import idautils <EOL> import sys <EOL> def get_similar_functions ( ) : <EOL> func_library_map = { } <EOL> with open ( '<STR_LIT>' , '<STR_LIT>' ) as f : <EOL> l2 = [ line [ : - <NUM_LIT:1> ] for line in f . readlines ( ) ] <EOL> for i in l2 : <EOL> t1 = i . split ( '<STR_LIT:->' ) <EOL> func_library_map [ t1 [ <NUM_LIT:0> ] [ : - <NUM_LIT:1> ] ] = t1 [ <NUM_LIT:1> ] <EOL> return func_library_map <EOL> def rename_functions_ida ( func_library_map ) : <EOL> print func_library_map . keys ( ) <EOL> for n in xrange ( idaapi . get_segm_qty ( ) ) : <EOL> seg = idaapi . getnseg ( n ) <EOL> if seg : <EOL> funcs = idautils . Functions ( seg . startEA , seg . endEA ) <EOL> for funcaddress in funcs : <EOL> name = GetFunctionName ( funcaddress ) <EOL> if func_library_map . has_key ( name ) : <EOL> MakeNameEx ( funcaddress , func_library_map [ name ] [ <NUM_LIT:1> : ] + "<STR_LIT:_>" + name , SN_NOWARN ) <EOL> idaapi . autoWait ( ) <EOL> func_library_map = get_similar_functions ( ) <EOL> rename_functions_ida ( func_library_map ) <EOL> idc . Exit ( <NUM_LIT:0> ) </s>
