我已开始研究Android应用程序。因此,对于应用程序的动态分析,我需要做一些Data
和Control Flaw
的事情。我使用startMethodTracing来收集跟踪文件,我可以使用Android Device Monitor查看跟踪文件。
不幸的是,跟踪文件包含系统调用和应用程序调用。例如,为了调用setText
小部件的EditText
方法,跟踪文件包含如下日志:
0x71aefac0 android.widget.TextView checkForRelayout ()V TextView.java
0x71aefaf0 android.widget.TextView checkForResize ()V TextView.java
0x71aefbe0 android.widget.TextView createEditorIfNeeded ()V TextView.java
0x71aefd00 android.widget.TextView getBoxHeight (Landroid/text/Layout;)I TextView.java
0x71aefd30 android.widget.TextView getDesiredHeight ()I TextView.java
0x71aefd60 android.widget.TextView getDesiredHeight (Landroid/text/Layout;Z)I TextView.java
0x71aefdf0 android.widget.TextView getLayoutAlignment ()Landroid/text/Layout$Alignment; TextView.java
0x71af0000 android.widget.TextView invalidateCursor (III)V TextView.java
0x71af0150 android.widget.TextView isMultilineInputType (I)Z TextView.java
0x71af0240 android.widget.TextView makeSingleLayout (ILandroid/text/BoringLayout$Metrics;ILandroid/text/Layout$Alignment;ZLandroid/text/TextUtils$TruncateAt;Z)Landroid/text/Layout; TextView.java
0x71af0300 android.widget.TextView registerForPreDraw ()V TextView.java
0x71af0390 android.widget.TextView removeIntersectingNonAdjacentSpans (IILjava/lang/Class;)V TextView.java
0x71af0480 android.widget.TextView sendBeforeTextChanged (Ljava/lang/CharSequence;III)V TextView.java
0x71af04b0 android.widget.TextView setFilters (Landroid/text/Editable;[Landroid/text/InputFilter;)V TextView.java
0x71af0630 android.widget.TextView setText (Ljava/lang/CharSequence;Landroid/widget/TextView$BufferType;ZI)V TextView.java
0x71af0690 android.widget.TextView shouldAdvanceFocusOnEnter ()Z TextView.java
0x71af07b0 android.widget.TextView stopMarquee ()V TextView.java
我想过滤应用程序完成的方法调用,如下所示:
0x71af0630 android.widget.TextView setText (Ljava/lang/CharSequence;Landroid/widget/TextView$BufferType;ZI)V TextView.java
请有人指导我实现目标吗?
提前致谢:)
答案 0 :(得分:0)
我能想到的最简单的方法是:
1)通过用apktool反编译来检索apk类名,然后只需查找" .smali"文件。文件夹是包,smali名称是类名。
2)使用dmtracedump检索跟踪的点树表示,然后从方法调用来自apk的类的节点中删除深度为2或更多的所有方法调用。< / p>