secure-software-engineering / FlowDroid

FlowDroid Static Data Flow Tracker
GNU Lesser General Public License v2.1
1.03k stars 293 forks source link

Try whole-progam mode (-w) error on FlowDroid #492

Closed neupaneprakash closed 1 year ago

neupaneprakash commented 1 year ago

Hello All! While adding some modifications on FlowDroid's code I encounter following error during execution.

[main] ERROR soot.jimple.infoflow.android.SetupApplication$InPlaceInfoflow - Exception during data flow analysis java.lang.RuntimeException: This operation requires resolving level BODIES but android.app.Activity is at resolving level SIGNATURES If you are extending Soot, try to add the following call before calling soot.Main.main(..): Scene.v().addBasicClass(android.app.Activity,BODIES); Otherwise, try whole-program mode (-w). at soot.SootClass.checkLevelIgnoreResolving(SootClass.java:209) at soot.SootClass.checkLevel(SootClass.java:191) at soot.SootMethod.retrieveActiveBody(SootMethod.java:435) at soot.jimple.infoflow.Infoflow.getMethodsForSeeds(Infoflow.java:1212) at soot.jimple.infoflow.Infoflow.runTaintAnalysis(Infoflow.java:465) at soot.jimple.infoflow.Infoflow.runAnalysis(Infoflow.java:321) at soot.jimple.infoflow.Infoflow.runAnalysis(Infoflow.java:257) at soot.jimple.infoflow.android.SetupApplication$InPlaceInfoflow.runAnalysis(SetupApplication.java:1286) at soot.jimple.infoflow.android.SetupApplication.processEntryPoint(SetupApplication.java:1537) at soot.jimple.infoflow.android.SetupApplication.runInfoflow(SetupApplication.java:1472) at soot.jimple.infoflow.android.SetupApplication.runInfoflow(SetupApplication.java:1418) at soot.jimple.infoflow.cmd.MainClass.run(MainClass.java:361) at soot.jimple.infoflow.cmd.MainClass.main(MainClass.java:254)

I have used command line tool with this code: java -jar soot-infoflow-cmd/target/soot-infoflow-cmd-jar-with-dependencies.jar -a ../apks/FlowDroidAliasActivity.apk -p ../Android/Sdk/platforms -s soot-infoflow-android/SourcesAndSinks.txt

and apk file was from the flowdroid test apk itself : FlowDroidAliasActivity.apk Basically, I have following two minor confusion: **1. How to run FlowDroid in whole-program mode (-w)?

  1. How and where to integrate the this hint?** : If you are extending Soot, try to add the following call before calling soot.Main.main(..): Scene.v().addBasicClass(android.app.Activity,BODIES);

Please suggest me some ideas. @StevenArzt @ericbodden

Thanks!

StevenArzt commented 1 year ago

Did you specify a proper directory for Android platform JARs when running FlowDroid, i.e., is the given path correct? Do you have a the correct platform version installed that the APK references in its manifest as target SDK version?

neupaneprakash commented 1 year ago

Thank you sir!

crazyreverser commented 1 year ago

Thank you sir!

How did you solve your problem, could you give some information?

neupaneprakash commented 1 year ago

Thank you sir!

How did you solve your problem, could you give some information?

Sure, I had some issues regarding my code due to which such error was encountered. Simply I fixed that issues and it works for me. Like while iterating over the methods we are supposed to consider only those methods having active body. Everything else are taken care by FlowDroid unless specific changer are made.