From fac3b79eeb4783cb522d278044d9316dc6a610d2 Mon Sep 17 00:00:00 2001 From: blasty Date: Thu, 23 Jul 2026 00:14:59 +0200 Subject: launch: `ida-tui foo.elf` one-shot wrapper (server + locks + session) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A caveman entry point so you don't hand-craft the plumbing every time. It: * ensures the ida-pro-mcp supervisor is up — starts spawn.sh detached (start_new_session, tmux-free) and waits for the port if it's down; * recovers a binary wedged by a hard-killed worker — sweeps the stale unpacked .id0/.id1/.id2/.nam/.til next to the .i64 and retries (the packed .i64 is never touched); * adopts an already-open session for the same binary (idempotent), else idb_opens it with a sane idle-TTL; * launches the TUI attached to that session with keepalive on. ./ida-tui /path/to/binary # open a binary and drive it ./ida-tui # attach to the sole session ./ida-tui --db # attach to a specific session Pieces: idatui/launch.py (logic, reuses pane.py's server probe), a repo-root `ida-tui` sh wrapper (resolves ~/ida-venv python, keeps idatui importable from any cwd), and an `ida-tui` console-script in pyproject. --help works without textual (app imported late). README documents both the one-liner and the manual recovery. gitignore bin/ (binary targets, like targets/). Verified live: ensure_server up-detection, open, adopt (same session id), and lock-sweep all work against a running supervisor. --- ida-tui | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 ida-tui (limited to 'ida-tui') diff --git a/ida-tui b/ida-tui new file mode 100755 index 0000000..d1f4179 --- /dev/null +++ b/ida-tui @@ -0,0 +1,23 @@ +#!/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 +# ./ida-tui --db # attach to a specific session +# +# It starts the ida-pro-mcp supervisor if it's down, recovers a binary left +# wedged by a crashed worker, opens/adopts the session, and drops you into the +# TUI. Uses the venv python that has textual (override with $IDATUI_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 "$@" -- cgit v1.3.1-sl0p