[Soot-list] "SootClassNotFoundException" for creating dummy main method_ but not always
H S
aras_h1988 at yahoo.com
Wed Jul 16 05:22:04 EDT 2014
Hi :
Here is the code
public void initialiseSoot() throws IOException, XmlPullParserException {
String APKPath=".\\apks\\"+ArgsParser.file;
String AndroidJar=System.getenv("ANDROID_HOME")+"\\platforms";
String forcedPathAndroidJar=System.getenv("ANDROID_HOME")+"\\platforms\\android-17\\android.jar";
soot.G.reset();
Options.v().set_prepend_classpath(true);
Options.v().prepend_classpath();
Options.v().allow_phantom_refs();//new
Options.v().set_allow_phantom_refs(true);
Options.v().whole_program();
Options.v().set_whole_program(true);
Options.v().set_src_prec(Options.src_prec_apk);
Options.v().set_process_dir(Collections.singletonList(APKPath));
Options.v().set_android_jars(AndroidJar);
Options.v().set_force_android_jar(forcedPathAndroidJar);//
//Options.v().set_prepend_classpath(true);
Options.v().set_validate(true);
//Options.v().setPhaseOption("cg.cha", "on");
Options.v().setPhaseOption("cg.spark", "on");
//String outputDirJimple="jimple";
//Options.v().set_output_dir(outputDirJimple);
//Options.v().set_output_format(Options.output_format_jimple);
//Options.v().set_process_dir(Collections.singletonList(APKPath));
//Options.v().setPhaseOption("cg.spark", "rta:true");
//Options.v().setPhaseOption("cg.spark", "vta:true");
Scene.v().loadNecessaryClasses();
Scene.v().loadDynamicClasses();//
Scene.v().loadBasicClasses();//
Scene.v().setPhantomRefs(true);//
//Options.v().soot_classpath();
Options.v().set_soot_classpath(forcedPathAndroidJar);
//PackManager.v().getPack("wjtp");
SetupApplication setupApplication = new SetupApplication(forcedPathAndroidJar, APKPath);
setupApplication.setEnableImplicitFlows(true);
setupApplication.setEnableStaticFieldTracking(true);
setupApplication.setFlowSensitiveAliasing(true);
setupApplication.setEnableCallbacks(true);
//setupApplication.setEnableExceptionTracking(true);
setupApplication.setComputeResultPaths(true);
setupApplication.getSootConfig();//
setupApplication.setTaintWrapper(new EasyTaintWrapper("EasyTaintWrapperSource.txt"));
setupApplication.calculateSourcesSinksEntrypoints("SourcesAndSinks.txt");
androidMethodSetSinks = setupApplication.getSinks();
System.out.println("\n*** Sinks extracted");
androidMethodsSetSources=setupApplication.getSources();
System.out.println("\n*** Sources Extracted");
/**the following has to be called always after calculateSourceSinkEntrypoints**/
AndroidSourceSinkManager androidSourceSinkManager =setupApplication.getSourceSinkManager();
androidSourceSinkManager.setEnableCallbackSources(true);
//androidSourceSinkManager.addSink(androidMethodSet);//TODO
// PackManager.v().runPacks();
//SootMethod entryPoint = setupApplication.getEntryPointCreator().createDummyMain();//TODO// where to put this line?
/**Getting the list of callbacks**/
System.out.println("CallBack\t"+setupApplication.getEntryPointCreator().getCallbackFunctions());//TODO
//Options.v().set_main_class(entryPoint.getSignature());
//Scene.v().setEntryPoints(Collections.singletonList(entryPoint));
//System.out.println(entryPoint.getActiveBody());
ResultsAvailableHandler resultsAvailableHandler = new ResultsAvailableHandler() {
@Override
public void onResultsAvailable(IInfoflowCFG iInfoflowCFG, InfoflowResults infoflowResults) {
}
};
infoflowResults = setupApplication.runInfoflow(resultsAvailableHandler);
//mainActivityExtractor();// Method
//PackManager.v().runPacks();
//PackManager.v().writeOutput();
ArrayList <SootMethod> sootMethodArrayList=onClickExtractor(setupApplication);//Method
addOnClickSinks(sootMethodArrayList);
System.out.println("\n*** InfoflowResults-get: ");
System.out.println(infoflowResults.getResults());
System.out.println("\n*** End-of-InfoflowResults-get ");
System.out.println("\n*** InfoflowResults-print: ");
infoflowResults.printResults();
System.out.println("\n*** End-of-InfoflowResults-print ");
/*if runpack is activated then the size of cal graph will be reduced */
//PackManager.v().runPacks();
System.out.println( "\n*** Size from myCallGraph "+Scene.v().getCallGraph().size());
}
Thank you ,
Sarah
Steven Arzt <Steven.Arzt at cased.de> schrieb am 11:09 Mittwoch, 16.Juli 2014:
Please do post a complete code listing. From the snippet you posted (“beginning of my class”), it is very hard to see which code you placed where.
Von:H S [mailto:aras_h1988 at yahoo.com]
Gesendet: Mittwoch, 16. Juli 2014 11:07
An: Steven Arzt; soot-list at sable.mcgill.ca; soot-list at CS.McGill.CA
Betreff: "SootClassNotFoundException" for creating dummy main method_ but not always
Gesendet über Yahoo Mail für Android
________________________________
From: H S <aras_h1988 at yahoo.com>;
To: Steven Arzt <steven.arzt at cased.de>; soot-list at sable.mcgill.ca <soot-list at sable.mcgill.ca>; soot-list at CS.McGill.CA <soot-list at cs.mcgill.ca>;
Subject: "SootClassNotFoundException" for creating dummy main method_ but not always
Sent: Tue, Jul 15, 2014 6:54:34 PM
Hi :
I got the following error: for creating the dummy main method.
Exception in thread "main" soot.SootResolver$SootClassNotFoundException: couldn't find class: com.example.myapplication4.app.MainActivity (is your soot-class-path set properly?)
at soot.SootResolver.bringToHierarchy(SootResolver.java:219)
at soot.SootResolver.bringToSignatures(SootResolver.java:252)
at soot.SootResolver.processResolveWorklist(SootResolver.java:168)
at soot.SootResolver.resolveClass(SootResolver.java:129)
at soot.Scene.forceResolve(Scene.java:1515)
at soot.jimple.infoflow.entryPointCreators.AndroidEntryPointCreator.createDummyMainInternal(AndroidEntryPointCreator.java:169)
at soot.jimple.infoflow.entryPointCreators.BaseEntryPointCreator.createDummyMainInternal(BaseEntryPointCreator.java:102)
at soot.jimple.infoflow.entryPointCreators.BaseEntryPointCreator.createDummyMain(BaseEntryPointCreator.java:87)
at src.MyCallGraph.onClickExtractor(MyCallGraph.java:144)
at src.MyCallGraph.initialiseSoot(MyCallGraph.java:99)
at src.MyMain.main(MyMain.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
***If I put the following code above the runInfoflow in my code I got the above error.
SootMethod entryPoint = setupApplication.getEntryPointCreator().createDummyMain();
Options.v().set_main_class(entryPoint.getSignature());
Scene.v().setEntryPoints(Collections.singletonList(entryPoint));
System.out.println(entryPoint.getActiveBody());
But after the runInfoflow I did not get it: infoflowResults = setupApplication.runInfoflow(resultsAvailableHandler);
Here is my setup in the beginning of my class:
soot.G.reset();
Options.v().set_prepend_classpath(true);
Options.v().set_src_prec(Options.src_prec_apk);
Options.v().set_process_dir(Collections.singletonList(APKPath));
Options.v().set_android_jars(AndroidJar);
Options.v().set_force_android_jar(forcedPathAndroidJar);//
Options.v().set_whole_program(true);
Options.v().set_allow_phantom_refs(true);
Options.v().setPhaseOption("cg.spark", "on");
Scene.v().loadNecessaryClasses();
Scene.v().loadDynamicClasses();//
Scene.v().loadBasicClasses();//
Scene.v().setPhantomRefs(true);//
Options.v().soot_classpath();
SetupApplication setupApplication = new SetupApplication(forcedPathAndroidJar, APKPath);
setupApplication.setEnableImplicitFlows(true);
setupApplication.setEnableStaticFieldTracking(true);
setupApplication.setFlowSensitiveAliasing(true);
setupApplication.setEnableCallbacks(true);
setupApplication.setComputeResultPaths(true);
setupApplication.getSootConfig();//
setupApplication.setTaintWrapper(new EasyTaintWrapper("EasyTaintWrapperSource.txt"));
setupApplication.calculateSourcesSinksEntrypoints("SourcesAndSinks.txt");
Thank you again,
Sarah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20140716/f053c8d3/attachment-0003.html
More information about the Soot-list
mailing list