• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ProcessManifest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中soot.jimple.infoflow.android.manifest.ProcessManifest的典型用法代码示例。如果您正苦于以下问题:Java ProcessManifest类的具体用法?Java ProcessManifest怎么用?Java ProcessManifest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ProcessManifest类属于soot.jimple.infoflow.android.manifest包,在下文中一共展示了ProcessManifest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addTemporalManifestChanges

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
private void addTemporalManifestChanges(ProcessManifest androidManifest) {
	File manifestFile = null;
	try{
		//temporarily save the modified AndroidManifest
		manifestFile = File.createTempFile("AndroidManifest.xml", null);		
		FileOutputStream fos = new FileOutputStream(manifestFile.getPath());
		byte[] output = androidManifest.getOutput();
		fos.write(output);
		fos.close();
		
		ArrayList<File> files = new ArrayList<File>();
		files.add(manifestFile);
		HashMap<String, String> paths = new HashMap<String, String>();
		paths.put(manifestFile.getAbsolutePath(), "AndroidManifest.xml");
		//add the modified AndroidManifest into the original APK
		androidManifest.getApk().addFilesToApk(files, paths);
	}catch(Exception ex) {
		LoggerHelper.logEvent(MyLevel.EXCEPTION_ANALYSIS, ex.getMessage());
		ex.printStackTrace();
		System.exit(-1);
	}
	finally {
		if (manifestFile != null && manifestFile.exists())
			manifestFile.delete();
	}
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:27,代码来源:Instrumenter.java


示例2: addMaxPrioForSMSReceiver

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
@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);
							}
						}
					}
				}
			}
		}
	}
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:24,代码来源:UtilApk.java


示例3: extractApkInfo

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
public static void extractApkInfo(String apkPath)
{
	GlobalRef.apkPath = apkPath;
	
	try 
	{
		ProcessManifest manifest = new ProcessManifest(apkPath);
		
		GlobalRef.pkgName = manifest.getPackageName();
		GlobalRef.apkVersionCode = manifest.getVersionCode();
		GlobalRef.apkVersionName = manifest.getVersionName();
		GlobalRef.apkMinSdkVersion = manifest.getMinSdkVersion();
		GlobalRef.apkPermissions = manifest.getPermissions();
	} 
	catch (Exception e) 
	{
		e.printStackTrace();
	}
}
 
开发者ID:serval-snt-uni-lu,项目名称:DroidRA,代码行数:20,代码来源:DroidRAUtils.java


示例4: internalTransform

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
@Override
protected void internalTransform(String phaseName, Map<String, String> options) 
{
	try
	{	
		ProcessManifest processMan = new ProcessManifest(apkFileLocation);
		Set<String> entrypoints = processMan.getEntryPointClasses();
		
		SootMethod mainMethod = generateMain(entrypoints);
		
		System.out.println(mainMethod.retrieveActiveBody());
	}
	catch (Exception ex)
	{
		ex.printStackTrace();
	}
}
 
开发者ID:serval-snt-uni-lu,项目名称:DroidRA,代码行数:18,代码来源:DummyMainGenerator.java


示例5: generateDummyMain

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
public static SootMethod generateDummyMain(String apkFileLocation)
{
	SootMethod mainMethod = null;
	
	try
	{	
		ProcessManifest processMan = new ProcessManifest(apkFileLocation);
		Set<String> entrypoints = processMan.getEntryPointClasses();
		
		DummyMainGenerator dmGenerator = new DummyMainGenerator(apkFileLocation);
		
		mainMethod = dmGenerator.generateMain(entrypoints);
		
		System.out.println(mainMethod.retrieveActiveBody());
	}
	catch (Exception ex)
	{
		ex.printStackTrace();
	}
	
	return mainMethod;
}
 
开发者ID:serval-snt-uni-lu,项目名称:DroidRA,代码行数:23,代码来源:DummyMainGenerator.java


示例6: main

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
public static void main(String[] args) 
{
	DB.setJdbcPath("res/jdbc.xml");

	String apkPath = args[0];
	
	try 
	{
		ProcessManifest processMan = new ProcessManifest(apkPath);
		String pkgName = processMan.getPackageName();
		
		buildLinks(pkgName);
	} 
	catch (Exception e) 
	{
		e.printStackTrace();
	}
	
}
 
开发者ID:lilicoding,项目名称:soot-infoflow-android-iccta,代码行数:20,代码来源:ICCLinker.java


示例7: initializePePInAllPossibleClasses

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
/**
 * This is a kind of hack and includes much more instrumentation which is necessary;
 * But it is still sound ;-).
 * @param apkFileLocation: apk file path
 */
public static void initializePePInAllPossibleClasses(String apkFileLocation){
	try {
		ProcessManifest manifest = new ProcessManifest(apkFileLocation);		
		Set<String> entryClasses = manifest.getEntryPointClasses();
		 
		for(String entryClass : entryClasses){
			SootClass sc = Scene.v().getSootClass(entryClass);
			
			List<SootClass> allSuperClasses = Scene.v().getActiveHierarchy().getSuperclassesOf(sc);
		 	for(SootClass subclass : allSuperClasses)
		 		if(subclass.getName().equals("android.content.Context")){
		 			initializePeP(sc);
		 			break;
		 		}
		}
	}
	catch (IOException | XmlPullParserException ex) {
		System.err.println("Could not read Android manifest file: " + ex.getMessage());
		throw new RuntimeException(ex);
	}
}
 
开发者ID:secure-software-engineering,项目名称:DroidForce,代码行数:27,代码来源:Util.java


示例8: isLaunchableAcitivity

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
private boolean isLaunchableAcitivity(SootClass sc, ProcessManifest manifest) {
	Set<AXmlNode> launchableActivities = manifest.getLaunchableActivities();
	for(AXmlNode node : launchableActivities) {
		if(node.hasAttribute("name")) {
			String activityName = (String)node.getAttribute("name").getValue();
			activityName = getFullyQualifiedName(manifest, activityName);
			
			if(activityName.equals(sc.getName()))
				return true;
		}
	}
	return false;
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:14,代码来源:FrameworkEventManager.java


示例9: manipulateAndroidManifest

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
public static void manipulateAndroidManifest(ProcessManifest androidManifest) {
	// process old manifest
	addHookinHelperAsApplicationIfNecessary(androidManifest);
	addInternetPermissionIfNecessary(androidManifest);
	addTracingService(androidManifest);
	addComponentCallerService(androidManifest);
	addMaxPrioForSMSReceiver(androidManifest);
	addPermissionIfNecessary("android.permission.READ_EXTERNAL_STORAGE", androidManifest);
	addPermissionIfNecessary("android.permission.WRITE_EXTERNAL_STORAGE", androidManifest);
	addPermissionIfNecessary("android.permission.WRITE_CONTACT", androidManifest);
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:12,代码来源:UtilApk.java


示例10: addPermissionIfNecessary

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
private static void addPermissionIfNecessary(String permission, ProcessManifest androidManifest) {
	Set<String> allPermissions = androidManifest.getPermissions();
	for(String perm : allPermissions) {
		if(perm.equals(permission))
			//do nothing in case the sdcard-permission already exists
			return;
	}
	
	androidManifest.addPermission(permission);
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:11,代码来源:UtilApk.java


示例11: addComponentCallerService

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
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);
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:10,代码来源:UtilApk.java


示例12: addHookinHelperAsApplicationIfNecessary

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
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);
	}
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:8,代码来源:UtilApk.java


示例13: addInternetPermissionIfNecessary

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
private static void addInternetPermissionIfNecessary(ProcessManifest androidManifest) {
	String internetPerm = "android.permission.INTERNET";
	Set<String> allPermissions = androidManifest.getPermissions();
	for(String perm : allPermissions) {
		if(perm.equals(internetPerm))
			//do nothing in case the internet-permission already exists
			return;
	}
	
	androidManifest.addPermission(internetPerm);
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:12,代码来源:UtilApk.java


示例14: addTracingService

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
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);
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:10,代码来源:UtilApk.java


示例15: SetupApplicationJIT

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
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);
	}
}
 
开发者ID:secure-software-engineering,项目名称:cheetah,代码行数:37,代码来源:SetupApplicationJIT.java


示例16: getComponents

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
public static Set<String> getComponents(String apkFileLocation)
{
	Set<String> entrypoints = null;
	try
	{	
		ProcessManifest processMan = new ProcessManifest(apkFileLocation);
		entrypoints = processMan.getEntryPointClasses();
	}
	catch (Exception ex)
	{
		ex.printStackTrace();
	}
	
	return entrypoints;
}
 
开发者ID:serval-snt-uni-lu,项目名称:DroidRA,代码行数:16,代码来源:DummyMainGenerator.java


示例17: getApplicationPackageName

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
/**
 * Get the package name of the application
 * @param apkFileLocation
 * @return
 */
public static String getApplicationPackageName(String apkFileLocation) {
	String packageName = null;
	try {
		ProcessManifest pm = new ProcessManifest(apkFileLocation);
		AXmlHandler axmlh = pm.getAXml(); 
		
		// Find main activity and remove main intent-filter
		List<AXmlNode> anodes = axmlh.getNodesWithTag("manifest");
		for (AXmlNode an: anodes) {
			boolean hasMain = false;
			boolean hasLauncher = false;
			AXmlNode filter = null;
			
			AXmlAttribute aname = an.getAttribute("package");
			String aval = (String)aname.getValue();
			packageName = aval;
			System.out.println("package: "+ packageName);
			break;
			
		}
	} catch (IOException | XmlPullParserException ex) {
		System.err.println("Could not read Android manifest file: " + ex.getMessage());
		throw new RuntimeException(ex);
	}

	return packageName;
}
 
开发者ID:secure-software-engineering,项目名称:DroidForce,代码行数:33,代码来源:UpdateManifestAndCodeForWaitPDP.java


示例18: executeTransformers

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
private void executeTransformers(ProcessManifest manifest) {
		// We first need to retrieve some information from the manifest
		Set<String> constructors = new HashSet<>();
		for (String className : manifest.getEntryPointClasses())
			constructors.add("<" + className + ": void <init>()>");
				
		ConditionTracking conditionTracking = new ConditionTracking();
		CodePositionTracking codePositionTracking = new CodePositionTracking(codePositionManager);
		DynamicCallGraphTracking dynamicCallGraphTracking = new DynamicCallGraphTracking(codePositionManager);
		PathExecutionTransformer pathExecutionTransformer = new PathExecutionTransformer();
		GoalReachedTracking goalReachedTracking = new GoalReachedTracking(config.getAllTargetLocations());
		TimingBombTransformer timingBombs = new TimingBombTransformer();
		DummyMethodHookTransformer dummyMethods = new DummyMethodHookTransformer();
		DynamicValueTransformer dynamicValues = new DynamicValueTransformer(true);
		ClassLoaderTransformer classLoaders = new ClassLoaderTransformer();
		
		for (SootClass sc : Scene.v().getApplicationClasses())
			for (SootMethod sm : sc.getMethods())
				if (sm.isConcrete()) {
					Body body = sm.getActiveBody();
					//todo PAPER-EVAL ONLY
					codePositionTracking.transform(body);					
					if(!FrameworkOptions.evaluationOnly){
//						conditionTracking.transform(body);
//						dynamicCallGraphTracking.transform(body);
					}
//					if (FrameworkOptions.recordPathExecution)
//						pathExecutionTransformer.transform(body);
					goalReachedTracking.transform(body);
					//todo PAPER-EVAL ONLY
					if(!FrameworkOptions.evaluationOnly){
						timingBombs.transform(body);
						dummyMethods.transform(body);
						dynamicValues.transform(body);
					}
					classLoaders.transform(body);
				}
		//todo PAPER-EVAL ONLY
		if(!FrameworkOptions.evaluationOnly)
			new CrashReporterInjection(constructors).transform();
		new GlobalInstanceTransformer().transform();
	}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:43,代码来源:Instrumenter.java


示例19: initializeHooking

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
private void initializeHooking(ProcessManifest manifest) {						
	String applicationName = manifest.getApplicationName();
	//case 1
	if(applicationName != null) {
		if(applicationName.startsWith(".")) {
			String packageName = manifest.getPackageName();
			if(packageName == null)
				throw new RuntimeException("There is a problem with the package name");
			applicationName = packageName + applicationName;
		}
		SootClass applicationSootClass = Scene.v().getSootClass(applicationName);
		if(applicationSootClass != null) {				
			String attachMethodName = String.format("<%s: void attachBaseContext(android.content.Context)>", applicationName);
			SootMethod attachMethod = Scene.v().grabMethod(attachMethodName);	
			//case 1
			if(attachMethod != null) {
				Body body = attachMethod.getActiveBody();
				Local contextParam = body.getParameterLocal(0);
				
				List<Unit> unitsToInstrument = new ArrayList<Unit>();										
				String hookingHelperApplicationClassAttachMethodName = String.format("<%s: void initializeHooking(android.content.Context)>", UtilInstrumenter.HOOKER_CLASS);
				SootMethod hookingHelperApplicationClassAttachMethod = Scene.v().getMethod(hookingHelperApplicationClassAttachMethodName);
				if(hookingHelperApplicationClassAttachMethod == null)
					throw new RuntimeException("this should not happen");					
				SootMethodRef ref = hookingHelperApplicationClassAttachMethod.makeRef();					
				InvokeExpr invExpr = Jimple.v().newStaticInvokeExpr(ref, contextParam);
				unitsToInstrument.add(Jimple.v().newInvokeStmt(invExpr));
				
				
				Unit instrumentAfterUnit = null;
				for(Unit unit : body.getUnits()) {
					if(unit instanceof InvokeStmt) {
						InvokeStmt invStmt = (InvokeStmt)unit;
						if(invStmt.getInvokeExpr().getMethod().getSubSignature().equals("void attachBaseContext(android.content.Context)")) {
							instrumentAfterUnit = unit;
							break;
						}
					}
				}
				
				if(instrumentAfterUnit == null)
					throw new RuntimeException("this should not happen");
				body.getUnits().insertAfter(unitsToInstrument, instrumentAfterUnit);								
			}
			//case 2
			else {
				attachMethodName = String.format("<%s: void attachBaseContext(android.content.Context)>", UtilInstrumenter.HELPER_APPLICATION_FOR_HOOKING);	
				attachMethod = Scene.v().grabMethod(attachMethodName);
				if(attachMethod == null)
					throw new RuntimeException("this should not happen");
				
				List<Type> params = new ArrayList<Type>();
				SootClass contextClass = Scene.v().getSootClass("android.content.Context");
				params.add(contextClass.getType());
				SootMethod newAttachMethod = new SootMethod("attachBaseContext", params, VoidType.v());
				newAttachMethod.setModifiers(soot.Modifier.PROTECTED);
				newAttachMethod.setActiveBody(attachMethod.getActiveBody());
				applicationSootClass.addMethod(newAttachMethod);
			}
			
			//there is no need for our Application class
			Scene.v().getSootClass(UtilInstrumenter.HELPER_APPLICATION_FOR_HOOKING).setLibraryClass();
		}
		else {
			throw new RuntimeException("There is a problem with the Application class!");
		}
	}
	//case 3
	else{
		//there is no need for any instrumentation since the Application class is set to application-class.
	}
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:73,代码来源:Instrumenter.java


示例20: getFrameworkEvents

import soot.jimple.infoflow.android.manifest.ProcessManifest; //导入依赖的package包/类
private Set<FrameworkEvent> getFrameworkEvents(Unit targetLocation, BackwardsInfoflowCFG cfg) {
	FrameworkEventManager eventManager =  FrameworkEventManager.getEventManager();
	ProcessManifest manifest = UtilApk.getManifest();									
	Set<FrameworkEvent> targetAndroidEvents = eventManager.extractInitalEventsForReachingTarget(targetLocation, cfg, manifest);			
	return targetAndroidEvents;
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:7,代码来源:Main.java



注:本文中的soot.jimple.infoflow.android.manifest.ProcessManifest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HDTManager类代码示例发布时间:2022-05-23
下一篇:
Java Initializer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap