<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi all,<br>
<div class="moz-forward-container"> I obtained the call graph of an
Android APK with this code:<br>
<br>
<br>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
File apk = new File("./libs/snake.apk");<br>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
File sAs = new File("./src/main/resources/SourcesAndSinks.txt");<br>
File androidJar = new
File("/home/simo/android-sdk-linux/platforms/");<br>
soot.G.reset();<br>
SetupApplication setupApplication = new
SetupApplication(androidJar.toString(), apk.toString());<br>
setupApplication.calculateSourcesSinksEntrypoints(sAs.toString());<br>
Options.v().set_src_prec(Options.src_prec_apk);<br>
Options.v().set_soot_classpath("/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jce.jar:.");<br>
Options.v().set_process_dir(Collections.singletonList(apk.toString()));<br>
Options.v().set_android_jars(androidJar.toString());<br>
Options.v().set_whole_program(true);<br>
Options.v().set_allow_phantom_refs(true);<br>
Options.v().set_output_format(Options.output_format_none);<br>
Options.v().setPhaseOption("cg.spark", "on");<br>
Scene.v().loadNecessaryClasses();<br>
SootMethod entryPoint =
setupApplication.getEntryPointCreator().createDummyMain();<br>
Options.v().set_main_class(entryPoint.getSignature());<br>
Scene.v().setEntryPoints(Collections.singletonList(entryPoint));<br>
PackManager.v().runPacks();<br>
CallGraph callGraph = Scene.v().getCallGraph();<br>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<br>
And I have several questions:<br>
<ol>
<li>is the right way for obtain the call graph?</li>
<li>how can I get other entry points? (e.g. main activity,
content provider, broadcast receivers, ecc.)</li>
<li>why there are also classes belonging to the API? can I
exclude them from the graph creation? i.e. I do not care about
arcs that have source and destination belonging to API methods</li>
</ol>
<br>
</div>
<br>
</body>
</html>