PyRIT Shell - Interactive REPL for PyRIT.
This module provides an interactive shell that talks to the PyRIT backend server over HTTP. No heavy pyrit imports — all operations go through REST.
Functions¶
main¶
main() → intEntry point for pyrit_shell.
Returns:
int— Exit code.
PyRITShell¶
Bases: cmd.Cmd
Interactive shell for PyRIT (thin REST client).
Constructor Parameters:
| Parameter | Type | Description |
|---|---|---|
no_animation | bool | If True, skip the animated startup banner. Defaults to False. |
server_url | `str | None` |
config_file | `Path | None` |
start_server | bool | If True, auto-start a local backend. Defaults to False. |
Methods:
cmdloop¶
cmdloop(intro: Optional[str] = None) → NoneOverride cmdloop to play animated banner before starting the REPL.
default¶
default(line: str) → NoneHandle unknown commands and convert hyphens to underscores.
do_add_initializer¶
do_add_initializer(arg: str) → NoneRegister an initializer from a Python script file.
do_clear¶
do_clear(arg: str) → NoneClear the screen.
do_exit¶
do_exit(arg: str) → boolExit the shell.
Returns:
bool— AlwaysTrueto signal thecmdloop to terminate.
do_help¶
do_help(arg: str) → NoneShow help. Usage: help [command].
do_list_initializers¶
do_list_initializers(arg: str) → NoneList all available initializers.
do_list_scenarios¶
do_list_scenarios(arg: str) → NoneList all available scenarios.
do_list_targets¶
do_list_targets(arg: str) → NoneList all available targets.
do_print_scenario¶
do_print_scenario(arg: str) → NonePrint detailed results for a scenario run.
do_run¶
do_run(line: str) → NoneRun a scenario.
do_scenario_history¶
do_scenario_history(arg: str) → NoneDisplay history of scenario runs from the server (most recent first).
do_start_server¶
do_start_server(arg: str) → NoneStart a local pyrit_backend server.
do_stop_server¶
do_stop_server(arg: str) → NoneStop the backend server.
emptyline¶
emptyline() → boolDon’t repeat last command on empty line.
Returns:
bool— AlwaysFalseso thecmdloop does not exit.