soot-oss / soot

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

Does soot suport multidex? #772

Closed jacoryjin closed 6 years ago

jacoryjin commented 7 years ago

Does soot suport multidex? An apk has class.dex, class1.dex, raise warn with not found activity

xwlin-roy commented 7 years ago

It seems Soot has not supported multidex now. #565

mbenz89 commented 7 years ago

Have you tried the -process-multiple-dex option? Soot should be able to handle APKs with multiple dex files with that option. It should still have problems with writing out, though.

jacoryjin commented 7 years ago

@XingweiLin ,@mbenz89,Thank you for the answers! Options.v().set_process_multiple_dex(true); doesn't work in my code; I'm found another way: 1、translate .apk to .jar with enjarify; 2、soot-infoflow-android->SetupApplication.java->initializeSoot(), changed: Options.v().set_process_dir(Collections.singletonList(apkFileLocation)); Options.v().set_src_prec(Options.src_prec_apk_class_jimple); To Options.v().set_process_dir(Collections.singletonList("E:/app-release.jar")); Options.v().set_src_prec(Options.src_prec_java); It likes work in my work

mbenz89 commented 7 years ago

Have you tried setting Options.v().set_process_multiple_dex(true); inside of soot-infoflow-android->SetupApplication.java->initializeSoot()? The Soot options are overwritten there, thus it doesn't change anything if the options are altered before any calls to SetupApplication.

Btw. you do not need to change the source code of SetupApplication. Instead, you can override the SootConfigForAndroid class and pass it to SetupApplication:


SetupApplication setupApplication = new SetupApplication(jarPath,apkPath);

SootConfigForAndroid sootConf = new SootConfigForAndroid() {
            @Override
            public void setSootOptions(Options options) {
                // we need to specify soot options here since FlowDroid resets them
                super.setSootOptions(options);
                options.set_process_multiple_dex(true);
            }
};
setupApplication.setSootConfig(sootConf);
shengliangd commented 5 years ago

It took me quite a while to find this solution :(

mbenz89 commented 5 years ago

It's always a good idea to look at Soot's options to see what is possible and what might not be.

Unfortunately, we do not have the manpower to maintain Soot's documentation very well. We would thus be happy if you could contribute and maybe add a wiki page on how to use Soot with android.

shengliangd commented 5 years ago

I'm using FlowDroid(thus using Soot indirectly) and IC3 these days, encountered many problems. Very willing to help after getting them work together properly.

StevenArzt commented 5 years ago

@mbenz89 It's even easier than that, because FlowDroid has an explicit option for multi-dex support:

setupApplication.getConfig().setMergeDexFiles(true);