Hex-Rays CLI Utility
ida-hcli (Hex-Rays CLI Utility) is a command-line interface tool designed to interact with Hex-Rays IDA Pro installations. It assists with managing IDA versions, plugins, and configurations programmatically or via the terminal. Currently at version 0.17.2, it sees frequent updates, typically with minor releases several times a month.
Warnings
- gotcha Prior to v0.17.0, the help message for the `HCLI_CURRENT_IDA_INSTALL_DIR` environment variable on macOS was misleading, potentially causing confusion during setup.
- gotcha Versions before v0.16.0 had a less robust algorithm for detecting the correct Python executable associated with IDA Pro, which could lead to runtime errors or incorrect interpreter usage.
- breaking Before v0.16.0, explicit UTF-8 encoding was not consistently used across the library and for subprocesses. This could cause encoding-related errors or unexpected behavior when dealing with non-ASCII characters in paths, filenames, or output.
Install
-
pip install ida-hcli
Imports
- HCLISettings
from hcli.settings import HCLISettings
Quickstart
import subprocess
try:
# Run a basic hcli command to check its version
result = subprocess.run(['hcli', '--version'], capture_output=True, text=True, check=True)
print(f"hcli version: {result.stdout.strip()}")
# Example of checking IDA Pro installations
# result = subprocess.run(['hcli', 'check'], capture_output=True, text=True, check=True)
# print(f"hcli check output:\n{result.stdout}")
except FileNotFoundError:
print("Error: 'hcli' command not found. Ensure ida-hcli is installed and in your PATH.")
except subprocess.CalledProcessError as e:
print(f"Error running hcli command: {e.cmd}")
print(f"Stdout: {e.stdout}")
print(f"Stderr: {e.stderr}")