本文整理汇总了Java中soot.options.Options类的典型用法代码示例。如果您正苦于以下问题:Java Options类的具体用法?Java Options怎么用?Java Options使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Options类属于soot.options包,在下文中一共展示了Options类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialiseSoot
import soot.options.Options; //导入依赖的package包/类
/**
* Provides all needed information to soot.
*/
public static void initialiseSoot() {
// prefer Android APK files// -src-prec apk
Options.v().set_src_prec(Options.src_prec_apk);
Options.v().set_force_overwrite(true);
// output as APK, too//-f J
Options.v().set_output_format(Options.output_format_dex);
Options.v().set_force_android_jar(androidJAR);
Options.v().set_android_jars(androidJAR);
Options.v().set_allow_phantom_refs(true);
List<String> procDir = new ArrayList<String>();
procDir.add(apk);
Options.v().set_process_dir(procDir);
Options.v().set_soot_classpath(classpath);
Scene.v().addBasicClass("android.util.Log", SootClass.SIGNATURES);
Scene.v().addBasicClass("call.LogCaller", SootClass.BODIES);
Scene.v().loadNecessaryClasses();
Scene.v().getSootClass("call.LogCaller").setApplicationClass();
}
示例2: generateCSV
import soot.options.Options; //导入依赖的package包/类
/**
* Generate file representing the graph as comma separated edges.
* @param outputName
* @throws IOException
*/
public void generateCSV(String outputName) throws IOException {
// create directory to write graphs
File graphDir = new File(Options.v().output_dir() +"/"+ "graphs/");
if (!graphDir.exists())
graphDir.mkdir();
for (int i=0; i < ConfigCHA.v().getGraphOutMaxDepth(); i++) {
String name = graphDir.getAbsolutePath() +"/"+ i + outputName;
out.add(new PrintWriter(new BufferedWriter(new FileWriter(name))));
log.info("Output CSV graph to '"+ name);
}
Set<SootMethod> alreadyVisited = new HashSet<SootMethod>();
SootMethod main = Scene.v().getMainMethod();
alreadyVisited.add(main);
visit(alreadyVisited, main, 0);
for (int i=0; i < ConfigCHA.v().getGraphOutMaxDepth(); i++)
out.get(i).close();
}
示例3: TrapUnitGraph
import soot.options.Options; //导入依赖的package包/类
/**
* Constructs the graph from a given Body instance.
* @param the Body instance from which the graph is built.
*/
public TrapUnitGraph(Body body)
{
super(body);
int size = unitChain.size();
if(Options.v().time())
Timers.v().graphTimer.start();
unitToSuccs = new HashMap<Unit, List<Unit>>(size * 2 + 1, 0.7f);
unitToPreds = new HashMap<Unit, List<Unit>>(size * 2 + 1, 0.7f);
buildUnexceptionalEdges(unitToSuccs, unitToPreds);
buildExceptionalEdges(unitToSuccs, unitToPreds);
makeMappedListsUnmodifiable(unitToSuccs);
makeMappedListsUnmodifiable(unitToPreds);
buildHeadsAndTails();
if(Options.v().time())
Timers.v().graphTimer.end();
soot.util.PhaseDumper.v().dumpGraph(this, body);
}
示例4: setSootOptions
import soot.options.Options; //导入依赖的package包/类
@Override
public void setSootOptions(Options options) {
// explicitly include packages for shorter runtime:
List<String> includeList = new LinkedList<String>();
includeList.add("java.lang.*");
includeList.add("java.util.*");
includeList.add("java.io.*");
includeList.add("sun.misc.*");
includeList.add("java.net.*");
includeList.add("org.apache.http.*");
includeList.add("de.test.*");
includeList.add("soot.*");
includeList.add("securibench.*");
includeList.add("javax.servlet.*");
includeList.add("com.oreilly.servlet.*");
// includeList.add("java.security.");
// includeList.add("javax.crypto.");
options.set_include(includeList);
options.set_output_format(Options.output_format_none);
}
示例5: stringBuilderTest2_NoJDK
import soot.options.Options; //导入依赖的package包/类
@Test(timeout=600000)
public void stringBuilderTest2_NoJDK(){
Infoflow infoflow = initInfoflow(true);
infoflow.setSootConfig(new IInfoflowConfig() {
@Override
public void setSootOptions(Options options) {
List<String> excludeList = new ArrayList<String>();
excludeList.add("java.");
excludeList.add("javax.");
options.set_exclude(excludeList);
options.set_prepend_classpath(false);
}
});
List<String> epoints = new ArrayList<String>();
epoints.add("<soot.jimple.infoflow.test.StringTestCode: void methodStringBuilder2()>");
infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
checkInfoflow(infoflow, 1);
}
示例6: exceptionControlFlowTestNoJDK1
import soot.options.Options; //导入依赖的package包/类
@Test
public void exceptionControlFlowTestNoJDK1() throws IOException {
Infoflow infoflow = initInfoflow();
infoflow.setTaintWrapper(new EasyTaintWrapper(new File("EasyTaintWrapperSource.txt")));
infoflow.setSootConfig(new IInfoflowConfig() {
@Override
public void setSootOptions(Options options) {
List<String> excludeList = new ArrayList<String>();
excludeList.add("java.");
excludeList.add("javax.");
options.set_exclude(excludeList);
options.set_prepend_classpath(false);
}
});
List<String> epoints = new ArrayList<String>();
epoints.add("<soot.jimple.infoflow.test.ExceptionTestCode: void exceptionControlFlowTest1()>");
infoflow.computeInfoflow(appPath, null, epoints, sources, sinks);
checkInfoflow(infoflow, 1);
}
示例7: doPrivilegedTest3_NoJDK
import soot.options.Options; //导入依赖的package包/类
@Test(timeout=300000)
public void doPrivilegedTest3_NoJDK() {
Infoflow infoflow = initInfoflow();
infoflow.setSootConfig(new IInfoflowConfig() {
@Override
public void setSootOptions(Options options) {
List<String> excludeList = new ArrayList<String>();
excludeList.add("java.");
excludeList.add("javax.");
options.set_exclude(excludeList);
options.set_prepend_classpath(false);
}
});
List<String> epoints = new ArrayList<String>();
epoints.add("<soot.jimple.infoflow.test.OtherTestCode: void doPrivilegedTest3()>");
infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
checkInfoflow(infoflow, 1);
Assert.assertTrue(infoflow.getResults().isPathBetweenMethods(sink, sourceDeviceId));
}
示例8: callToReturnTest
import soot.options.Options; //导入依赖的package包/类
@Test(timeout=300000)
public void callToReturnTest() throws IOException{
// not yet supported
Infoflow infoflow = initInfoflow();
infoflow.setInspectSinks(false);
infoflow.setEnableImplicitFlows(true);
infoflow.setTaintWrapper(new EasyTaintWrapper("EasyTaintWrapperSource.txt"));
infoflow.setSootConfig(new IInfoflowConfig() {
@Override
public void setSootOptions(Options options) {
options.set_include(Collections.<String>emptyList());
List<String> excludeList = new ArrayList<String>();
excludeList.add("java.");
excludeList.add("javax.");
options.set_exclude(excludeList);
options.set_prepend_classpath(false);
}
});
List<String> epoints = new ArrayList<String>();
epoints.add("<soot.jimple.infoflow.test.ImplicitFlowTestCode: void callToReturnTest()>");
infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
checkInfoflow(infoflow, 1);
}
示例9: implicitFlowTaintWrapperTest
import soot.options.Options; //导入依赖的package包/类
@Test(timeout=300000)
public void implicitFlowTaintWrapperTest() throws IOException{
Infoflow infoflow = initInfoflow();
infoflow.setInspectSinks(false);
infoflow.setEnableImplicitFlows(true);
infoflow.setTaintWrapper(new EasyTaintWrapper("EasyTaintWrapperSource.txt"));
infoflow.setSootConfig(new IInfoflowConfig() {
@Override
public void setSootOptions(Options options) {
options.set_include(Collections.<String>emptyList());
List<String> excludeList = new ArrayList<String>();
excludeList.add("java.");
excludeList.add("javax.");
options.set_exclude(excludeList);
options.set_prepend_classpath(false);
}
});
List<String> epoints = new ArrayList<String>();
epoints.add("<soot.jimple.infoflow.test.ImplicitFlowTestCode: void implicitFlowTaintWrapperTest()>");
infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
checkInfoflow(infoflow, 1);
}
示例10: implicitFlowTaintWrapperNegativeTest
import soot.options.Options; //导入依赖的package包/类
@Test(timeout=300000)
public void implicitFlowTaintWrapperNegativeTest() throws IOException{
Infoflow infoflow = initInfoflow();
infoflow.setInspectSinks(false);
infoflow.setEnableImplicitFlows(true);
infoflow.setTaintWrapper(new EasyTaintWrapper(Collections.<String, Set<String>>emptyMap()));
infoflow.setSootConfig(new IInfoflowConfig() {
@Override
public void setSootOptions(Options options) {
options.set_include(Collections.<String>emptyList());
List<String> excludeList = new ArrayList<String>();
excludeList.add("java.");
excludeList.add("javax.");
options.set_exclude(excludeList);
options.set_prepend_classpath(false);
}
});
List<String> epoints = new ArrayList<String>();
epoints.add("<soot.jimple.infoflow.test.ImplicitFlowTestCode: void implicitFlowTaintWrapperTest()>");
infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
negativeCheckInfoflow(infoflow);
}
示例11: determineExcludedPackages
import soot.options.Options; //导入依赖的package包/类
private void determineExcludedPackages() {
excludedPackages = new LinkedList<String>();
if (Options.v().exclude() != null)
excludedPackages.addAll(Options.v().exclude());
// do not kill contents of the APK if we want a working new APK afterwards
if( !Options.v().include_all()
&& Options.v().output_format() != Options.output_format_dex
&& Options.v().output_format() != Options.output_format_force_dex) {
excludedPackages.add("java.*");
excludedPackages.add("sun.*");
excludedPackages.add("javax.*");
excludedPackages.add("com.sun.*");
excludedPackages.add("com.ibm.*");
excludedPackages.add("org.xml.*");
excludedPackages.add("org.w3c.*");
excludedPackages.add("apple.awt.*");
excludedPackages.add("com.apple.*");
}
}
示例12: getDefaultThrowAnalysis
import soot.options.Options; //导入依赖的package包/类
/**
* Returns the {@link ThrowAnalysis} to be used by default when
* constructing CFGs which include exceptional control flow.
*
* @return the default {@link ThrowAnalysis}
*/
public ThrowAnalysis getDefaultThrowAnalysis()
{
if( defaultThrowAnalysis == null ) {
int optionsThrowAnalysis = Options.v().throw_analysis();
switch (optionsThrowAnalysis) {
case Options.throw_analysis_pedantic:
defaultThrowAnalysis = PedanticThrowAnalysis.v();
break;
case Options.throw_analysis_unit:
defaultThrowAnalysis = UnitThrowAnalysis.v();
break;
default:
throw new IllegalStateException("Options.v().throw_analysi() == " +
Options.v().throw_analysis());
}
}
return defaultThrowAnalysis;
}
示例13: loadNecessaryClasses
import soot.options.Options; //导入依赖的package包/类
/** Load the set of classes that soot needs, including those specified on the
* command-line. This is the standard way of initialising the list of
* classes soot should use.
*/
public void loadNecessaryClasses() {
loadBasicClasses();
for (String name : Options.v().classes()) {
loadNecessaryClass(name);
}
loadDynamicClasses();
if(Options.v().oaat()) {
if(Options.v().process_dir().isEmpty()) {
throw new IllegalArgumentException("If switch -oaat is used, then also -process-dir must be given.");
}
} else {
for( final String path : Options.v().process_dir() ) {
for (String cl : SourceLocator.v().getClassesUnder(path)) {
SootClass theClass = loadClassAndSupport(cl);
theClass.setApplicationClass();
}
}
}
prepareClasses();
setDoneResolving();
}
示例14: getMinJavaVersion
import soot.options.Options; //导入依赖的package包/类
@Override
protected int getMinJavaVersion(SootMethod method) {
final BafBody body = getBafBody(method);
int minVersion = Options.java_version_1_1;
for (Unit u : body.getUnits()) {
if (u instanceof DynamicInvokeInst) {
return Options.java_version_1_7;
}
if (u instanceof PushInst) {
if (((PushInst) u).getConstant() instanceof ClassConstant) {
minVersion = Options.java_version_1_5;
}
}
}
return minVersion;
}
示例15: printProfilingInformation
import soot.options.Options; //导入依赖的package包/类
public void printProfilingInformation() {
long totalTime = totalTimer.getTime();
G.v().out.println("Time measurements");
G.v().out.println();
G.v().out.println(" Main generation: " + toTimeString(mainGeneration, totalTime));
G.v().out.println();
G.v().out.println(" Entry points: " + entryPoints);
G.v().out.println(" Class count: " + classes);
// Print out time stats.
G.v().out.println("totalTime:" + toTimeString(totalTimer, totalTime));
if (Options.v().subtract_gc()) {
G.v().out.println("Garbage collection was subtracted from these numbers.");
G.v().out.println(
" forcedGC:" + toTimeString(G.v().Timer_forcedGarbageCollectionTimer, totalTime));
}
}