soot.jimple.infoflow.data.pathBuilders.DefaultPathBuilderFactory.PathBuilder Java Examples

The following examples show how to use soot.jimple.infoflow.data.pathBuilders.DefaultPathBuilderFactory.PathBuilder. 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: SmartConstantDataExtractorFuzzyAnalysis.java    From FuzzDroid with Apache License 2.0 6 votes vote down vote up
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);
		}
	}
 
Example #2
Source File: StringToPrimitiveTypeFuzzer.java    From FuzzDroid with Apache License 2.0 6 votes vote down vote up
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();
		}
	}
 
Example #3
Source File: FileFuzzer.java    From FuzzDroid with Apache License 2.0 6 votes vote down vote up
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();
		}
	}
 
Example #4
Source File: OtherTests.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
@Test(timeout=300000)
public void multiSinkTest2() {
   	boolean oldPathAgnosticResults = Infoflow.getPathAgnosticResults();
   	try {
    	Infoflow infoflow = initInfoflow();
    	List<String> epoints = new ArrayList<String>();
    	epoints.add("<soot.jimple.infoflow.test.OtherTestCode: void multiSinkTest2()>");
    	Infoflow.setPathAgnosticResults(false);
    	infoflow.setPathBuilderFactory(new DefaultPathBuilderFactory(PathBuilder.ContextSensitive,
    			true));
		infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
		checkInfoflow(infoflow, 1);
		Assert.assertTrue(infoflow.getResults().isPathBetweenMethods(sink, sourceDeviceId));
		Assert.assertEquals(2, infoflow.getResults().numConnections());
   	}
   	finally {
   		Infoflow.setPathAgnosticResults(oldPathAgnosticResults);
   	}
}
 
Example #5
Source File: Test.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
private static String pathAlgorithmToString(PathBuilder pathBuilder) {
	switch (pathBuilder) {
		case ContextSensitive:
			return "CONTEXTSENSITIVE";
		case ContextInsensitive :
			return "CONTEXTINSENSITIVE";
		case ContextInsensitiveSourceFinder :
			return "SOURCESONLY";
		default :
			return "UNKNOWN";
	}
}
 
Example #6
Source File: FlowDroidLauncher.java    From soot-infoflow-android-iccta with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static String pathAlgorithmToString(PathBuilder pathBuilder) {
	switch (pathBuilder) {
		case ContextSensitive:
			return "CONTEXTSENSITIVE";
		case ContextInsensitive :
			return "CONTEXTINSENSITIVE";
		case ContextInsensitiveSourceFinder :
			return "SOURCESONLY";
		default :
			return "UNKNOWN";
	}
}
 
Example #7
Source File: SetupApplication.java    From JAADAS with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Sets the algorithm to be used for reconstructing the paths between sources and sinks
 * 
 * @param builder
 *            The path reconstruction algorithm to be used
 */
public void setPathBuilder(PathBuilder builder) {
	this.pathBuilder = builder;
}