FAILED: returned non-zero exit status 1 when trying to rename methods or classes
bluecatpixel opened this issue · 1 comments
Hi.
I'm trying to change at least the methods and fields but when I try to rename methods it always returns status 1.
Resuming, with ClassRename or MethodRename fails. Only FieldRename it pass.
Also I tried with signature or without but the result is the same.
Here's an example:
sudo docker run --rm -it -u $(id -u):$(id -g) -v "${PWD}":"/workdir" obfuscapk -o RandomManifest -o FieldRename -o MethodRename -o Rebuild -o NewAlignment -o NewSignature ./app.apk -p
The output is:
`Renaming field declarations: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████|[00:00<00:00, 1228.18file/s]
Renaming field declarations: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████|[00:00<00:00, 2587.13file/s]
Renaming field declarations: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████|[00:04<00:00, 1967.24file/s]
Renaming field declarations: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████|[00:03<00:00, 2132.55file/s]
Renaming field declarations: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████|[00:02<00:00, 2267.69file/s]
Processing multidex: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████|[00:11<00:00, 2.38s/dex]
Renaming field references: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████|[00:12<00:00, 1983.04file/s]
Renaming method declarations: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████|[00:08<00:00, 2931.77file/s]
Renaming method invocations: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████|[00:11<00:00, 2059.52file/s]
Running obfuscators (Rebuild): 50%|█████████████████████████████████████████████████▌ |[01:16<01:15, 25.20s/obfuscator]20/10/2022 19:38:15> [ERROR][obfuscapk.tool.Apktool][build()] Error during build command: I: Using Apktool 2.6.0
I: Smaling smali folder into classes.dex...
I: Smaling smali_classes2 folder into classes2.dex...
I: Smaling smali_classes5 folder into classes5.dex...
I: Smaling smali_classes4 folder into classes4.dex...
Exception in thread "main" org.jf.util.ExceptionWithContext: Exception occurred while writing code_item for method Lch/myesmart/tabletapp/activities/MusicActivity$ElemType;->values()[Lch/myesmart/tabletapp/activities/MusicActivity$ElemType;
at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:1047)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:346)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:301)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:58)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:37)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:426)
at brut.androlib.Androlib.buildNonDefaultSources(Androlib.java:372)
at brut.androlib.Androlib.build(Androlib.java:310)
at brut.androlib.Androlib.build(Androlib.java:276)
at brut.apktool.Main.cmdBuild(Main.java:255)
at brut.apktool.Main.main(Main.java:81)
Caused by: org.jf.util.ExceptionWithContext: Error while writing instruction at code offset 0x2
at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1320)
at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:1043)
... 10 more
Caused by: org.jf.util.ExceptionWithContext: Unsigned short value out of range: 65671
at org.jf.dexlib2.writer.DexDataWriter.writeUshort(DexDataWriter.java:116)
at org.jf.dexlib2.writer.InstructionWriter.write(InstructionWriter.java:356)
at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1280)
... 11 more
20/10/2022 19:38:15> [ERROR][obfuscapk.obfuscation][build_obfuscated_apk()] Error during apk building: Command '['/usr/local/bin/apktool', '--frame-path', '/tmp', 'b', '--force-all', './obfuscation_working_dir/Infoconfort-1.11.18_dev_for_papieri', '-o', './obfuscation_working_dir/Infoconfort-1.11.18_dev_for_papieri_obfuscated.apk']' returned non-zero exit status 1.
20/10/2022 19:38:15> [ERROR][yapsy_loaded_plugin_Rebuild_1.rebuild.Rebuild][obfuscate()] Error during execution of "Rebuild" obfuscator: Command '['/usr/local/bin/apktool', '--frame-path', '/tmp', 'b', '--force-all', './obfuscation_working_dir/Infoconfort-1.11.18_dev_for_papieri', '-o', './obfuscation_working_dir/Infoconfort-1.11.18_dev_for_papieri_obfuscated.apk']' returned non-zero exit status 1.
20/10/2022 19:38:15> [CRITICAL][obfuscapk.main][perform_obfuscation()] Error during obfuscation: Command '['/usr/local/bin/apktool', '--frame-path', '/tmp', 'b', '--force-all', './obfuscation_working_dir/Infoconfort-1.11.18_dev_for_papieri', '-o', './obfuscation_working_dir/Infoconfort-1.11.18_dev_for_papieri_obfuscated.apk']' returned non-zero exit status 1.
Traceback (most recent call last):
File "/Obfuscapk/obfuscapk/main.py", line 153, in perform_obfuscation
(obfuscator_name_to_function[obfuscator_name])(obfuscation)
File "/Obfuscapk/obfuscapk/obfuscators/rebuild/rebuild.py", line 20, in obfuscate
obfuscation_info.build_obfuscated_apk()
File "/Obfuscapk/obfuscapk/obfuscation.py", line 555, in build_obfuscated_apk
apktool.build(
File "/Obfuscapk/obfuscapk/tool.py", line 166, in build
output = subprocess.check_output(
File "/usr/local/lib/python3.10/subprocess.py", line 420, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/local/lib/python3.10/subprocess.py", line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/local/bin/apktool', '--frame-path', '/tmp', 'b', '--force-all', './obfuscation_working_dir/Infoconfort-1.11.18_dev_for_papieri', '-o', './obfuscation_working_dir/Infoconfort-1.11.18_dev_for_papieri_obfuscated.apk']' returned non-zero exit status 1.
Running obfuscators (Rebuild): 50%|█████████████████████████████████████████████████▌ |[01:52<01:52, 37.38s/obfuscator]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Obfuscapk/obfuscapk/cli.py", line 189, in
main()
File "/Obfuscapk/obfuscapk/cli.py", line 171, in main
perform_obfuscation(
File "/Obfuscapk/obfuscapk/main.py", line 153, in perform_obfuscation
(obfuscator_name_to_function[obfuscator_name])(obfuscation)
File "/Obfuscapk/obfuscapk/obfuscators/rebuild/rebuild.py", line 20, in obfuscate
obfuscation_info.build_obfuscated_apk()
File "/Obfuscapk/obfuscapk/obfuscation.py", line 555, in build_obfuscated_apk
apktool.build(
File "/Obfuscapk/obfuscapk/tool.py", line 166, in build
output = subprocess.check_output(
File "/usr/local/lib/python3.10/subprocess.py", line 420, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/local/lib/python3.10/subprocess.py", line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/local/bin/apktool', '--frame-path', '/tmp', 'b', '--force-all', './obfuscation_working_dir/Infoconfort-1.11.18_dev_for_papieri', '-o', './obfuscation_working_dir/Infoconfort-1.11.18_dev_for_papieri_obfuscated.apk']' returned non-zero exit status 1.
`
Thanks in advance.
Best regards.
José
Caused by: org.jf.util.ExceptionWithContext: Unsigned short value out of range: 65671
Unfortunately it's a known issue (see #19 (comment)).