private void runAnalysis(final Set<Unit> targetUnits) { try { Scene.v().getOrMakeFastHierarchy(); InplaceInfoflow infoflow = new InplaceInfoflow(); // InfoflowConfiguration.setAccessPathLength(2); infoflow.setPathBuilderFactory(new DefaultPathBuilderFactory( PathBuilder.ContextSensitive, true)); infoflow.setTaintWrapper(new EasyTaintWrapper(TAINT_WRAPPER_PATH)); infoflow.getConfig().setEnableExceptionTracking(false); infoflow.getConfig().setEnableArraySizeTainting(false); // infoflow.getConfig().setCallgraphAlgorithm(CallgraphAlgorithm.CHA); System.out.println("Running data flow analysis..."); PermissionMethodParser pmp = PermissionMethodParser.fromFile(SOURCES_SINKS_FILE); AccessPathBasedSourceSinkManager srcSinkManager = new AccessPathBasedSourceSinkManager(pmp.getSources(), pmp.getSinks()); infoflow.addResultsAvailableHandler(new FuzzerResultsAvailableHandler(pmp.getSources(), targetUnits)); infoflow.runAnalysis(srcSinkManager); } catch (IOException ex) { throw new RuntimeException("Could not read source/sink file", ex); } }
private void runDataflowAnalysis() { try{ Scene.v().getOrMakeFastHierarchy(); InplaceInfoflow infoflow = new InplaceInfoflow(); infoflow.setPathBuilderFactory(new DefaultPathBuilderFactory( PathBuilder.ContextSensitive, true)); infoflow.setTaintWrapper(new EasyTaintWrapper(TAINT_WRAPPER_PATH)); infoflow.getConfig().setEnableExceptionTracking(false); infoflow.getConfig().setEnableArraySizeTainting(false); // infoflow.getConfig().setCallgraphAlgorithm(CallgraphAlgorithm.CHA); System.out.println("Running data flow analysis..."); PermissionMethodParser pmp = PermissionMethodParser.fromFile(SOURCES_SINKS_FILE); AccessPathBasedSourceSinkManager srcSinkManager = new AccessPathBasedSourceSinkManager(pmp.getSources(), pmp.getSinks()); infoflow.addResultsAvailableHandler(new StringToPrimitiveTypeExtractorDataflowHandler(valuesToFuzz)); infoflow.runAnalysis(srcSinkManager); }catch(Exception ex) { ex.printStackTrace(); } }
private void runDataflowAnalysis() { try{ Scene.v().getOrMakeFastHierarchy(); InplaceInfoflow infoflow = new InplaceInfoflow(); // InfoflowConfiguration.setAccessPathLength(2); infoflow.setPathBuilderFactory(new DefaultPathBuilderFactory( PathBuilder.ContextSensitive, true)); infoflow.setTaintWrapper(new EasyTaintWrapper(TAINT_WRAPPER_PATH)); infoflow.getConfig().setEnableExceptionTracking(false); infoflow.getConfig().setEnableArraySizeTainting(false); // infoflow.getConfig().setCallgraphAlgorithm(CallgraphAlgorithm.CHA); System.out.println("Running data flow analysis..."); PermissionMethodParser pmp = PermissionMethodParser.fromFile(SOURCES_SINKS_FILE); AccessPathBasedSourceSinkManager srcSinkManager = new AccessPathBasedSourceSinkManager(pmp.getSources(), pmp.getSinks()); infoflow.addResultsAvailableHandler(new FileFuzzerResultsAvailableHandler(fileFormatsFromDataflow)); infoflow.runAnalysis(srcSinkManager); }catch(Exception ex) { ex.printStackTrace(); } }
public SetupApplicationJIT(String apkFileLocation, String sootCP, ISourceSinkDefinitionProvider sourceSinkProvider) { this.apkFileLocation = apkFileLocation; this.sootCP = sootCP; try { // Load Android callbacks this.androidCallbacks = Activator.getDefault().getAndroidCallbacks(); // Process manifest ProcessManifest processMan = new ProcessManifest(apkFileLocation); this.appPackageName = processMan.getPackageName(); this.entrypoints = processMan.getEntryPointClasses(); // Parse the resource file ARSCFileParser resParser = new ARSCFileParser(); resParser.parse(apkFileLocation); this.resourcePackages = resParser.getPackages(); // LayoutFileParser LayoutFileParser lfp = new LayoutFileParser(this.appPackageName, resParser); lfp.parseLayoutFile(apkFileLocation, entrypoints); // Create the SourceSinkManager Set<SootMethodAndClass> callbacks = new HashSet<>(); for (Set<SootMethodAndClass> methods : this.callbackMethods.values()) callbacks.addAll(methods); sourceSinkManager = new AccessPathBasedSourceSinkManager(sourceSinkProvider.getSources(), sourceSinkProvider.getSinks(), callbacks, LayoutMatchingMode.MatchSensitiveOnly, lfp == null ? null : lfp.getUserControlsByID()); sourceSinkManager.setAppPackageName(this.appPackageName); sourceSinkManager.setResourcePackages(this.resourcePackages); sourceSinkManager.setEnableCallbackSources(true); } catch (IOException | XmlPullParserException e) { LOGGER.error("Error initializing " + apkFileLocation); } }
public AccessPathBasedSourceSinkManager getSourceSinkManager() { return sourceSinkManager; }
/** * Gets the source/sink manager constructed for FlowDroid. Make sure to call calculateSourcesSinksEntryPoints() * first, or you will get a null result. * * @return FlowDroid's source/sink manager */ public AccessPathBasedSourceSinkManager getSourceSinkManager() { return sourceSinkManager; }