Skip to content

Commit

Permalink
Add objection run subcommand.
Browse files Browse the repository at this point in the history
This adds ths ability to run objection commands without the need to
start the exploration REPL. For example:
    $ objection run ios ui dump
  • Loading branch information
leonjza committed Sep 21, 2017
1 parent e7fa327 commit aa276c7
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions objection/console/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,38 @@ def explore(startup_command: str, startup_script: str, hook_debug: bool, quiet:
r.start_repl(quiet=quiet)


@cli.command()
@click.option('--hook-debug', '-d', required=False, default=False, is_flag=True,
help='Print compiled hooks as they are run to the screen and logfile.')
@click.argument('command', nargs=-1)
def run(hook_debug: bool, command: tuple) -> None:
"""
Run a single objection command.
"""

if len(command) <= 0:
click.secho('Please specify a command to run', fg='red')
return

# specify if hooks should be debugged
app_state.debug_hooks = hook_debug

try:

click.secho('Determining environment...', dim=True)
get_device_info()

except (frida.TimedOutError, frida.ServerNotRunningError) as e:
click.secho('Error: {0}'.format(e), fg='red')
return

command = ' '.join(command)

# use the methods in the main REPL to run the command
click.secho('Running command... `{0}`'.format(command), dim=True)
Repl().run_command(command)


@cli.command()
def version() -> None:
"""
Expand Down

0 comments on commit aa276c7

Please sign in to comment.