我正在尝试获取 apk 文件的调用图。我运行下面的代码。但后来当我检查 sootOutput 文件时,它是空的!有任何想法吗?PS:它打印图形的大小并且没有错误!
先感谢您
import java.io.IOException;
import java.util.Collections;
import org.xmlpull.v1.XmlPullParserException;
import soot.PackManager;
import soot.Scene;
import soot.SootMethod;
import soot.jimple.infoflow.android.SetupApplication;
import soot.options.Options;
public class call {
public call() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
// TODO Auto-generated method stub
SetupApplication app = new SetupApplication("D:\\Users\\ML\\AppData\\Local\\Android\\sdk\\platforms","D:/b.apk");
try {
app.calculateSourcesSinksEntrypoints("C:\\Users\\ML\\workspace\\Graph\\1.txt");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XmlPullParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
soot.G.reset();
Options.v().set_src_prec(Options.src_prec_apk);
Options.v().set_process_dir(Collections.singletonList("D:/b.apk"));
Options.v().set_android_jars("D:\\Users\\ML\\AppData\\Local\\Android\\sdk\\platforms");
Options.v().set_whole_program(true);
Options.v().set_allow_phantom_refs(true);
Options.v().set_output_format(Options.output_format_boutput_format_class);
Options.v().setPhaseOption("cg.spark", "on");
Scene.v().loadNecessaryClasses();
SootMethod entryPoint = app.getEntryPointCreator().createDummyMain();
Options.v().set_main_class(entryPoint.getSignature());
Scene.v().setEntryPoints(Collections.singletonList(entryPoint));
//System.out.println(entryPoint.getActiveBody());
PackManager.v().runPacks();
System.out.println(Scene.v().getCallGraph().size());
}
}