Skip to content

Commit

Permalink
Added the option to skip APK signing. (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darion Reyes authored Sep 10, 2023
1 parent f47926e commit 6c55d7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions objection/commands/mobile_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
"""
Expand Down Expand Up @@ -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')
Expand Down
4 changes: 3 additions & 1 deletion objection/console/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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.
"""
Expand Down

0 comments on commit 6c55d7e

Please sign in to comment.