Skip to content

Commit 7bf540f

Browse files
committed
refactoring run tool objection
1 parent 6d23849 commit 7bf540f

File tree

2 files changed

+34
-13
lines changed

2 files changed

+34
-13
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# ChangeLog
22

3+
### 0.7.35
4+
- CHANGE: tool objection
5+
36
### 0.7.34
47
- BUGFIX: fixed issue with special chars in apk filename
58
- ADDED: new pentest folder structure

mpt/console.py

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from mpt import functions
1717

18-
__version__ = '0.7.34'
18+
__version__ = '0.7.35'
1919

2020
from mpt import settings, logger
2121
from mpt.config import Config
@@ -500,6 +500,35 @@ def print_run_tool_usage():
500500
print(" if you pass the argument to file location please use absolute path !!!")
501501

502502

503+
def run_tool_objection():
504+
log.info("Execute the followings steps")
505+
log.info(f"1) Please run 'frida-ps -U' to find the app name")
506+
log.info(f"2) start objection with the following command: 'objection --gadget \"<APP-NAME>\" explore'")
507+
508+
conf = Config()
509+
package = conf.load_config('package-name')
510+
application_label = conf.load_config('application-label')
511+
512+
app = f"\"{application_label}\" ({package})"
513+
options = [f"run objection for app {app}", "run objection"]
514+
terminal_menu = TerminalMenu(options, title="Please select an option:")
515+
menu_entry_index = terminal_menu.show()
516+
517+
command = settings.ANDROID_TOOLS['objection']['bin']
518+
if menu_entry_index == 0:
519+
objection_command = f"objection --gadget \\\"{application_label}\\\" explore"
520+
command = command.rsplit(";", 1)[0] + f"; {objection_command}; exec $SHELL"
521+
log_info = f"Running command in {Style.BRIGHT + Fore.CYAN}kitty terminal{Style.RESET_ALL} {objection_command}"
522+
if menu_entry_index == 1:
523+
# replace last objection mit exec $SHELL
524+
command = command.rsplit(";", 1)[0] + "; objection --help; exec $SHELL"
525+
log_info = f"Running command in {Style.BRIGHT + Fore.CYAN}kitty terminal{Style.RESET_ALL} ..."
526+
527+
terminal_with_command = f"{settings.ANDROID_TOOLS['kitty']['bin']} -- bash -c \"{command}\""
528+
log.info(log_info)
529+
functions.run_command(terminal_with_command, return_output=False)
530+
531+
503532
def run_tool(tool_with_args):
504533
"""
505534
Accepts only two parameters tool + <arg>
@@ -549,18 +578,7 @@ def run_tool(tool_with_args):
549578
command = command + " " + tool_args
550579

551580
if tool == 'objection':
552-
553-
log.info("Execute the followings steps")
554-
log.info(f"1) Please run 'frida-ps -U' to find the app name")
555-
log.info(f"2) start objection with the following command: 'objection --gadget \"<APP-NAME>\" explore'")
556-
557-
command = settings.ANDROID_TOOLS[tool]['bin']
558-
# replace last objection mit exec $SHELL
559-
command = command.rsplit(";", 1)[0] + "; exec $SHELL"
560-
561-
terminal_with_command = f"{settings.ANDROID_TOOLS['kitty']['bin']} -- bash -c \"{command}\""
562-
log.info(f"Running command in {Style.BRIGHT + Fore.CYAN}kitty terminal{Style.RESET_ALL} ...")
563-
functions.run_command(terminal_with_command, return_output=False)
581+
run_tool_objection()
564582

565583
# default case
566584
else:

0 commit comments

Comments
 (0)