Java Code Examples for soot.jimple.infoflow.android.SetupApplication#setTaintWrapper()

The following examples show how to use soot.jimple.infoflow.android.SetupApplication#setTaintWrapper() . 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: JUnitTests.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Analyzes the given APK file for data flows
 * @param fileName The full path and file name of the APK file to analyze
 * @param enableImplicitFlows True if implicit flows shall be tracked,
 * otherwise false
 * @return The data leaks found in the given APK file
 * @throws IOException Thrown if the given APK file or any other required
 * file could not be found
 * @throws XmlPullParserException Thrown if the Android manifest file could
 * not be read.
 */
public InfoflowResults analyzeAPKFile(String fileName, boolean enableImplicitFlows)
		throws IOException, XmlPullParserException {
	String androidJars = System.getenv("ANDROID_JARS");
	if (androidJars == null)
		androidJars = System.getProperty("ANDROID_JARS");
	if (androidJars == null)
		throw new RuntimeException("Android JAR dir not set");
	System.out.println("Loading Android.jar files from " + androidJars);

	String droidBenchDir = System.getenv("DROIDBENCH");
	if (droidBenchDir == null)
		droidBenchDir = System.getProperty("DROIDBENCH");
	if (droidBenchDir == null)
		throw new RuntimeException("DroidBench dir not set");		
	System.out.println("Loading DroidBench from " + droidBenchDir);
	
	SetupApplication setupApplication = new SetupApplication(androidJars,
			droidBenchDir + File.separator + fileName);
	setupApplication.setTaintWrapper(new EasyTaintWrapper("EasyTaintWrapperSource.txt"));
	setupApplication.calculateSourcesSinksEntrypoints("SourcesAndSinks.txt");
	setupApplication.setEnableImplicitFlows(enableImplicitFlows);
	return setupApplication.runInfoflow();
}
 
Example 2
Source File: JUnitTests.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Analyzes the given APK file for data flows with a given xml file
 * @param apkFileName The full path and file name of the APK file to analyze
 * @param xmlFileName The full path and file name of the xml file where sources and sinks are defined
 * @param enableImplicitFlows True if implicit flows shall be tracked,
 * otherwise false
 * @return The data leaks found in the given APK file
 * @throws IOException Thrown if the given APK file or any other required
 * file could not be found
 * @throws XmlPullParserException Thrown if the Android manifest file could
 * not be read.
 */
public InfoflowResults analyzeAPKFile(String apkFileName, String xmlFileName, boolean enableImplicitFlows, boolean enableStaticFields, boolean flowSensitiveAliasing)
				throws IOException, XmlPullParserException {
	String androidJars = System.getenv("ANDROID_JARS");
	if (androidJars == null)
		androidJars = System.getProperty("ANDROID_JARS");
	if (androidJars == null)
		throw new RuntimeException("Android JAR dir not set");
	System.out.println("Loading Android.jar files from " + androidJars);
	
	SetupApplication setupApplication = new SetupApplication(androidJars, apkFileName);
	setupApplication.setTaintWrapper(new EasyTaintWrapper("EasyTaintWrapperSource.txt"));
	setupApplication.calculateSourcesSinksEntrypoints(xmlFileName);
	setupApplication.setEnableImplicitFlows(enableImplicitFlows);
	setupApplication.setEnableStaticFieldTracking(enableStaticFields);
	setupApplication.setFlowSensitiveAliasing(flowSensitiveAliasing);
	return setupApplication.runInfoflow();
}
 
Example 3
Source File: JUnitTests.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Analyzes the given APK file for data flows
 * @param fileName The full path and file name of the APK file to analyze
 * @param enableImplicitFlows True if implicit flows shall be tracked,
 * otherwise false
 * @param enableStaticFields True if taints in static fields shall be tracked,
 * otherwise false
 * @param flowSensitiveAliasing True if a flow-sensitive alias analysis
 * shall be used, otherwise false
 * @return The data leaks found in the given APK file
 * @throws IOException Thrown if the given APK file or any other required
 * file could not be found
 * @throws XmlPullParserException Thrown if the Android manifest file could
 * not be read.
 */
public InfoflowResults analyzeAPKFile(String fileName, boolean enableImplicitFlows,
		boolean enableStaticFields, boolean flowSensitiveAliasing)
				throws IOException, XmlPullParserException {
	String androidJars = System.getenv("ANDROID_JARS");
	if (androidJars == null)
		androidJars = System.getProperty("ANDROID_JARS");
	if (androidJars == null)
		throw new RuntimeException("Android JAR dir not set");
	System.out.println("Loading Android.jar files from " + androidJars);
	
	SetupApplication setupApplication = new SetupApplication(androidJars, fileName);
	setupApplication.setTaintWrapper(new EasyTaintWrapper("EasyTaintWrapperSource.txt"));
	setupApplication.calculateSourcesSinksEntrypoints("SourcesAndSinks.txt");
	setupApplication.setEnableImplicitFlows(enableImplicitFlows);
	setupApplication.setEnableStaticFieldTracking(enableStaticFields);
	setupApplication.setFlowSensitiveAliasing(flowSensitiveAliasing);
	return setupApplication.runInfoflow();
}
 
Example 4
Source File: InsecureBankTests.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Analyzes the given APK file for data flows
 * @param enableImplicitFlows True if implicit flows shall be tracked,
 * otherwise false
 * @return The data leaks found in the given APK file
 * @throws IOException Thrown if the given APK file or any other required
 * file could not be found
 * @throws XmlPullParserException Thrown if the Android manifest file could
 * not be read.
 */
private InfoflowResults analyzeAPKFile(boolean enableImplicitFlows) throws IOException, XmlPullParserException {
	String androidJars = System.getenv("ANDROID_JARS");
	if (androidJars == null)
		androidJars = System.getProperty("ANDROID_JARS");
	if (androidJars == null)
		throw new RuntimeException("Android JAR dir not set");
	System.out.println("Loading Android.jar files from " + androidJars);
	
	SetupApplication setupApplication = new SetupApplication(androidJars,
			"insecureBank" + File.separator + "InsecureBank.apk");
	setupApplication.setTaintWrapper(new EasyTaintWrapper("EasyTaintWrapperSource.txt"));
	setupApplication.setEnableImplicitFlows(enableImplicitFlows);
	setupApplication.setLayoutMatchingMode(LayoutMatchingMode.MatchAll);
	setupApplication.calculateSourcesSinksEntrypoints("SourcesAndSinks.txt");
	return setupApplication.runInfoflow();
}