soot.util.MultiMap Java Examples
The following examples show how to use
soot.util.MultiMap.
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 File: AnalyzeJimpleClass.java From JAADAS with GNU General Public License v3.0 | 6 votes |
/** * 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)) entryClasses.add(Scene.v().getMethod(am.getSignature())); analyzeRechableMethods(Scene.v().getSootClass(className), entryClasses); callbackWorklist.remove(className); } System.out.println("Incremental callback analysis done."); } }); PackManager.v().getPack("wjtp").add(transform); }
Example #2
Source File: PolicyEnforcementPoint.java From DroidForce with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void onResultsAvailable(IInfoflowCFG cfg, InfoflowResults results) { log.info("FlowDroid has finished. Duration: " + (System.currentTimeMillis() - Main.startTime) +" ms."); Main.startTime = System.currentTimeMillis(); Settings.instance.setDummyMainToLibraryClass(); this.results = results; if (log.isDebugEnabled()) { log.debug(""); 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); } } log.debug(""); } log.info("Starting bytecode instrumentation."); log.info("Adding code to initialize PEPs."); Util.initializePePInAllPossibleClasses(Settings.instance.getApkPath()); log.info("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); log.info("Adding Policy Enforcement Points (PEPs)."); doAccessControlChecks(cfg); log.info("Instrumentation is done."); if (Settings.mustOutputJimple()) { log.info("-------- Dumping Jimple bodies."); Main.dumpJimple(); log.info("--------"); } }