■ ■ ■ ■ ■ ■
IDAPython/goresym_rename.py
1 | 1 | | # Copyright (C) 2022 Mandiant, Inc. All Rights Reserved. |
2 | 2 | | import idaapi |
3 | 3 | | import ida_bytes |
| 4 | + | import ida_funcs |
4 | 5 | | import ida_kernwin |
5 | 6 | | import ida_name |
6 | 7 | | import json |
| skipped 16 lines |
23 | 24 | | hints = json.loads(buf) |
24 | 25 | | if iterable(hints['UserFunctions']): |
25 | 26 | | for func in hints['UserFunctions']: |
| 27 | + | ida_bytes.del_items(func['Start']) |
| 28 | + | ida_funcs.add_func(func['Start']) |
26 | 29 | | print("Renaming %s to %s" % (hex(func['Start']), func['FullName'])) |
27 | 30 | | idaapi.add_func(func['Start'], func['End']) |
28 | 31 | | idaapi.set_name(func['Start'], func['FullName'], idaapi.SN_NOWARN | idaapi.SN_NOCHECK | ida_name.SN_FORCE) |
| skipped 1 lines |
30 | 33 | | if iterable(hints['StdFunctions']): |
31 | 34 | | for func in hints['StdFunctions']: |
32 | 35 | | print("Renaming %s to %s" % (hex(func['Start']), func['FullName'])) |
| 36 | + | ida_bytes.del_items(func['Start']) |
| 37 | + | ida_funcs.add_func(func['Start']) |
33 | 38 | | idaapi.add_func(func['Start'], func['End']) |
34 | 39 | | idaapi.set_name(func['Start'], func['FullName'], idaapi.SN_NOWARN | idaapi.SN_NOCHECK | ida_name.SN_FORCE) |
35 | 40 | | |
| skipped 32 lines |