# Initialize HeadlessIdafromheadless_idaimportHeadlessIdaheadlessida=HeadlessIda("/path/to/idat64", "/path/to/binary")
# Import IDA Modules (make sure you have initialized HeadlessIda first)importidautilsimportida_name# Or Import All IDA Modules at Once (idaapi is not imported by default)# from headless_ida.ida_headers import *# Have Funforfuncinidautils.Functions():
print(f"{hex(func)}{ida_name.get_ea_name(func)}")
Use it as a command line tool.
# Interactive Console
$ headless-ida /path/to/idat64 /path/to/binary
Python 3.8.10 (default, Nov 14 2022, 12:59:47)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license"for more information.
(InteractiveConsole)
>>> import idautils
>>> list(idautils.Functions())[0:10]
[16384, 16416, 16432, 16448, 16464, 16480, 16496, 16512, 16528, 16544]
>>>
# Run IDAPython Script
$ headless-ida /path/to/idat64 /path/to/binary idascript.py
# One-liner
$ headless-ida /path/to/idat64 /path/to/binary -c "import idautils; print(list(idautils.Functions())[0:10])"# In case you like IPython
$ headless-ida /path/to/idat64 /path/to/binary -c "import IPython; IPython.embed();"
# Initialize HeadlessIdafromheadless_idaimportHeadlessIdaRemoteheadlessida=HeadlessIdaRemote("localhost", 1337, "/path/to/local/binary")
# Import IDA Modules (make sure you have initialized HeadlessIda first)importidautilsimportida_name# Have Funforfuncinidautils.Functions():
print(f"{hex(func)}{ida_name.get_ea_name(func)}")
Using from XXX import * syntax with certain ida modules (like idaapi, ida_ua, etc.) is currently unsupported due to SWIG and RPyC compatibility issues. We recommend importing specific items with from XXX import YYY, ZZZ, or importing the entire module using import XXX.
The issue arises because SWIG, employed for creating Python bindings for C/C++ code, generates intermediary objects (SwigVarlink) that RPyC, our remote procedure call mechanism, cannot serialize or transmit correctly.