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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
"""Launcher for the idatui TUI.
# attach to the single open session on a running server
python -m idatui.tui
# attach to a specific session
python -m idatui.tui --db 80d83396
# open (or reopen) an arbitrary binary, then drive it
python -m idatui.tui --open /path/to/binary
The server (supervisor) must already be running (see spawn.sh). --open creates a
session via idb_open; the binary's directory must be writable (idalib writes a
.i64 next to it).
"""
from __future__ import annotations
import argparse
import os
from .app import IdaTui
from .client import DEFAULT_URL
def main(argv: list[str] | None = None) -> int:
p = argparse.ArgumentParser(prog="idatui", description="Minimal TUI for IDA over MCP")
p.add_argument("--url", default=os.environ.get("IDA_MCP_URL", DEFAULT_URL),
help=f"MCP server URL (default {DEFAULT_URL})")
p.add_argument("--db", default=os.environ.get("IDA_MCP_DB"),
help="attach to an existing session id")
p.add_argument("--open", metavar="PATH",
help="open (or reopen) a binary and drive it (dir must be writable)")
p.add_argument("--no-keepalive", action="store_true",
help="Do not bump idle-TTL / run the keepalive heartbeat")
args = p.parse_args(argv)
IdaTui(url=args.url, db=args.db, open_path=args.open,
keepalive=not args.no_keepalive).run()
return 0
if __name__ == "__main__":
raise SystemExit(main())
|