secure-software-engineering / FlowDroid

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

First try using cmd-line tool #84

Closed ycaibb closed 3 years ago

ycaibb commented 5 years ago

It shows: [main] INFO soot.jimple.infoflow.taintWrappers.EasyTaintWrapper - Loaded wrapper entries for 90 classes and 12 exclusions. [main] INFO soot.jimple.infoflow.android.SetupApplication - Initializing Soot... [main] INFO soot.jimple.infoflow.android.SetupApplication - Loading dex files... [main] INFO soot.jimple.infoflow.android.SetupApplication - ARSC file parsing took 0.00856411 seconds [main] INFO soot.jimple.infoflow.android.SetupApplication - Constructing the callgraph... [main] ERROR soot.jimple.infoflow.android.SetupApplication - Could not calculate callback methods java.lang.RuntimeException: This operation requires resolving level HIERARCHY but android.app.Service is at resolving level DANGLING If you are extending Soot, try to add the following call before calling soot.Main.main(..): Scene.v().addBasicClass(android.app.Service,HIERARCHY); Otherwise, try whole-program mode (-w). at soot.SootClass.checkLevelIgnoreResolving(SootClass.java:183) at soot.SootClass.checkLevel(SootClass.java:165) at soot.SootClass.isInterface(SootClass.java:1017) at soot.SootClass.isConcrete(SootClass.java:1035) at soot.jimple.spark.builder.ContextInsensitiveBuilder.handleClass(ContextInsensitiveBuilder.java:132) at soot.jimple.spark.builder.ContextInsensitiveBuilder.build(ContextInsensitiveBuilder.java:109) at soot.jimple.spark.SparkTransformer.internalTransform(SparkTransformer.java:101) at soot.SceneTransformer.transform(SceneTransformer.java:36) at soot.Transform.apply(Transform.java:102) at soot.RadioScenePack.internalApply(RadioScenePack.java:68) at soot.jimple.toolkits.callgraph.CallGraphPack.internalApply(CallGraphPack.java:58) at soot.Pack.apply(Pack.java:117) at soot.jimple.infoflow.android.SetupApplication.constructCallgraphInternal(SetupApplication.java:565) at soot.jimple.infoflow.android.SetupApplication.calculateCallbackMethods(SetupApplication.java:683) at soot.jimple.infoflow.android.SetupApplication.calculateCallbacks(SetupApplication.java:477) at soot.jimple.infoflow.android.SetupApplication.calculateCallbacks(SetupApplication.java:447) at soot.jimple.infoflow.android.SetupApplication.processEntryPoint(SetupApplication.java:1392) at soot.jimple.infoflow.android.SetupApplication.runInfoflow(SetupApplication.java:1361) at soot.jimple.infoflow.android.SetupApplication.runInfoflow(SetupApplication.java:1307) at soot.jimple.infoflow.cmd.MainClass.run(MainClass.java:237) at soot.jimple.infoflow.cmd.MainClass.main(MainClass.java:196) [main] INFO soot.jimple.infoflow.memory.MemoryWarningSystem - Shutting down the memory warning system... The data flow analysis has failed. Error message: This operation requires resolving level HIERARCHY but android.app.Service is at resolving level DANGLING If you are extending Soot, try to add the following call before calling soot.Main.main(..): Scene.v().addBasicClass(android.app.Service,HIERARCHY); Otherwise, try whole-program mode (-w). java.lang.RuntimeException: This operation requires resolving level HIERARCHY but android.app.Service is at resolving level DANGLING If you are extending Soot, try to add the following call before calling soot.Main.main(..): Scene.v().addBasicClass(android.app.Service,HIERARCHY); Otherwise, try whole-program mode (-w). at soot.SootClass.checkLevelIgnoreResolving(SootClass.java:183) at soot.SootClass.checkLevel(SootClass.java:165) at soot.SootClass.isInterface(SootClass.java:1017) at soot.SootClass.isConcrete(SootClass.java:1035) at soot.jimple.spark.builder.ContextInsensitiveBuilder.handleClass(ContextInsensitiveBuilder.java:132) at soot.jimple.spark.builder.ContextInsensitiveBuilder.build(ContextInsensitiveBuilder.java:109) at soot.jimple.spark.SparkTransformer.internalTransform(SparkTransformer.java:101) at soot.SceneTransformer.transform(SceneTransformer.java:36) at soot.Transform.apply(Transform.java:102) at soot.RadioScenePack.internalApply(RadioScenePack.java:68) at soot.jimple.toolkits.callgraph.CallGraphPack.internalApply(CallGraphPack.java:58) at soot.Pack.apply(Pack.java:117) at soot.jimple.infoflow.android.SetupApplication.constructCallgraphInternal(SetupApplication.java:565) at soot.jimple.infoflow.android.SetupApplication.calculateCallbackMethods(SetupApplication.java:683) at soot.jimple.infoflow.android.SetupApplication.calculateCallbacks(SetupApplication.java:477) at soot.jimple.infoflow.android.SetupApplication.calculateCallbacks(SetupApplication.java:447) at soot.jimple.infoflow.android.SetupApplication.processEntryPoint(SetupApplication.java:1392) at soot.jimple.infoflow.android.SetupApplication.runInfoflow(SetupApplication.java:1361) at soot.jimple.infoflow.android.SetupApplication.runInfoflow(SetupApplication.java:1307) at soot.jimple.infoflow.cmd.MainClass.run(MainClass.java:237) at soot.jimple.infoflow.cmd.MainClass.main(MainClass.java:196)

ZackC commented 5 years ago

The error message says to use the -w command line option. Have you tried it?

ycaibb commented 5 years ago

The error message says to use the -w command line option. Have you tried it?

Using the -w command line option? Sorry, I don't understand.

ZackC commented 5 years ago

good point!

I was trying to base my response on the error message in the application

ERROR soot.jimple.infoflow.android.SetupApplication - Could not calculate callback methods java.lang.RuntimeException: This operation requires resolving level HIERARCHY but android.app.Service is at resolving level DANGLING If you are extending Soot, try to add the following call before calling soot.Main.main(..): Scene.v().addBasicClass(android.app.Service,HIERARCHY); Otherwise, try whole-program mode (-w)

But there doesn't seem to be a -w option on my flowdroid jar

How are you running flowdroid?

ycaibb commented 5 years ago

` java -jar soot-infoflow-cmd-jar-with-dependencies.jar -a DroidBench\apk\Aliasing\Merge1.apk -p android-16\android.jar -s SourcesAndSinks.txt

` This is the command.

zentery commented 1 year ago

SO how to resolve it? Please.

StevenArzt commented 1 year ago

If there is still a problem, please open a new issue for it and precisely describe which version of FlowDroid you are using, which app you are trying to analyze, and what your command-line parameters are.

The error message seems to come from Soot. The -w parameter is a Soot parameter anit not recognized, so that's not a valid solution. FlowDroid should configure Soot properly anyway.

One idea: You need to specify the platforms directory from the Android SDK, not an individual JAR file. That's definitely wrong in the command line given above. Further, please use the platforms from the official Android SDK, not any other JAR set.