def start_repl(self, quiet: bool) -> None:
"""
Start the objection repl.
"""
banner = ("""
_ _ _ _
___| |_ |_|___ ___| |_|_|___ ___
| . | . | | | -_| _| _| | . | |
|___|___|_| |___|___|_| |_|___|_|_|
|___|(object)inject(ion) v{0}
Runtime Mobile Exploration
by: @leonjza from @sensepost
""").format(__version__)
if not quiet:
click.secho(banner, bold=True)
click.secho('[tab] for command suggestions', fg='white', dim=True)
# the main application loop is here, reading inputs provided by
# prompt_toolkit and sending it off the the needed handlers
while True:
try:
document = prompt(
get_prompt_tokens=self.get_prompt_tokens,
completer=self.completer,
style=PromptStyle().get_style(),
history=FileHistory(os.path.expanduser('~/.objection/objection_history')),
auto_suggest=AutoSuggestFromHistory(),
on_abort=AbortAction.RETRY,
reserve_space_for_menu=4
)
# check if this is an exit command
if document.strip() in ('quit', 'exit', 'bye'):
click.secho('Exiting...', dim=True)
break
# if we got the reconnect command, handle just that
if self.handle_reconnect(document):
continue
# dispatch to the command handler. if something goes horribly
# wrong, catch it instead of crashing the REPL
try:
# find something to run
self.run_command(document)
except Exception as e:
click.secho(('\n\nAn exception occurred while processing the command. If this '
'looks like a code related error, please file a bug report!'), fg='red')
click.secho('Error: {0}'.format(e), fg='red', bold=True)
except (KeyboardInterrupt, EOFError):
click.secho('Exiting...', dim=True)
break
评论列表
文章目录