soot-oss / soot

Soot - A Java optimization framework
GNU Lesser General Public License v2.1
2.87k stars 706 forks source link

Can soot accept the .dex file as input directly? #1838

Closed 99zikke closed 2 years ago

99zikke commented 2 years ago

There are some shelled apks that I want to analyze. And I get some .dex files after I remove their shells. I want to know can soot accept the .dex file as input directly? I didn't see this option for .dex file in the interface : Options.v().set_src_prec(Options.src_prec_XXX);.

By the way, the reason why I didn't choose the option "Options.v().set_src_prec(Options. src_prec_class);" is that when I use the dex2jar.jar to convert the .dex files to class.jar files, sometimes an error will cause the conversion to fail.

I'd really appreciate it if you could help me.

jpstotz commented 2 years ago

Have you tried to just use Options.src_prec_apk and then provide the dex file as input? I think internally Soot uses the file extension to select the necessary class loader: https://github.com/soot-oss/soot/blob/develop/src/main/java/soot/SourceLocator.java#L114-L123

99zikke commented 2 years ago

@jpstotz Yes, this worked! Thank you very much!