Apk Obfuscation and apktoll error i think
gituu4567 opened this issue · 0 comments
this one is Kotlin code and i got this error. and there is a second log with java apk which shows the same can anyone please guide me.
at first i got error during installations but then i got it fixed and its working like this
python3 -m obfuscapk.cli -o RandomManifest -o Rebuild -o NewAlignment -o NewSignature app-debug.apk
not working on docker even if i build it with docker
┌──(kali㉿kali)-[~/Obfuscapk/src]
└─$ python3 -m obfuscapk.cli -o RandomManifest -o Rebuild -o NewAlignment -o NewSignature app-debug.apk
07/11/2023 04:14:30> [ERROR][obfuscapk.tool.Apktool][build()] Error during build command: Picked up JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
I: Using Apktool 2.7.0-dirty
I: Smaling smali folder into classes.dex...
I: Smaling smali_classes5 folder into classes5.dex...
I: Smaling smali_classes9 folder into classes9.dex...
I: Smaling smali_classes8 folder into classes8.dex...
I: Smaling smali_classes6 folder into classes6.dex...
I: Smaling smali_classes2 folder into classes2.dex...
I: Smaling smali_classes4 folder into classes4.dex...
I: Smaling smali_classes3 folder into classes3.dex...
I: Smaling smali_classes7 folder into classes7.dex...
I: Building resources...
W: aapt: brut.common.BrutException: brut.common.BrutException: Could not extract resource: /prebuilt/linux/aapt_64 (defaulting to $PATH binary)
W: res/drawable/$avd_hide_password__0.xml: Invalid file name: must contain only [a-z0-9.]
W: res/drawable/$avd_hide_password__1.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$avd_hide_password__2.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$avd_show_password__0.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$avd_show_password__1.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable/$avd_show_password__2.xml: Invalid file name: must contain only [a-z0-9_.]
W: res/drawable-v24/$ic_launcher_foreground__0.xml: Invalid file name: must contain only [a-z0-9_.]
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [aapt, p, --min-sdk-version, 21, --target-sdk-version, 32, --version-code, 1, --version-name, 1.0, --no-version-vectors, -F, /tmp/APKTOOL10260056779978728007.tmp, -0, resources.arsc, -0, META-INF/androidx.activity_activity-compose.version, -0, META-INF/androidx.activity_activity-ktx.version, -0, META-INF/androidx.activity_activity.version, -0, META-INF/androidx.annotation_annotation-experimental.version, -0, META-INF/androidx.appcompat_appcompat-resources.version, -0, META-INF/androidx.appcompat_appcompat.version, -0, META-INF/androidx.arch.core_core-runtime.version, -0, META-INF/androidx.autofill_autofill.version, -0, META-INF/androidx.cardview_cardview.version, -0, META-INF/androidx.compose.animation_animation-core.version, -0, META-INF/androidx.compose.animation_animation.version, -0, META-INF/androidx.compose.foundation_foundation-layout.version, -0, META-INF/androidx.compose.foundation_foundation.version, -0, META-INF/androidx.compose.material3_material3.version, -0, META-INF/androidx.compose.material_material-icons-core.version, -0, META-INF/androidx.compose.material_material-ripple.version, -0, META-INF/androidx.compose.material_material.version, -0, META-INF/androidx.compose.runtime_runtime-saveable.version, -0, META-INF/androidx.compose.runtime_runtime.version, -0, META-INF/androidx.compose.ui_ui-geometry.version, -0, META-INF/androidx.compose.ui_ui-graphics.version, -0, META-INF/androidx.compose.ui_ui-test-manifest.version, -0, META-INF/androidx.compose.ui_ui-text.version, -0, META-INF/androidx.compose.ui_ui-tooling-data.version, -0, META-INF/androidx.compose.ui_ui-tooling-preview.version, -0, META-INF/androidx.compose.ui_ui-tooling.version, -0, META-INF/androidx.compose.ui_ui-unit.version, -0, META-INF/androidx.compose.ui_ui-util.version, -0, META-INF/androidx.compose.ui_ui.version, -0, META-INF/androidx.coordinatorlayout_coordinatorlayout.version, -0, META-INF/androidx.core_core-ktx.version, -0, META-INF/androidx.core_core.version, -0, META-INF/androidx.cursoradapter_cursoradapter.version, -0, META-INF/androidx.customview_customview-poolingcontainer.version, -0, META-INF/androidx.customview_customview.version, -0, META-INF/androidx.documentfile_documentfile.version, -0, META-INF/androidx.drawerlayout_drawerlayout.version, -0, META-INF/androidx.dynamicanimation_dynamicanimation.version, -0, META-INF/androidx.emoji2_emoji2-views-helper.version, -0, META-INF/androidx.emoji2_emoji2.version, -0, META-INF/androidx.fragment_fragment.version, -0, META-INF/androidx.interpolator_interpolator.version, -0, META-INF/androidx.legacy_legacy-support-core-utils.version, -0, META-INF/androidx.lifecycle_lifecycle-livedata-core.version, -0, META-INF/androidx.lifecycle_lifecycle-livedata.version, -0, META-INF/androidx.lifecycle_lifecycle-process.version, -0, META-INF/androidx.lifecycle_lifecycle-runtime-ktx.version, -0, META-INF/androidx.lifecycle_lifecycle-runtime.version, -0, META-INF/androidx.lifecycle_lifecycle-viewmodel-ktx.version, -0, META-INF/androidx.lifecycle_lifecycle-viewmodel-savedstate.version, -0, META-INF/androidx.lifecycle_lifecycle-viewmodel.version, -0, META-INF/androidx.loader_loader.version, -0, META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version, -0, META-INF/androidx.print_print.version, -0, META-INF/androidx.profileinstaller_profileinstaller.version, -0, META-INF/androidx.recyclerview_recyclerview.version, -0, META-INF/androidx.savedstate_savedstate-ktx.version, -0, META-INF/androidx.savedstate_savedstate.version, -0, META-INF/androidx.startup_startup-runtime.version, -0, META-INF/androidx.tracing_tracing.version, -0, META-INF/androidx.transition_transition.version, -0, META-INF/androidx.vectordrawable_vectordrawable-animated.version, -0, META-INF/androidx.vectordrawable_vectordrawable.version, -0, META-INF/androidx.versionedparcelable_versionedparcelable.version, -0, META-INF/androidx.viewpager2_viewpager2.version, -0, META-INF/androidx.viewpager_viewpager.version, -0, META-INF/com.google.android.material_material.version, -0, META-INF/kotlinx_coroutines_android.version, -0, META-INF/kotlinx_coroutines_core.version, -0, jpg, -0, png, -0, webp, -0, arsc, -I, /tmp/1.apk, -S, /home/kali/Obfuscapk/src/obfuscation_working_dir/app-debug/res, -M, /home/kali/Obfuscapk/src/obfuscation_working_dir/app-debug/AndroidManifest.xml]
07/11/2023 04:14:30> [ERROR][obfuscapk.obfuscation][build_obfuscated_apk()] Error during apk building: Command '['/usr/bin/apktool', '--frame-path', '/tmp', 'b', '--force-all', 'obfuscation_working_dir/app-debug', '-o', 'obfuscation_working_dir/app-debug_obfuscated.apk']' returned non-zero exit status 1.
07/11/2023 04:14:30> [ERROR][yapsy_loaded_plugin_Rebuild_1.rebuild.Rebuild][obfuscate()] Error during execution of "Rebuild" obfuscator: Command '['/usr/bin/apktool', '--frame-path', '/tmp', 'b', '--force-all', 'obfuscation_working_dir/app-debug', '-o', 'obfuscation_working_dir/app-debug_obfuscated.apk']' returned non-zero exit status 1.
07/11/2023 04:14:30> [CRITICAL][obfuscapk.main][perform_obfuscation()] Error during obfuscation: Command '['/usr/bin/apktool', '--frame-path', '/tmp', 'b', '--force-all', 'obfuscation_working_dir/app-debug', '-o', 'obfuscation_working_dir/app-debug_obfuscated.apk']' returned non-zero exit status 1.
Traceback (most recent call last):
File "/home/kali/Obfuscapk/src/obfuscapk/main.py", line 153, in perform_obfuscation
(obfuscator_name_to_function[obfuscator_name])(obfuscation)
File "/home/kali/Obfuscapk/src/obfuscapk/obfuscators/rebuild/rebuild.py", line 20, in obfuscate
obfuscation_info.build_obfuscated_apk()
File "/home/kali/Obfuscapk/src/obfuscapk/obfuscation.py", line 542, in build_obfuscated_apk
apktool.build(
File "/home/kali/Obfuscapk/src/obfuscapk/tool.py", line 164, in build
output = subprocess.check_output(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/apktool', '--frame-path', '/tmp', 'b', '--force-all', 'obfuscation_working_dir/app-debug', '-o', 'obfuscation_working_dir/app-debug_obfuscated.apk']' returned non-zero exit status 1.
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/home/kali/Obfuscapk/src/obfuscapk/cli.py", line 189, in
main()
File "/home/kali/Obfuscapk/src/obfuscapk/cli.py", line 171, in main
perform_obfuscation(
File "/home/kali/Obfuscapk/src/obfuscapk/main.py", line 153, in perform_obfuscation
(obfuscator_name_to_function[obfuscator_name])(obfuscation)
File "/home/kali/Obfuscapk/src/obfuscapk/obfuscators/rebuild/rebuild.py", line 20, in obfuscate
obfuscation_info.build_obfuscated_apk()
File "/home/kali/Obfuscapk/src/obfuscapk/obfuscation.py", line 542, in build_obfuscated_apk
apktool.build(
File "/home/kali/Obfuscapk/src/obfuscapk/tool.py", line 164, in build
output = subprocess.check_output(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/apktool', '--frame-path', '/tmp', 'b', '--force-all', 'obfuscation_working_dir/app-debug', '-o', 'obfuscation_working_dir/app-debug_obfuscated.apk']' returned non-zero exit status 1.
┌──(kali㉿kali)-[~/Obfuscapk/src]
└─$ python3 -m obfuscapk.cli -o RandomManifest -o Rebuild -o NewAlignment -o NewSignature old.apk
07/11/2023 04:23:58> [ERROR][obfuscapk.tool.Apktool][build()] Error during build command: Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
I: Using Apktool 2.7.0-dirty
I: Smaling smali folder into classes.dex...
I: Building resources...
W: aapt: brut.common.BrutException: brut.common.BrutException: Could not extract resource: /prebuilt/linux/aapt_64 (defaulting to $PATH binary)
W: First type is not attr!
W: aapt F 11-07 04:23:58 18788 18788] First type is not attr!
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 134): [aapt, p, --min-sdk-version, 11, --target-sdk-version, 21, --version-code, 1, --version-name, 1.0, --no-version-vectors, -F, /tmp/APKTOOL8692889986142150664.tmp, -0, png, -0, arsc, -I, /tmp/1.apk, -S, /home/kali/Obfuscapk/src/obfuscation_working_dir/old/res, -M, /home/kali/Obfuscapk/src/obfuscation_working_dir/old/AndroidManifest.xml]
07/11/2023 04:23:58> [ERROR][obfuscapk.obfuscation][build_obfuscated_apk()] Error during apk building: Command '['/usr/bin/apktool', '--frame-path', '/tmp', 'b', '--force-all', 'obfuscation_working_dir/old', '-o', 'obfuscation_working_dir/old_obfuscated.apk']' returned non-zero exit status 1.
07/11/2023 04:23:58> [ERROR][yapsy_loaded_plugin_Rebuild_1.rebuild.Rebuild][obfuscate()] Error during execution of "Rebuild" obfuscator: Command '['/usr/bin/apktool', '--frame-path', '/tmp', 'b', '--force-all', 'obfuscation_working_dir/old', '-o', 'obfuscation_working_dir/old_obfuscated.apk']' returned non-zero exit status 1.
07/11/2023 04:23:58> [CRITICAL][obfuscapk.main][perform_obfuscation()] Error during obfuscation: Command '['/usr/bin/apktool', '--frame-path', '/tmp', 'b', '--force-all', 'obfuscation_working_dir/old', '-o', 'obfuscation_working_dir/old_obfuscated.apk']' returned non-zero exit status 1.
Traceback (most recent call last):
File "/home/kali/Obfuscapk/src/obfuscapk/main.py", line 153, in perform_obfuscation
(obfuscator_name_to_function[obfuscator_name])(obfuscation)
File "/home/kali/Obfuscapk/src/obfuscapk/obfuscators/rebuild/rebuild.py", line 20, in obfuscate
obfuscation_info.build_obfuscated_apk()
File "/home/kali/Obfuscapk/src/obfuscapk/obfuscation.py", line 542, in build_obfuscated_apk
apktool.build(
File "/home/kali/Obfuscapk/src/obfuscapk/tool.py", line 164, in build
output = subprocess.check_output(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/apktool', '--frame-path', '/tmp', 'b', '--force-all', 'obfuscation_working_dir/old', '-o', 'obfuscation_working_dir/old_obfuscated.apk']' returned non-zero exit status 1.
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/home/kali/Obfuscapk/src/obfuscapk/cli.py", line 189, in
main()
File "/home/kali/Obfuscapk/src/obfuscapk/cli.py", line 171, in main
perform_obfuscation(
File "/home/kali/Obfuscapk/src/obfuscapk/main.py", line 153, in perform_obfuscation
(obfuscator_name_to_function[obfuscator_name])(obfuscation)
File "/home/kali/Obfuscapk/src/obfuscapk/obfuscators/rebuild/rebuild.py", line 20, in obfuscate
obfuscation_info.build_obfuscated_apk()
File "/home/kali/Obfuscapk/src/obfuscapk/obfuscation.py", line 542, in build_obfuscated_apk
apktool.build(
File "/home/kali/Obfuscapk/src/obfuscapk/tool.py", line 164, in build
output = subprocess.check_output(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/apktool', '--frame-path', '/tmp', 'b', '--force-all', 'obfuscation_working_dir/old', '-o', 'obfuscation_working_dir/old_obfuscated.apk']' returned non-zero exit status 1.