我正在编写一些分析android源代码的代码,基本上是为了跟踪局部变量的定义,我想在我的代码中使用Soot从Android源代码中提取一些信息并构建类的高级调用图,我所有的工作是使用应用程序的java源代码..
我不确定我是否需要http://www.bodden.de/2013/01/08/soot-android-instrumentation/中提到的 android jar, 因为这项工作不涉及读取或写入 Dalvik 字节码 - 我不能无论如何下载罐子!!-
我想知道是否有人可以给我一些指导,我阅读了煤烟的邮件列表并尝试了所提供的解决方案,但没有运气——由于导入的库和 R 类的问题——!![我正在用一个基本的你好来测试它世界源代码]
任何帮助将不胜感激,包括对任何其他用于 android 静态分析的工具的任何引用。
非常感谢,,
用于 soot.Main 调用的参数是:
List<String> argsList = new ArrayList<String>(Arrays.asList(args));
argsList.addAll(Arrays.asList(new String[]{
"-allow-phantom-refs",
"-w",
"-soot-class-path",
"C:/Users/workspace_A/sootTest/src/com/example/soottest",
"-output-format",
"jimple",
"MainActivity"}
一些结果:
Warning: java.lang.NoClassDefFoundError is a phantom class!
Warning: java.lang.StringBuffer is a phantom class!
Warning: java.lang.Boolean is a phantom class!
Warning: java.lang.Long is a phantom class!
Warning: java.lang.Integer is a phantom class!
Warning: java.lang.Short is a phantom class!
Warning: java.lang.Float is a phantom class!
Warning: java.lang.Double is a phantom class!
Warning: java.lang.Throwable is a phantom class!
Warning: java.lang.Class is a phantom class!
Warning: java.lang.Character is a phantom class!
Warning: java.lang.AssertionError is a phantom class!
Warning: java.lang.Byte is a phantom class!
Warning: java.lang.Void is a phantom class!
Warning: java.lang.ClassFormatError is a phantom class!
Warning: java.lang.InstantiationError is a phantom class!
Warning: java.lang.Runnable is a phantom class!
Warning: java.lang.ref.Finalizer is a phantom class!
Warning: java.lang.IncompatibleClassChangeError is a phantom class!
Warning: java.lang.NoSuchFieldError is a phantom class!
Warning: java.lang.StackOverflowError is a phantom class!
Warning: java.lang.Thread is a phantom class!
Warning: java.lang.IllegalAccessError is a phantom class!
Warning: java.lang.ArrayStoreException is a phantom class!
Warning: java.dyn.InvokeDynamic is a phantom class!
Warning: java.lang.NoSuchMethodError is a phantom class!
Warning: java.lang.LinkageError is a phantom class!
Warning: java.lang.ExceptionInInitializerError is a phantom class!
Warning: java.lang.InternalError is a phantom class!
Warning: java.lang.VerifyError is a phantom class!
Warning: java.io.Serializable is a phantom class!
Warning: java.lang.ArrayIndexOutOfBoundsException is a phantom class!
Warning: java.lang.ClassCastException is a phantom class!
Warning: java.lang.ArithmeticException is a phantom class!
Warning: java.lang.IndexOutOfBoundsException is a phantom class!
Warning: java.lang.AbstractMethodError is a phantom class!
Warning: java.lang.Object is a phantom class!
Warning: java.lang.ThreadDeath is a phantom class!
Warning: java.lang.String is a phantom class!
Warning: java.lang.UnknownError is a phantom class!
Warning: java.lang.ClassCircularityError is a phantom class!
Warning: java.lang.Cloneable is a phantom class!
Warning: java.lang.NegativeArraySizeException is a phantom class!
Warning: java.lang.UnsatisfiedLinkError is a phantom class!
Warning: java.lang.Error is a phantom class!
Warning: java.lang.OutOfMemoryError is a phantom class!
Warning: java.lang.IllegalMonitorStateException is a phantom class!
Warning: java.lang.RuntimeException is a phantom class!
Warning: java.lang.NullPointerException is a phantom class!
Warning: java.lang.ClassNotFoundException is a phantom class!
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:3,8:
Semantic Error: no visible type named android.os.Bundle
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:4,8:
Semantic Error: no visible type named android.app.Activity
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:5,8:
Semantic Error: no visible type named android.view.Menu
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:7,35:
Semantic Error: no visible type named Activity
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:9:
Semantic Error: method does not override a method from its superclass
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:10,26:
Semantic Error: no visible type named Bundle
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:12:
Semantic Error: no method named setContentView(Unknown) in com.example.soottest.MainActivity matches.
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:12,18:
Semantic Error: R.layout not found
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:12,27:
Semantic Error: no field named activity_main
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:15:
Semantic Error: method does not override a method from its superclass
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:16,37:
Semantic Error: no visible type named Menu
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:18:
Semantic Error: no method named getMenuInflater() in com.example.soottest.MainActivity matches.
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:18,29:
Semantic Error: R.menu not found
C:\Users\workspace_A\sootTest\src\com\example\soottest\MainActivity.java:18,36:
Semantic Error: no field named main
Exception in thread "main" soot.CompilationDeathException: there were errors during parsing and/or type checking (JastAdd frontend)
at soot.JastAddInitialResolver.formAst(JastAddInitialResolver.java:63)
at soot.JavaClassSource.resolve(JavaClassSource.java:54)
at soot.SootResolver.bringToHierarchy(SootResolver.java:215)
at soot.SootResolver.bringToSignatures(SootResolver.java:239)
at soot.SootResolver.bringToBodies(SootResolver.java:280)
at soot.SootResolver.processResolveWorklist(SootResolver.java:150)
at soot.SootResolver.resolveClass(SootResolver.java:124)
at soot.Scene.loadClass(Scene.java:448)
at soot.Scene.loadClassAndSupport(Scene.java:433)
at soot.Scene.loadNecessaryClass(Scene.java:1053)
at soot.Scene.loadNecessaryClasses(Scene.java:1067)
at soot.Main.run(Main.java:167)
at soot.Main.main(Main.java:141)
at sootCFG.CallGraphExample.main(CallGraphExample.java:60)