From 6c55d7e46292048d629dbe361701e5fe3e02d8d0 Mon Sep 17 00:00:00 2001 From: Darion Reyes Date: Sun, 10 Sep 2023 01:49:42 -0400 Subject: [PATCH] Added the option to skip APK signing. (#635) --- objection/commands/mobile_packages.py | 6 ++++-- objection/console/cli.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/objection/commands/mobile_packages.py b/objection/commands/mobile_packages.py index 3dbfccbb..7ddd6694 100644 --- a/objection/commands/mobile_packages.py +++ b/objection/commands/mobile_packages.py @@ -100,7 +100,7 @@ def patch_android_apk(source: str, architecture: str, pause: bool, skip_cleanup: enable_debug: bool = True, gadget_version: str = None, skip_resources: bool = False, network_security_config: bool = False, target_class: str = None, use_aapt2: bool = False, gadget_config: str = None, script_source: str = None, - ignore_nativelibs: bool = True, manifest: str = None) -> None: + ignore_nativelibs: bool = True, manifest: str = None, skip_signing: bool = False) -> None: """ Patches an Android APK by extracting, patching SMALI, repackaging and signing a new APK. @@ -118,6 +118,7 @@ def patch_android_apk(source: str, architecture: str, pause: bool, skip_cleanup: :param gadget_config: :param script_source: :param manifest: + :param skip_signing: :return: """ @@ -220,7 +221,8 @@ def patch_android_apk(source: str, architecture: str, pause: bool, skip_cleanup: patcher.build_new_apk(use_aapt2=use_aapt2) patcher.zipalign_apk() - patcher.sign_apk() + if not skip_signing: + patcher.sign_apk() # woohoo, get the APK! destination = source.replace('.apk', '.objection.apk') diff --git a/objection/console/cli.py b/objection/console/cli.py index 47eb6bdc..8b0c9ed2 100644 --- a/objection/console/cli.py +++ b/objection/console/cli.py @@ -264,6 +264,8 @@ def patchipa(source: str, gadget_version: str, codesign_signature: str, provisio 'Android 7 and up. This option can not be used with the --skip-resources flag.') @click.option('--skip-resources', '-D', is_flag=True, default=False, help='Skip resource decoding as part of the apktool processing.', show_default=False) +@click.option('--skip-signing', '-C', is_flag=True, default=False, + help='Skip signing the apk file.', show_default=False) @click.option('--target-class', '-t', help='The target class to patch.', default=None) @click.option('--use-aapt2', '-2', is_flag=True, default=False, help='Use the aapt2 binary instead of aapt as part of the apktool processing.', show_default=False) @@ -278,7 +280,7 @@ def patchipa(source: str, gadget_version: str, codesign_signature: str, provisio @click.option('--manifest', '-m', help='A decoded AndroidManifest.xml file to read.', default=None) def patchapk(source: str, architecture: str, gadget_version: str, pause: bool, skip_cleanup: bool, enable_debug: bool, skip_resources: bool, network_security_config: bool, target_class: str, - use_aapt2: bool, gadget_config: str, script_source: str, ignore_nativelibs: bool, manifest: str) -> None: + use_aapt2: bool, gadget_config: str, script_source: str, ignore_nativelibs: bool, manifest: str, skip_signing: bool) -> None: """ Patch an APK with the frida-gadget.so. """