- Linux path to script:
- Not shipped on Linux (IDA script)
- Windows path to script:
- amd64:
C:\Program Files (x86)\Reven-PythonAPI-amd64\python-examples\ida\ida_name_binding_reven_to_ida.py
- x86:
C:\Program Files (x86)\Reven-PythonAPI-x86\python-examples\ida\ida_name_binding_reven_to_ida.py
This is an example of IDA script using the REVEN Python API. Must be run from IDA!
See the script's documentation below for more information:
3 This script updates names in a IDA analyzed binary project using symbol names 4 of the corresponding binary analyzed in REVEN. 7 Use IDA to load the binary, and customize the following arguments before 9 host = your REVEN server name, and 10 port = your REVEN project on this host. 13 This script takes all "symbol names" of the corresponding binary in REVEN to bind 14 locations of the analyzed binary in IDA. We should note that: 15 - the name of the binary must be obtained from REVEN (that is usually the 16 case if "dump process" is executed properly), and be case insentively 17 identical with the one analyzed in IDA (i.e. we do not rename the binary) 19 - if there is several binaries of the same name (but located at different 20 paths), then the first one will be used for name binding only. 32 project = reven.Project(host, port)
33 name_binding = get_reven_name_binding(project)
34 if name_binding
is not None:
35 update_binding(name_binding)
36 print 'binding names from REVEN to IDA done.' 38 print 'binary {:s} cannot found in the REVEN project'.format(os.path.basename(idc.GetInputFilePath()))
41 def get_reven_name_binding(reven_project):
43 Retrieve all known REVEN's symbols for current IDA's binary and return them as a map of {address: name}. 44 If no matching binary is found in REVEN's binary list, return None 47 binary_basename = os.path.basename(idc.GetInputFilePath()).lower()
51 for path, binary
in reven_project.binaries().items():
52 if os.path.basename(path) == binary_basename:
53 name_binding = {symbol.rva: symbol.name
for symbol
in binary.symbols}
61 def update_binding(name_binding):
62 base_addr = idaapi.get_imagebase()
63 for offset
in name_binding:
64 print 'bind 0x{:x} as {:s}'.format(base_addr + offset, name_binding[offset])
65 idaapi.set_name(base_addr + offset, name_binding[offset],
66 idaapi.SN_NOCHECK | idaapi.SN_NOWARN)
69 if __name__ ==
'__main__':
70 host_port_str = idc.AskStr(
'localhost:13370',
"REVEN's project address")
71 if host_port_str
is not None:
73 host, port_str = host_port_str.split(
':')
75 print(
"REVEN's project: {}:{}").format(host, port)
78 print(
"please give a correct REVEN\'s project address, e.g. localhost:13370")
79 except RuntimeError
as e:
82 print(
'unknown error')