當前位置: 首頁>>代碼示例>>Java>>正文


Java ApkHandler類代碼示例

本文整理匯總了Java中soot.jimple.infoflow.android.axml.ApkHandler的典型用法代碼示例。如果您正苦於以下問題:Java ApkHandler類的具體用法?Java ApkHandler怎麽用?Java ApkHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ApkHandler類屬於soot.jimple.infoflow.android.axml包,在下文中一共展示了ApkHandler類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ProcessManifest

import soot.jimple.infoflow.android.axml.ApkHandler; //導入依賴的package包/類
/**
 * Processes an AppManifest which is within the given {@link File}.
 * 
 * @param	apkFile					the AppManifest within the given APK will be parsed.
 * @throws	IOException				if an I/O error occurs.
 * @throws	XmlPullParserException	can occur due to a malformed manifest.
 * @see		{@link ProcessManifest#ProcessManifest(InputStream)}
 */
public ProcessManifest(File apkFile) throws IOException, XmlPullParserException {
	this.apk = new ApkHandler(apkFile);
	InputStream is = null;
	try {
		is = this.apk.getInputStream("AndroidManifest.xml");
		this.handle(is);
	}
	finally {
		if (is != null)
			is.close();
	}
}
 
開發者ID:flankerhqd,項目名稱:JAADAS,代碼行數:21,代碼來源:ProcessManifest.java

示例2: replaceManifest

import soot.jimple.infoflow.android.axml.ApkHandler; //導入依賴的package包/類
/**
 * 
 * @param originalApk
 */
public static void replaceManifest(String originalApk) {
	File originalApkFile = new File(originalApk);
	String newManifest = Settings.sootOutput + File.separatorChar + "AndroidManifest.xml";
	String targetApk = Settings.sootOutput + File.separatorChar + originalApkFile.getName();
	File newMFile = new File(newManifest);
	try {
		ApkHandler apkH = new ApkHandler(targetApk);
		apkH.addFilesToApk(Collections.singletonList(newMFile));
	} catch (IOException e) {
		e.printStackTrace();
		throw new RuntimeException("error when writing new manifest: "+ e);
	}
	newMFile.delete();
}
 
開發者ID:secure-software-engineering,項目名稱:DroidForce,代碼行數:19,代碼來源:UpdateManifestAndCodeForWaitPDP.java

示例3: addBackgroundFile

import soot.jimple.infoflow.android.axml.ApkHandler; //導入依賴的package包/類
/**
 * 
 * @param originalApk
 */
public static void addBackgroundFile(String originalApk) {
	File tempFile = null;
	try {
		File background_picture = new File("resources", "protect.png");
		if (!background_picture.exists()) {
			// Load the file from the JAR
			URL fileURL = UpdateManifestAndCodeForWaitPDP.class.getResource("protect.png");
			
			// Copy the file local
			tempFile = File.createTempFile("droidForce", null);
			InputStream is = fileURL.openStream();
			try {
				Files.copy(is, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
				background_picture = tempFile;
			}
			finally {
				is.close();
			}
		}
		
		// By now, we must have a file
		if (background_picture == null ||!background_picture.exists())
			throw new RuntimeException("Background image file not found");
		
		File originalApkFile = new File(originalApk);
		String targetApk = Settings.sootOutput + File.separatorChar + originalApkFile.getName();
		try {
			ApkHandler apkH = new ApkHandler(targetApk);
			apkH.addFilesToApk(Collections.singletonList(background_picture), Collections.singletonMap(background_picture.getPath(), "assets/protect.png"));
		} catch (IOException e) {
			e.printStackTrace();
			throw new RuntimeException("error when adding background image: "+ e);
		}
	} catch (IOException ex) {
		System.err.println("File handling failed: " + ex.getMessage());
		ex.printStackTrace();
	}
	finally {
		if (tempFile != null)
			tempFile.delete();
	}
}
 
開發者ID:secure-software-engineering,項目名稱:DroidForce,代碼行數:47,代碼來源:UpdateManifestAndCodeForWaitPDP.java

示例4: getApk

import soot.jimple.infoflow.android.axml.ApkHandler; //導入依賴的package包/類
/**
 * Returns the handler which opened the APK file. If {@link ProcessManifest} was
 * instanciated directly with an {@link InputStream} this will return <code>null</code>.
 * 
 * @return APK Handler
 */
public ApkHandler getApk() {
	return this.apk;
}
 
開發者ID:flankerhqd,項目名稱:JAADAS,代碼行數:10,代碼來源:ProcessManifest.java


注:本文中的soot.jimple.infoflow.android.axml.ApkHandler類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。