Common android smali injection code
1. Add log information
Const-string v3, "SN"
Invoke-static {v3, v0}, Landroid/util/Log;-> v (Ljava/lang/String;) I
2. Pop-up message box
New AlertDialog. Builder (self)
. SetTitle ("normal dialog box ")
. SetMessage ("Hello, Android! ")
. Show ();
New-instance v1, Landroid/app/AlertDialog $ Builder;
Invoke-direct {v1, p0}, Landroid/app/AlertDialog $ Builder;-> (Landroid/content/Context;) V
. Line 29
. Local v1, builder: Landroid/app/AlertDialog $ Builder;
Const-string v2, "\ u666e \ u901a \ u5bf9 \ u8bdd \ u6846"
Invoke-virtual {v1, v2}, Landroid/app/AlertDialog $ Builder;-> setTitle (Ljava/lang/CharSequence;) Landroid/app/AlertDialog $ Builder;
. Line 31
Const-string v2, "\ u4f60 \ u597d \ uff0cAndroid! "
Invoke-virtual {v1, v2}, Landroid/app/AlertDialog $ Builder;-> setMessage (Ljava/lang/CharSequence;) Landroid/app/AlertDialog $ Builder;
. Line 52
Invoke-virtual {v1}, Landroid/app/AlertDialog $ Builder;-> create () Landroid/app/AlertDialog;
Move-result-object v2
Invoke-virtual {v2}, Landroid/app/AlertDialog;-> show () V
Insert the above smali code before the return-void statement of the create function in MainActivity. smali
The. line command does not affect the result.
3. The program is running.
Method 1:
Try {
Thread. sleep (60*1000 );
} Catch (InterruptedException e ){
E. printStackTrace ();
}
. Line 69
Const-wide/32 v1, 0xeff0
: Try_start_0
# V1 = (LongLo); v2 = (LongHi );
Invoke-static {v1, v2}, Ljava/lang/Thread;-> Sleep (J) V
: Try_end_0
. Catch Ljava/lang/InterruptedException; {: try_start_0 .. try_end_0}: catch_0
. Line 87
: Goto_0
# V0 = (Conflicted );
# Content after try
Return-void
. Line 70
: Catch_0
# V0 = (Uninit );
Move-exception v0
. Line 72
. Local v0, e: Ljava/lang/InterruptedException;
# V0 = (Reference );
Invoke-virtual {v0}, Ljava/lang/InterruptedException;-> printStackTrace () V
Goto: goto_0
Method 2:
Android. OS. SystemClock. sleep (60*1000 );
Const-wide/32 v0, 0xea60
Invoke-static {v0, v1}, Landroid/OS/SystemClock;-> sleep (J) V
4. Stack tracking (call relationship)
# New Exception ("print trace"). printStackTrace ();
New-instance v0, Ljava/lang/Exception;
Const-string v1, "print trace"
Invoke-direct {v0, v1}, Ljava/lang/Exception;-> (Ljava/lang/String;) V
Invoke-virtual {v0}, Ljava/lang/Exception;-> printStackTrace () V
Stack trace information records all called methods during the process from initiation to printStackTrace () execution. View stack tracing information from the bottom up,
Find the first information starting with com. android. stackTrace.
Stack trace information is WARN level, and the Tag name is System. err. Command Line: adb logcat-s System. err: V *: W
5. Method Profiling (call relationship)
# Android. OS. Debug. startMethodTracing ("123"); "123" indicates the file name
# ();
# Android. OS. Debug. stopMethodTracing ();
Android-Manifest.xml add SD card write permission
# Android. OS. Debug. startMethodTracing ("123 ");
Const-string v0, "123"
Invoke-static {v0}, Landroid/OS/Debug;-> startMethodTracing (Ljava/lang/String;) V
# Android. OS. Debug. stopMethodTracing ();
Invoke-static {}, Landroid/OS/Debug;-> stopMethodTracing () V
The root directory of the SD card generates 123. trace
Analysis command:
Adb pull/mnt/sdcard/123. trace
Traceview 123. trace