aboutsummaryrefslogtreecommitdiffstats
path: root/ida-tui
blob: ed4db09d5296fb2c45dd5fecb6ea86d75abe00b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
# Caveman launcher for the IDA TUI:
#
#     ./ida-tui foo.elf        # open a binary and drive it — that's it
#     ./ida-tui                # attach to the sole open session (mcp)
#     ./ida-tui --db <id>      # attach to a specific session (mcp)
#
# Opening a binary now spins up our own idalib worker (a unix-socket subprocess;
# no HTTP, no supervisor). --db/attach still use the deprecated ida-pro-mcp
# path; pass --backend mcp to force it. Uses the venv python that has textual
# (override with $IDATUI_PYTHON); the worker auto-picks the python that has
# ida_pro_mcp (override with $IDATUI_WORKER_PYTHON).
set -eu

SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)

PY="${IDATUI_PYTHON:-$HOME/ida-venv/bin/python}"
if [ ! -x "$PY" ]; then
    PY=$(command -v python3 || true)
    [ -n "$PY" ] || { echo "ida-tui: no python found (set \$IDATUI_PYTHON)" >&2; exit 1; }
fi

# Make `idatui` importable no matter where you invoke this from; binary path
# arguments are resolved against your real cwd by the launcher, not $SCRIPT_DIR.
exec env PYTHONPATH="$SCRIPT_DIR${PYTHONPATH:+:$PYTHONPATH}" "$PY" -m idatui.launch "$@"