ADD file via upload

This commit is contained in:
p30496857 2023-11-22 17:37:58 +08:00
parent d3cb08af59
commit a879030f08
1 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,44 @@
package com.nii.soot.CFGCamera2Analyser;
import java.util.Collections;
import soot.PackManager;
import soot.Scene;
import soot.Transform;
import soot.options.Options;
public class Camera2MethodAnalyzer {
private static boolean SOOT_INITIALIZED=false;
private final static String androidJAR="D:\\Android-SDK\\platforms";
private final static String appApk="D:\\eclipse\\soot-android-static-analysis-master\\apk\\pins.apk";
public static void initialiseSoot() {
if (SOOT_INITIALIZED)
return;
Options.v().set_allow_phantom_refs(true);
Options.v().set_prepend_classpath(true);
Options.v().set_validate(true);
Options.v().set_output_format(Options.output_format_jimple);
// Options.v().set_output_format(Options.output_format_dex);
// Options.v().set_process_multiple_dex(true);
Options.v().set_process_dir(Collections.singletonList(appApk));
Options.v().set_force_android_jar(androidJAR);
Options.v().set_src_prec(Options.src_prec_apk);
Options.v().set_soot_classpath(androidJAR);
// 禁用注解处理
Options.v().set_ignore_resolving_levels(true);
Options.v().set_ignore_classpath_errors(true);
Options.v().set_ignore_resolution_errors(true);
Scene.v().loadNecessaryClasses();
SOOT_INITIALIZED = true;
}
public static void main(String[] args)
{
initialiseSoot();
PackManager.v().getPack("jtp").add(new Transform("jtp.myAnalysis", new MyAnalysis()));
PackManager.v().runPacks();
}
}