Java Code Examples for soot.util.MultiMap

The following examples show how to use soot.util.MultiMap. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: JAADAS   Source File:    License: GNU General Public License v3.0 6 votes vote down vote up
 * Incrementally collects the callback methods for all Android default
 * handlers implemented in the source code. This just processes the contents
 * of the worklist.
 * Note that this operation runs inside Soot, so this method only registers
 * a new phase that will be executed when Soot is next run
public void collectCallbackMethodsIncremental() {
	Transform transform = new Transform("wjtp.ajc", new SceneTransformer() {
		protected void internalTransform(String phaseName, @SuppressWarnings("rawtypes") Map options) {
			// Process the worklist from last time
			System.out.println("Running incremental callback analysis for " + callbackWorklist.size()
					+ " components...");
			MultiMap<String, SootMethodAndClass> workListCopy =
					new HashMultiMap<String, SootMethodAndClass>(callbackWorklist);
			for (String className : workListCopy.keySet()) {
				List<MethodOrMethodContext> entryClasses = new LinkedList<MethodOrMethodContext>();
				for (SootMethodAndClass am : workListCopy.get(className))
				analyzeRechableMethods(Scene.v().getSootClass(className), entryClasses);
			System.out.println("Incremental callback analysis done.");
Example 2
public void onResultsAvailable(IInfoflowCFG cfg, InfoflowResults results) {"FlowDroid has finished. Duration: " + (System.currentTimeMillis() - Main.startTime) +" ms.");
	Main.startTime = System.currentTimeMillis();
	this.results = results;
	if (log.isDebugEnabled()) {
		log.debug("InfoFlow Results");
		MultiMap<ResultSinkInfo, ResultSourceInfo> r = results.getResults();
		for (ResultSinkInfo k : r.keySet()) {
			log.debug("ResultSinkInfo: "+ k);

			for (ResultSourceInfo rsi: r.get(k)) {
				log.debug("  source: "+ rsi);
	}"Starting bytecode instrumentation.");"Adding code to initialize PEPs.");
	Util.initializePePInAllPossibleClasses(Settings.instance.getApkPath());"Build code for new 'WaitPDPActivity"); // building the code has to be done here (not in the Main class, otherwise Jimple validation will fail
	String mainActivityClass = UpdateManifestAndCodeForWaitPDP.getMainActivityName(Settings.instance.getApkPath());
	String packageName = UpdateManifestAndCodeForWaitPDP.getApplicationPackageName(Settings.instance.getApkPath());
	UpdateManifestAndCodeForWaitPDP.updateWaitPDPActivity(packageName, mainActivityClass);
	// update packagename in field of WaitPDP class
	SootClass sc = Scene.v().getSootClass(Settings.INSTRUMENTATION_HELPER_JAVA);
	SootField sf1 = sc.getFieldByName("applicationPackageName");
	Util.changeConstantStringInField(sf1, packageName);"Adding Policy Enforcement Points (PEPs).");
	doAccessControlChecks(cfg);"Instrumentation is done.");
	if (Settings.mustOutputJimple()) {"-------- Dumping Jimple bodies.");