Headless IDA
Project description
Headless IDA
Install
pip install headless-ida
Usage
Use it as a normal Python module.
# Initialize HeadlessIda
from headless_ida import HeadlessIda
headlessida = HeadlessIda("/path/to/idat64", "/path/to/binary")
# Import IDA Modules (make sure you have initialized HeadlessIda first)
import idautils
import ida_name
# Or Import All IDA Modules at Once (idaapi is not imported by default)
# from headless_ida.ida_headers import *
# Have Fun
for func in idautils.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();"
Advanced Usage
Remote Server
Start a Headless IDA server
$ headless-ida-server /path/to/idat64 localhost 1337 &
Connect to the server in Python script
# Initialize HeadlessIda
from headless_ida import HeadlessIdaRemote
headlessida = HeadlessIdaRemote("localhost", 1337, "/path/to/local/binary")
# Import IDA Modules (make sure you have initialized HeadlessIda first)
import idautils
import ida_name
# Have Fun
for func in idautils.Functions():
print(f"{hex(func)} {ida_name.get_ea_name(func)}")
Connect to the server in command line
# Interactive Console
$ headless-ida localhost:1337 /path/to/local/binary
# Run IDAPython Script
$ headless-ida localhost:1337 /path/to/local/binary idascript.py
# One-liner
$ headless-ida localhost:1337 /path/to/local/binary -c "import idautils; print(list(idautils.Functions())[0:10])"
Resources
Known Issues
from XXX import *
- 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 withfrom XXX import YYY, ZZZ
, or importing the entire module usingimport 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
headless_ida-0.6.0.tar.gz
(9.1 kB
view details)
Built Distribution
File details
Details for the file headless_ida-0.6.0.tar.gz
.
File metadata
- Download URL: headless_ida-0.6.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c719e0c7c460c46b0e45d0304d7e5f8598fb9f89c454455a07f5159f2049db8e |
|
MD5 | 2cfc11877e97d35a51e3b8f20daf9eec |
|
BLAKE2b-256 | 9a80dc8d523d3017215d9dd645282b7077f76ae7f0cf1ab986d04aa8e87e8f40 |
File details
Details for the file headless_ida-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: headless_ida-0.6.0-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81ec0044515c7d3fe3df49203492d69dc6765ac4314bf21b2c4211027b080ddf |
|
MD5 | 75d24cad6e5e7b91144b5d93584c8975 |
|
BLAKE2b-256 | 714ff68e8d5af955581023a934a17fdb17faae57eb67d5cbe3f92cd05f4cbc33 |