Skip to content

feat: add foreground interactive interpreter - #7

Open
7wp81x wants to merge 10 commits into
mainfrom
feature/session-interpreter
Open

7wp81x wants to merge 10 commits into
mainfrom
feature/session-interpreter

Conversation

@7wp81x

@7wp81x 7wp81x commented Sep 11, 2026

Copy link
Copy Markdown
Owner

What changed

  • Adds nrsuite_lib/session.py, a long-lived USB/Protocol session.
  • Adds nrsuite_lib/interpreter.py with foreground interpreter mode.
  • Adds ./nrsuite --interact and ./nrsuite interact.
  • Adds a proxy bridge so existing command handlers reuse the shared session instead of opening a new USB connection.
  • Adds status, devices, help, exit, and normal command dispatch inside the prompt.
  • One-shot CLI mode is unchanged: ./nrsuite scan, ./nrsuite sniff --channel 6, etc. still work.

Testing

  • python -m unittest discover -s tests -v — 59 passed.
  • Python syntax check — 33 files OK.
  • ./nrsuite --help no-args behavior preserved.

Current limitations

  • Interpreter is foreground-only; background jobs/plugins are not part of this PR.
  • masstorage start and badusb intentionally exit interpreter mode because those commands re-enumerate/disconnect the USB link.

Do not merge automatically; human review required.

Adds a long-lived USB/protocol session and proxy bridge so command handlers can reuse one open connection without tearing it down.
Adds ./nrsuite --interact and ./nrsuite interact with a shared session, prompt, status/devices/help/exit commands, and foreground command dispatch. One-shot CLI behavior is unchanged.
Interpreter mode now launches through espbridge open_usb_device instead of the log-tail child path, so the no-newline prompt appears immediately. Logs are still echoed when stderr is a tty.
Termux espbridge 1.1.0 open_usb_device exits without an fd on stdout. Interactive mode now reuses the working TERMUX_CALLBACK/TERMUX_EXPORT_FD launch path without redirecting stdout/stderr, so the prompt and logs stay on the terminal.
Adds show modules/options/status/devices, use <module>, set/unset, run/exploit, and back. Modules are discovered from the real argparse parser so interpreter and one-shot options stay in sync. Also fixes the scan dispatch call in interpreter mode.
Interactive mode now launches without auto-connecting, lists USB devices, supports use device/disconnect, friendly unknown-command suggestions, colored prompts/output, and topic help. Adds docs for the new flow.
Adds clear/cls to interpreter mode and makes the parent ignore SIGINT while the Termux connected child owns the terminal, avoiding competing prompts.
Adds a synchronous hook bus, explicit --plugin loading with a small PluginAPI, dynamic plug/* modules, and set pscript post/* automation with a built-in pcap count post script. Local Python tests expanded to 94 passing.
Adds show plugins/show posts with load counts, colored help, ~/.config/nrsuite/plugins and ~/.config/nrsuite/posts auto-loading, and source tracking for post scripts. Local tests now 97 passing.
Post script dict results now render as readable [+] key: value lines instead of a Python repr.
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.

1 participant