necst / aamo

AAMO: Another Android Malware Obfuscator
MIT License
121 stars 55 forks source link

Program just exits #2

Open ankushgoel27 opened 6 years ago

ankushgoel27 commented 6 years ago

i give the apk as the argument. The program just exits. It happens when i dont give any argument to it.

python obfuscators/obfuscators.py just exits.

ankushgoel27 commented 6 years ago

i have been doing some debugging and the error is "list index out of range". Any idea what it means?

phretor commented 6 years ago

Hi!

Although without the exact output and invocation is hard to understand, I guess it’s due to the fact that the obfuscators.py command expects a directory that contains the APKs as a first argument and the list of obfuscators to apply as the second argument.

See the main() function at the very bottom of obfuscators.py

On Sat, 29 Sep 2018 at 08:36, ankushgoel27 notifications@github.com wrote:

i have been doing some debugging and the error is "list index out of range". Any idea what it means?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/necst/aamo/issues/2#issuecomment-425620866, or mute the thread https://github.com/notifications/unsubscribe-auth/AALxNI9Uc6-gz1iZydcup1TD4wsoP_Wwks5ufxUDgaJpZM4W_hyD .

ankushgoel27 commented 6 years ago

thats the thing, there is no output. I printed the exception and saw list index out of range error. This is how i am running the command - Python obfuscator/obfuscators.py dir_With_apks_to_obfuscate Lib and still no output. No error log. Nothing.

ankushgoel27 commented 6 years ago

obfuscators to apply is already mentioned in the program. I added some obfuscators to the list. Then i ran the program with only 1 argument - dir with apks. And still no output.

ankushgoel27 commented 6 years ago

The error is coming from the apply_dir function

ankushgoel27 commented 6 years ago

i was able to fix few issues. Changed the name of adam_base_dir to base_dir as there is not adam_base_dir. The list out of index error was fixed.Now i was able to get the log file. cat obfuscatorsobfuscators.log DEBUG:root:[dir_with_apks_to_obfus]:Obfuscators Initialize: /opt/aamo/obfuscatorsobfuscators /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus/app DEBUG:root:[dir_with_apks_to_obfus]:Obfuscate Request: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate - ['Lib', 'Raw'] - /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus DEBUG:root:[dir_with_apks_to_obfus]:Backsmali: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate into /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus DEBUG:root:[dir_with_apks_to_obfus]: DEBUG:root:[dir_with_apks_to_obfus]:Input file (/opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus/app) was not found or was not readable.

DEBUG:root:[dir_with_apks_to_obfus]:Obfuscate Start: 2018-09-29 18:34:47.864542 DEBUG:root:[dir_with_apks_to_obfus]:Obfuscator Lib DEBUG:root:[dir_with_apks_to_obfus]:Python Obfuscator! DEBUG:root:[dir_with_apks_to_obfus]:Smali: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate from /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus DEBUG:root:[dir_with_apks_to_obfus]:I: Using Apktool 2.3.4

DEBUG:root:[dir_with_apks_to_obfus]:brut.directory.DirectoryException: java.io.FileNotFoundException: /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus/app (No such file or directory)

DEBUG:root:[dir_with_apks_to_obfus]:### ERROR ### Unable run :apktool b --force-all /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus/app /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate Unable to apply Lib ### ERROR ### DEBUG:root:[dir_with_apks_to_obfus]:### FAILURE ### DEBUG:root:[dir_with_apks_to_obfus]:Obfuscators Initialize: /opt/aamo/obfuscatorsobfuscators /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus/app DEBUG:root:[dir_with_apks_to_obfus]:Obfuscate Request: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate - ['Lib', 'Raw'] - /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus DEBUG:root:[dir_with_apks_to_obfus]:Backsmali: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate into /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus DEBUG:root:[dir_with_apks_to_obfus]: DEBUG:root:[dir_with_apks_to_obfus]:Input file (/opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus/app) was not found or was not readable.

DEBUG:root:[dir_with_apks_to_obfus]:Obfuscate Start: 2018-09-29 18:37:18.994144 DEBUG:root:[dir_with_apks_to_obfus]:Obfuscator Lib DEBUG:root:[dir_with_apks_to_obfus]:Python Obfuscator! DEBUG:root:[dir_with_apks_to_obfus]:Smali: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate from /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus DEBUG:root:[dir_with_apks_to_obfus]:I: Using Apktool 2.3.4

DEBUG:root:[dir_with_apks_to_obfus]:brut.directory.DirectoryException: java.io.FileNotFoundException: /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus/app (No such file or directory)

DEBUG:root:[dir_with_apks_to_obfus]:### ERROR ### Unable run :apktool b --force-all /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus/app /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate Unable to apply Lib ### ERROR ### DEBUG:root:[dir_with_apks_to_obfus]:### FAILURE ### DEBUG:root:[TestApp]:Obfuscators Initialize: /opt/aamo/obfuscatorsobfuscators /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfuscate/TestApp/app DEBUG:root:[TestApp]:Obfuscate Request: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate/TestApp.apk - ['Lib', 'Raw'] - /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfuscate/TestApp DEBUG:root:[TestApp]:Backsmali: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate/TestApp.apk into /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfuscate/TestApp DEBUG:root:[TestApp]: DEBUG:root:[TestApp]:Input file (/opt/aamo/obfuscatorstemp/dir_with_apks_to_obfuscate/TestApp/app) was not found or was not readable.

DEBUG:root:[TestApp]:Obfuscate Start: 2018-09-29 18:37:26.088151 DEBUG:root:[TestApp]:Obfuscator Lib DEBUG:root:[TestApp]:Python Obfuscator! DEBUG:root:[TestApp]:Smali: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate/TestApp.apk from /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfuscate/TestApp DEBUG:root:[TestApp]:I: Using Apktool 2.3.4

DEBUG:root:[TestApp]:brut.directory.DirectoryException: java.io.FileNotFoundException: /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfuscate/TestApp/app (No such file or directory)

DEBUG:root:[TestApp]:### ERROR ### Unable run :apktool b --force-all /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfuscate/TestApp/app /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate/TestApp.apk Unable to apply Lib ### ERROR ### DEBUG:root:[TestApp]:### FAILURE ### DEBUG:root:[dir_with_apks_to_obfus]:Obfuscators Initialize: /opt/aamo/obfuscatorsobfuscators /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus/app DEBUG:root:[dir_with_apks_to_obfus]:Obfuscate Request: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate - ['Lib', 'Raw'] - /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus DEBUG:root:[dir_with_apks_to_obfus]:Backsmali: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate into /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus DEBUG:root:[dir_with_apks_to_obfus]: DEBUG:root:[dir_with_apks_to_obfus]:Input file (/opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus/app) was not found or was not readable.

DEBUG:root:[dir_with_apks_to_obfus]:Obfuscate Start: 2018-09-29 18:38:17.978292 DEBUG:root:[dir_with_apks_to_obfus]:Obfuscator Lib DEBUG:root:[dir_with_apks_to_obfus]:Python Obfuscator! DEBUG:root:[dir_with_apks_to_obfus]:Smali: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate from /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus DEBUG:root:[dir_with_apks_to_obfus]:I: Using Apktool 2.3.4

DEBUG:root:[dir_with_apks_to_obfus]:brut.directory.DirectoryException: java.io.FileNotFoundException: /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus/app (No such file or directory)

DEBUG:root:[dir_with_apks_to_obfus]:### ERROR ### Unable run :apktool b --force-all /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus/app /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate Unable to apply Lib ### ERROR ### DEBUG:root:[dir_with_apks_to_obfus]:### FAILURE ### DEBUG:root:[dir_with_apks_to_obfus]:Obfuscators Initialize: /opt/aamo/obfuscatorsobfuscators /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus/app DEBUG:root:[dir_with_apks_to_obfus]:Obfuscate Request: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate - ['Lib', 'Raw'] - /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus DEBUG:root:[dir_with_apks_to_obfus]:Backsmali: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate into /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus DEBUG:root:[dir_with_apks_to_obfus]: DEBUG:root:[dir_with_apks_to_obfus]:Input file (/opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate) was not found or was not readable.

DEBUG:root:[dir_with_apks_to_obfus]:Obfuscate Start: 2018-09-29 18:40:42.708569 DEBUG:root:[dir_with_apks_to_obfus]:Obfuscator Lib DEBUG:root:[dir_with_apks_to_obfus]:Python Obfuscator! DEBUG:root:[dir_with_apks_to_obfus]:Smali: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate from /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus DEBUG:root:[dir_with_apks_to_obfus]:I: Using Apktool 2.3.4

DEBUG:root:[dir_with_apks_to_obfus]:brut.directory.DirectoryException: java.io.FileNotFoundException: /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus/app (No such file or directory)

DEBUG:root:[dir_with_apks_to_obfus]:### ERROR ### Unable run :apktool b --force-all /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfus/app /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate Unable to apply Lib ### ERROR ### DEBUG:root:[dir_with_apks_to_obfus]:### FAILURE ### DEBUG:root:[TestApp]:Obfuscators Initialize: /opt/aamo/obfuscatorsobfuscators /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfuscate/TestApp/app DEBUG:root:[TestApp]:Obfuscate Request: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate/TestApp.apk - ['Lib', 'Raw'] - /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfuscate/TestApp DEBUG:root:[TestApp]:Backsmali: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate/TestApp.apk into /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfuscate/TestApp DEBUG:root:[TestApp]: DEBUG:root:[TestApp]:Input file (/opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate/TestApp.apk) was not found or was not readable.

DEBUG:root:[TestApp]:Obfuscate Start: 2018-09-29 18:41:47.724197 DEBUG:root:[TestApp]:Obfuscator Lib DEBUG:root:[TestApp]:Python Obfuscator! DEBUG:root:[TestApp]:Smali: /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate/TestApp.apk from /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfuscate/TestApp DEBUG:root:[TestApp]:I: Using Apktool 2.3.4

DEBUG:root:[TestApp]:brut.directory.DirectoryException: java.io.FileNotFoundException: /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfuscate/TestApp/app (No such file or directory)

DEBUG:root:[TestApp]:### ERROR ### Unable run :apktool b --force-all /opt/aamo/obfuscatorstemp/dir_with_apks_to_obfuscate/TestApp/app /opt/aamo/obfuscatorsinput/dir_with_apks_to_obfuscate/TestApp.apk Unable to apply Lib ### ERROR ### DEBUG:root:[TestApp]:### FAILURE ###

ankushgoel27 commented 6 years ago

I think the issue is in the apply_dir function where adam_base_dir is given as input but not defined anywhere. no such dir is created or defined.

ankushgoel27 commented 6 years ago

i was able to fix atleast compiling and decompiling but there are more issues here.

DEBUG:root:[TestApp]:Obfuscators Initialize: /opt/aamo/obfuscatorsobfuscators /opt/aamo/obfuscatorstemp/dir/TestApp/app DEBUG:root:[TestApp]:Obfuscate Request: /opt/aamo/obfuscatorsinput/dir/TestApp.apk - ['Lib', 'Restring'] - /opt/aamo/obfuscatorstemp/dir/TestApp DEBUG:root:[TestApp]:Backsmali: /opt/aamo/obfuscatorsinput/dir/TestApp.apk into /opt/aamo/obfuscatorstemp/dir/TestApp DEBUG:root:[TestApp]:I: Using Apktool 2.3.4 on TestApp.apk I: Loading resource table... I: Decoding AndroidManifest.xml with resources... I: Loading resource table from file: /root/.local/share/apktool/framework/1.apk I: Regular manifest package... I: Decoding file-resources... I: Decoding values / XMLs... I: Baksmaling classes.dex... I: Copying assets and libs... I: Copying unknown files... I: Copying original files...

DEBUG:root:[TestApp]: DEBUG:root:[TestApp]:Obfuscate Start: 2018-09-29 19:36:33.781792 DEBUG:root:[TestApp]:Obfuscator Lib DEBUG:root:[TestApp]:Python Obfuscator! DEBUG:root:[TestApp]:Smali: /opt/aamo/obfuscatorsinput/dir/TestApp.apk from /opt/aamo/obfuscatorstemp/dir/TestApp DEBUG:root:[TestApp]:I: Using Apktool 2.3.4 I: Smaling smali folder into classes.dex... I: Building resources... I: Building apk file... I: Copying unknown files/dir... I: Built apk...

DEBUG:root:[TestApp]:W: warning: string 'switch_off' has no default translation. W: warning: string 'switch_on' has no default translation.

DEBUG:root:[TestApp]:Obfuscator Restring DEBUG:root:[TestApp]:Python Obfuscator! DEBUG:root:[TestApp]:### ERROR ### list index out of range ### ERROR ### DEBUG:root:[TestApp]:### FAILURE ###

ankushgoel27 commented 6 years ago

where is the output file generated?

ismaelsilver commented 6 years ago

Good evening, my friends, sorry to comment on this question, but it was the only pulse that I found it, I can not in any way overshadow my apk, I did everything in the script but it did not work. They could donate me, present the script of yours that is working or fix me to solve, excuse the writing

SamHoque commented 5 years ago

Hi, were you able to fix all of the obfuscation types? I have fixed around 40% of it. I am not a Python dev so It's taking a few for me to fix the error as I read through what all the methods means in the python docs.

ankushgoel27 commented 5 years ago

i am still trying but not able to fix it completely. taking a lot of time.

SamHoque commented 5 years ago

I started yesterday and already fixed 40% of it, It's really simple but there is some major issues that the creator of this lib didn't think about while making it at the time. One of the biggest thing is the lib doesn't support MultiLib

ICommandMachinesObey commented 5 years ago

@LynxKik You're not telling anything useful. how you fixed 40%, what did you do?

SamHoque commented 5 years ago

@ICommandMachinesObey I don't have to tell anything useful, Maybe get basic programming knowledge before trying to use an open source program.

Jasptzx commented 4 years ago

Anyone manage to get it working? I'm still getting the same error messages as above. :(