Skip to content

Commit a64a3ec

Browse files
committed
Updated install tools
1 parent bbd8646 commit a64a3ec

File tree

2 files changed

+22
-30
lines changed

2 files changed

+22
-30
lines changed

mpt/console.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ def cli():
716716

717717
parser.add_argument('--update', help='Update MPT to the latest version', action='store_true')
718718

719-
pentest = parser.add_argument_group("Pentest", "Configure an manage current pentest")
719+
pentest = parser.add_argument_group("Pentest", "Configure and manage current pentest")
720720

721721
pentest.add_argument('--setup', metavar='[APK]', nargs=1, type=str, help='Setup pentest environment')
722722
pentest.add_argument('--config', help='Show current pentest config', action='store_true')
@@ -744,17 +744,17 @@ def cli():
744744

745745
tools = parser.add_argument_group("Tools", "Perform app related tasks")
746746

747-
tools.add_argument('-i', '--install', metavar='tools|apps', nargs='?', type=str, const='',
747+
tools.add_argument('-i', '--install-tools', action='store_true',
748748
help='Install pentesting tools on local system in a separate environment')
749-
tools.add_argument('-a', '--adb-run', help='Start adb server with root avoids a lot of issues using adb', action='store_true')
749+
tools.add_argument('-a', '--adb-run', help='Start adb server with root to avoid a lot of issues using adb', action='store_true')
750750
tools.add_argument('-t', '--tool', metavar='tool', nargs='+',
751751
help='Run selected tool with <arguments> (use option \'list\' to display all tools)')
752752

753753
proxy_wifi = parser.add_argument_group("Proxy and WiFi", "Manage proxy on device and WiFi settings locally")
754754

755755
proxy_wifi.add_argument('-ps', '--proxy-status', help='Check WiFi proxy status', action='store_true')
756756
proxy_wifi.add_argument('-pe', '--proxy-enable', metavar='host:port', nargs='?', type=str, const='',
757-
help='Set proxy for WiFi connection on your device (optional <host:port>), if not set load proxy settings from configuration file')
757+
help='Set proxy for WiFi connection on your device (optional <host:port>), if not set loads proxy settings from configuration file')
758758
proxy_wifi.add_argument('-pd', '--proxy-disable', help='Disable WiFi proxy ', action='store_true')
759759
# obsolete options
760760
# parser.add_argument('-e', '--inspeckage', help='Open Inspeckage web interface', action='store_true')
@@ -801,8 +801,8 @@ def cli():
801801
run_decompiler(decompiler=args.decompile)
802802

803803
# Tool Options
804-
if args.install or type(args.install) is str:
805-
functions.install_packages(install=args.install)
804+
if args.install_tools or type(args.install_tools) is str:
805+
functions.install_tools()
806806
if args.adb_run:
807807
functions.run_adb()
808808
if args.tool:

mpt/functions.py

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@ def install_http_archive(package):
331331

332332
log.info('{} successfully installed\n'.format(package))
333333

334-
334+
# not used anymore
335+
"""
335336
def install_app(app):
336337
337338
log.info('Installing {0} app'.format(Fore.CYAN + app + Style.RESET_ALL))
@@ -343,15 +344,14 @@ def install_app(app):
343344
log.error('File {} not found. Installation canceled.'.format(apk_file))
344345
sys.exit()
345346
346-
app_found = run_command(
347-
command="""adb shell 'pm list packages -f' | grep {}""".format(pkg))
347+
app_found = run_command(command="adb shell 'pm list packages -f' | grep {}".format(pkg))
348348
349349
if not app_found:
350350
run_command(
351351
command="adb install {}".format(apk_file))
352352
else:
353353
log.warn('Package {} already installed. Skip installation.'.format(pkg))
354-
354+
"""
355355

356356
def check_requirements(package):
357357
# check tool requirements
@@ -383,30 +383,22 @@ def check_requirements(package):
383383
return True
384384

385385

386-
def install_packages(install):
386+
def install_tools():
387387

388388
conf = Config()
389389
install_dir = conf.load_config('install-dir')
390390

391-
if install == 'tools':
392-
for package in settings.ANDROID_TOOLS:
393-
log.info('Installing {0} into directory: {1}'.format(Fore.CYAN + package + Style.RESET_ALL, install_dir))
394-
395-
# install package, if requirements are met
396-
if check_requirements(package):
397-
if settings.ANDROID_TOOLS[package]['install'] == 'git':
398-
install_git(package)
399-
if settings.ANDROID_TOOLS[package]['install'] == 'http':
400-
install_http(package)
401-
if settings.ANDROID_TOOLS[package]['install'] == 'local':
402-
install_local(package)
403-
404-
elif install == 'apps':
405-
for app in settings.ANDROID_APKS:
406-
install_app(app)
407-
408-
else:
409-
log.error('Only options \'tools\' and \'apps\' are supported')
391+
for package in settings.ANDROID_TOOLS:
392+
log.info('Installing {0} into directory: {1}'.format(Fore.CYAN + package + Style.RESET_ALL, install_dir))
393+
394+
# install package, if requirements are met
395+
if check_requirements(package):
396+
if settings.ANDROID_TOOLS[package]['install'] == 'git':
397+
install_git(package)
398+
if settings.ANDROID_TOOLS[package]['install'] == 'http':
399+
install_http(package)
400+
if settings.ANDROID_TOOLS[package]['install'] == 'local':
401+
install_local(package)
410402

411403

412404
def check_frida_is_running():

0 commit comments

Comments
 (0)