Java Code Examples for soot.jimple.infoflow.android.axml.AXmlNode#addAttribute()

The following examples show how to use soot.jimple.infoflow.android.axml.AXmlNode#addAttribute() . 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: UtilApk.java    From FuzzDroid with Apache License 2.0 7 votes vote down vote up
@SuppressWarnings("unchecked")
private static void addMaxPrioForSMSReceiver(ProcessManifest manifest) {
	for(AXmlNode receiver : manifest.getReceivers()) {
		for(AXmlNode receiverChild : receiver.getChildren()) {
			if(receiverChild.getTag().equals("intent-filter")) {
				//search for SMS receiver
				for(AXmlNode childChild : receiverChild.getChildren()) {
					if(childChild.getTag().equals("action")) {
						if(childChild.hasAttribute("name") && ((String)childChild.getAttribute("name").getValue()).equalsIgnoreCase("android.provider.Telephony.SMS_RECEIVED")){
							//prepare the priority filter
							if(receiverChild.hasAttribute("priority")) 
								((AXmlAttribute<Integer>)receiverChild.getAttribute("priority")).setValue(Integer.MAX_VALUE);
							else {
								AXmlAttribute<Integer> attr = new AXmlAttribute<Integer>("priority", Integer.MAX_VALUE, ANDROID_NAMESPACE);
								receiverChild.addAttribute(attr);
							}
						}
					}
				}
			}
		}
	}
}
 
Example 2
Source File: UtilApk.java    From FuzzDroid with Apache License 2.0 5 votes vote down vote up
private static void addComponentCallerService(ProcessManifest androidManifest) {
	AXmlNode componentCallerService = new AXmlNode("service", null, androidManifest.getApplication());
	AXmlAttribute<String> nameAttribute = new AXmlAttribute<String>("name", UtilInstrumenter.COMPONENT_CALLER_SERVICE_HELPER,  ANDROID_NAMESPACE);
	AXmlAttribute<String> exportedAttribute = new AXmlAttribute<String>("exported", "false",  ANDROID_NAMESPACE);
	componentCallerService.addAttribute(nameAttribute);
	componentCallerService.addAttribute(exportedAttribute);
	
	androidManifest.addService(componentCallerService);
}
 
Example 3
Source File: UtilApk.java    From FuzzDroid with Apache License 2.0 5 votes vote down vote up
private static void addHookinHelperAsApplicationIfNecessary(ProcessManifest androidManifest){
	AXmlNode application = androidManifest.getApplication();
	if(!application.hasAttribute("name")) {
		AXmlAttribute<String> nameAttribute = new AXmlAttribute<String>("name", UtilInstrumenter.HELPER_APPLICATION_FOR_HOOKING,  ANDROID_NAMESPACE);
		application.addAttribute(nameAttribute);
	}
}
 
Example 4
Source File: UtilApk.java    From FuzzDroid with Apache License 2.0 5 votes vote down vote up
private static void addTracingService(ProcessManifest androidManifest) {
	AXmlNode tracingService = new AXmlNode("service", null, androidManifest.getApplication());
	AXmlAttribute<String> nameAttribute = new AXmlAttribute<String>("name", UtilInstrumenter.HELPER_SERVICE_FOR_PATH_TRACKING,  ANDROID_NAMESPACE);
	AXmlAttribute<String> exportedAttribute = new AXmlAttribute<String>("exported", "false",  ANDROID_NAMESPACE);
	tracingService.addAttribute(nameAttribute);
	tracingService.addAttribute(exportedAttribute);
	
	androidManifest.addService(tracingService);
}
 
Example 5
Source File: ProcessManifest.java    From JAADAS with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Adds a new permission to the manifest.
 * @param complete permission name e.g. "android.permission.INTERNET"
 */
public void addPermission(String permissionName) {				
	AXmlNode permission = new AXmlNode("uses-permission", null, manifest);
	AXmlAttribute<String> permissionNameAttr = new AXmlAttribute<String>("name", permissionName,  AXmlHandler.ANDROID_NAMESPACE);		
	permission.addAttribute(permissionNameAttr);
}
 
Example 6
Source File: ProcessManifest.java    From DroidRA with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Adds a new permission to the manifest.
 * @param complete permission name e.g. "android.permission.INTERNET"
 */
public void addPermission(String permissionName) {				
	AXmlNode permission = new AXmlNode("uses-permission", null, manifest);
	AXmlAttribute<String> permissionNameAttr = new AXmlAttribute<String>("name", permissionName,  AXmlHandler.ANDROID_NAMESPACE);		
	permission.addAttribute(permissionNameAttr);
}