# Current Activity
adb shell "dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'"
adb shell "dumpsys window windows"
adb shell "dumpsys activity | grep top-activity"
# Send Intent
am start -a android.intent.action.MAIN -n kr.co.youfirst.portal/.MainActivity
# Smali
1) Log
const-string v0, "ProviderInstaller"
const-string v1, "Failed to get remote context"
invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
2) String to Int
const-string v8, "log-tag"
invoke-static {v1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
move-result-object v9
# hash 2 string (v0 : hashmap / v2 : string)
const-string v0, "http://example.com"
const-string v6, "ssrinc : URL Check"
invoke-static {v6, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
const-string v6, "appNm"
invoke-virtual {v1, v6}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v7
check-cast v7, Ljava/lang/String;
const-string v6, "ssrinc : appNm in Hashmap"
invoke-static {v6, v7}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
# JSON 2 STring (v9 : JSON Object)
invoke-virtual {v9}, Lorg/json/JSONObject;->toString()Ljava/lang/String;
# Use Android Studio for smali source-level debugging
Prerequisite: Install Android Studio.
Prerequisite: Install 'smalidea' plugin from https://github.com/JesusFreke/smali/wiki/smalidea
Prerequisite: Install APK as 'debuggable'=true. You may have to patch the AndroidManifest in the APK for this.
Step 1: Import the APK smali into Android Studio:
Use Baksmali to dump APK smali into a source directory:
<em>baksmali foobar.apk -o ~/tests/12345678ABC/project/src</em>
Run Android Studio, select "Import Project" and select project directory (e.g. ~/tests/12345678ABC/project)
For the import, choose "Create project from existing sources"
Once created/imported in Android Studio, find the above 'src' directory in the 'Project' sub-view of the 'Project' pane.
Right-click on the 'src' directory and select "Mark Directory As -> Sources Root"
Navigate around the source, and set breakpoints where necessary.
Step 2: Debug the APK
Set the app to wait for the debugger when it runs:
<em>adb shell am set-debug-app -w com.example.packagename</em>
Launch the APK on the device (you should see 'waiting for debugger' pop-up)
Run Android Monitor (monitor), click on the debuggable app in the 'Devices' pane, and note the local port number
(local port number is usually 8700, shown in the last column such as '86XX / 8700')
Leave monitor running, as it maintains the necessary port forwarding
Create a 'Remote' debug configuration in Android Studio and set the localhost port to '8700' (or whatever found previously)
Start the debug session in Android Studio with the newly created 'Remote' configuration.
The 'Waiting For Debugger' pop-up should disappear on the device, and the debugger should hit any breakpoints set.
Note - memory and registers (v0 etc) can be examined/modified in the 'Watches' window in Android Studio.
# PHP Test
/phpmyadmin
/phpMyAdmin
/myadmin
/MyAdmin
/info.php
/phpinfo.php
/phpInfo.php
'Android > Diagnostics' 카테고리의 다른 글
[Android Profiler] Method Trace (0) | 2018.07.25 |
---|---|
[FRIDA] Frida를 이용한 Native Hooking (0) | 2018.07.04 |
[Android-Diagnostics] Android Decompile & Smali 수정(Toast) (0) | 2015.10.02 |
[Android-Diagnostics] ADB를 통한 현재 Activity 찾기 (0) | 2015.09.30 |
[Android-Diagnostics] Apktool (0) | 2015.06.11 |