Skip to content

Fix IDA client installer and installation docs - #5

Open
n0kovo wants to merge 1 commit into
quarkslab:mainfrom
n0kovo:fix-ida-installer
Open

n0kovo wants to merge 1 commit into
quarkslab:mainfrom
n0kovo:fix-ida-installer

Conversation

@n0kovo

@n0kovo n0kovo commented Nov 1, 2026

Copy link
Copy Markdown

install_ida.py never worked: main() was called without arguments, it looked for a nonexistent <IDA_DIR>/venv, and it copied the plugin into the IDA install directory.

It now reads the Python library selected with idapyswitch (Python3TargetDLL in ida.reg / the Windows registry / ida-config.json), pip-installs sighthouse.client into the matching interpreter, and copies the plugin into the IDA user plugins directory. Adds --python, --dry-run and --break-system-packages; --ida-dir is now optional.

Also:

  • cli: honour $IDA_DIR / $GHIDRA_INSTALL_DIR, report ValueError cleanly
  • install_ghidra: don't prompt for (and recreate) the venv twice
  • Makefile: make help now lists install_* targets
  • docs: explain how IDA picks its Python; fix dead client doc links

install_ida.py never worked: main() was called without arguments, it
looked for a nonexistent <IDA_DIR>/venv, and it copied the plugin into
the IDA install directory.

It now reads the Python library selected with idapyswitch
(Python3TargetDLL in ida.reg / the Windows registry / ida-config.json),
pip-installs sighthouse.client into the matching interpreter, and copies
the plugin into the IDA user plugins directory. Adds --python,
--dry-run and --break-system-packages; --ida-dir is now optional.

Also:
- cli: honour $IDA_DIR / $GHIDRA_INSTALL_DIR, report ValueError cleanly
- install_ghidra: don't prompt for (and recreate) the venv twice
- Makefile: `make help` now lists install_* targets
- docs: explain how IDA picks its Python; fix dead client doc links
@Fenrisfulsur Fenrisfulsur self-assigned this Nov 1, 2026

@Fenrisfulsur Fenrisfulsur left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi o/
First of all: Thanks a lot for submitting a patch, really appreciate it!
I tested the installer and it work fine. I've left some comments, feel free to discuss.

Comment thread doc/docs/clients/ida.md
| `--dry-run` | Show which interpreter and plugins directory would be used, without changing anything. |
| `--python PATH` | Use this interpreter instead of the one detected from the `idapyswitch` settings. |
| `--break-system-packages` | Allow installing into an externally managed Python (PEP 668, e.g. Homebrew or Debian's system Python). Pointing IDA at a non-managed Python with `idapyswitch` is usually a better fix. |
| `--ida-dir PATH` | IDA installation directory. Optional (also read from `$IDA_DIR`); only used as a sanity check. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep the option for users to force the ida directory if they really want (so remove 'only used as a sanity check')


from sighthouse.client.install_binja import main as binja_main
from sighthouse.client.install_ida import main as ida_main
from sighthouse.client.install_ida import InstallError, main as ida_main

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InstallError could be a generic exception raised by all the installers. It should be moved to a file like installer.py or something like this.

# Setup variables
install_dir = Path(install_dir)
python_cmd: str = sys.executable
python_cmd: str | None = sys.executable

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there cases where sys.executable could be None ? If that the case, maybe add a comment explaining why.

REGISTRY_KEY = "Python3TargetDLL"


class InstallError(Exception):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InstallError could be a generic exception raised by all the installers. It should be moved to a file like installer.py or something like this.

return candidates


def _interpreter_version(python: Path) -> str | None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method could be useful for all installers (need to be made public). It should be moved to a file like installer.py or something like this.

# ---------------------------------------------------------------------------


def _is_externally_managed(python: Path) -> bool:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method kinda already exists in install_ghidra.py but your version is better I think. It could be useful for all installers (need to be made public). It should be moved to a file like installer.py or something like this. Then we should remove both definition from install_ghidra/ida files.

Comment on lines +241 to +244
if ida_dir is not None and not Path(ida_dir).expanduser().exists():
raise InstallError(f"IDA directory not found: {ida_dir}")

user_dir = get_ida_user_dir()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should let the user force the ida directory if he really want. I propose:

user_dir = ida_dir or get_ida_user_dir()

]
subprocess.check_call([python_cmd] + pip_args_sighthouse)
copy_client_script_to_idadir(install_dir)
def add_arguments(parser: ArgumentParser) -> None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has no other use, we can inline it in main


def install_package(python: Path, break_system_packages: bool, dry_run: bool) -> None:
cmd = [str(python), "-m", "pip", "install", "--upgrade", PACKAGE]
if _is_externally_managed(python):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should check whether we are in a virtual environment or not because is_externally_managed() will return True even if we are inside a venv but the installation will not need --break-system-packages.

The is_venv method should be updated and moved into the shared installer.py:

def is_venv(python: Path) -> bool:
    """Return whether the given python installation is a Virtual Environment."""
    out = subprocess.run(
        [str(python), "-I", "-c", "import sys;print(sys.prefix!=sys.base_prefix)"],
        capture_output=True, text=True,
    ).stdout.strip()
    return out == "True"

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants