diff options
| author | blasty <blasty@local> | 2026-07-09 12:15:42 +0200 |
|---|---|---|
| committer | blasty <blasty@local> | 2026-07-09 12:15:42 +0200 |
| commit | 3527cb15cf02a7c50d976c52b39ec73e0adf760d (patch) | |
| tree | dd107191f88fe728c777438662d60bb57dc962d2 /idatui/app.py | |
| parent | add Ctrl+B toggle to show/hide the functions pane (diff) | |
| download | ida-tui-3527cb15cf02a7c50d976c52b39ec73e0adf760d.tar.gz ida-tui-3527cb15cf02a7c50d976c52b39ec73e0adf760d.tar.xz ida-tui-3527cb15cf02a7c50d976c52b39ec73e0adf760d.zip | |
tui: --open PATH to create/attach a session for an arbitrary binary
- app: when open_path is set, idb_open (idle_ttl=1e9, long timeout) and pin the
returned session; clean status on failure (e.g. non-writable dir)
- tui.py: --open flag + usage docs (attach vs open)
- verified: --open targets/cat -> new session, 161 funcs loaded
Diffstat (limited to 'idatui/app.py')
| -rw-r--r-- | idatui/app.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/idatui/app.py b/idatui/app.py index a91b3f0..574ec4d 100644 --- a/idatui/app.py +++ b/idatui/app.py @@ -247,10 +247,12 @@ class IdaTui(App): Binding("escape", "back", "Back"), ] - def __init__(self, url: str, db: str | None, keepalive: bool = True) -> None: + def __init__(self, url: str, db: str | None, keepalive: bool = True, + open_path: str | None = None) -> None: super().__init__() self._url = url self._db = db + self._open_path = open_path self._do_keepalive = keepalive self.client: IDAClient | None = None self.program: Program | None = None @@ -285,7 +287,18 @@ class IdaTui(App): try: client = IDAClient(self._url, db=self._db) client.connect() - if self._db is None: + if self._open_path is not None: + self.app.call_from_thread(self._status, f"opening {self._open_path}…") + import os + path = os.path.abspath(os.path.expanduser(self._open_path)) + res = client.call("idb_open", input_path=path, + idle_ttl_sec=1_000_000_000, timeout=1800.0) + if not (isinstance(res, dict) and res.get("success")): + err = res.get("error") if isinstance(res, dict) else res + self.app.call_from_thread(self._status, f"open failed: {err}") + return + client.set_db(res["session"]["session_id"]) + elif self._db is None: client.set_db(client.resolve_db()) health = client.health() module = health.get("module", "?") |
