- 问题背景
- 解决方法
- 总结
阅读之前注意:
本文阅读建议用时:5min
本文阅读结构如下表:
项目 | 下属项目 | 测试用例数量 |
---|---|---|
问题背景 | 无 | 0 |
解决方法 | 无 | 1 |
总结 | 无 | 0 |
问题背景
MacOS上用Android Studio 4.0调试逆向得到的smali代码。参考的是官方教程
or do the following in recent Android Studio 3.2:
- Manually disassemble an application using baksmali into a “src” subdirectory of a new project directory, e.g.
baksmali d myapp.apk -o ./projects/myapp/src
- In Android Studio, close your current project and select “Open an existing Android Studio project”. e.g.
~/projects/myapp
- Once the project has been created, right click on the src directory and select “Mark Directory As->Sources Root”
- Make sure your app has android:debuggable=“true” in Android Manifest. Turn on “USB debugging” and use “Select debug app” to select your app in “Developer options” on Android device
- Start your application and forward JDWP service to localhost using adb forward tcp:8700 jdwp:$(timeout 0.5 adb jdwp | tail -n 1)
- In Android Studio, Create a new “Remote” debug configuration (Run->Edit Configurations), and change the debug port to 8700
- In Android Studio, select Run -> Debug
- The application should pause if/when the breakpoint is hit, at which point you can single step, add watches, etc.
其中第5步我是直接打开~/Library/Android/sdk/tools/monitor
。然后在monitor中左键单击选中要调试的应用,再进行第6步。
一开始遇到了新版Android Studio(4.0)无法对smali下断点的问题,这个可以参考这篇文章解决。
没想到能下断点了,但启动调试却提示Line numbers info is not available,如下(这张图是借的别人的,我当时的断点是smali代码中的,但是这个提示是相同的):
解决方法
嗯,原来是没有第3步操作,即"Mark Directory As->Sources Root"。进行这步操作后就行了。
估计是这步操作对调试器声明了源码是这些。
总结
新版Android Studio调试smali,需要注意修改生效的插件。以及调试步骤要一步一步来。
如果本文对你有帮助,不如请我一罐可乐吧 🎃