smali
语法
案例
有点像汇编
ARM
寻址
寄存器
IDA
debug 静态分析
apktool d test.apk <-o output>
apktool b bar <-o new_bar.apk>
检查apk校验工作
日志信息
adb logcat -s <Tag>
分析native
IDA实战小demo 找不到合适IDA for mac破解版 莫名crash 难以实战
分析思路
动态分析smali
步骤
decompile apk
apktool d test.apk <-o output>
修改 AndroidManifest.xml
<application android:debuggable="true"
不然debug会报错 Unable to open debugger port (localhost:7800): java.net.SocketException "connection reset")
入口Activity
一般有action
和category
<activity android:name="xxx.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
rebuild apk
apktool 会遇到错误
apktool b bar <-o new_bar.apk> < 2> error.txt >
error: Error retrieving parent for item: No resource found that matches the given name ‘@android:xxxx’.
一般情况下,此时更新最新的apktool.jar就可以解决问题,但有时单纯更新apktool也不行。其实问题不在apktool,而是framework太旧了! 如果你只是更新了apktool.jar,而没有更新framework,这时候很有可能还会遇到最初的问题。 如果你不知道自己的framework路径,就去运行一遍apktool d命令,命令行中会显示使用的framework路径
1 |
|
当你下次运行apktool时,会自动安装对应的framework,这样一来就算完全更新了apktool。
error: Public symbol xxx declared here is not defined.
1 |
|
我注释掉对应文件的对应行
重新打包签名
zipalign
可以确保所有未压缩的数据的开头均相对于文件开头部分执行特定的字节对齐,这样可减少应用消耗的 RAM 量。
1 |
|
更新到sdk/build-tools/28.0.3
使用apksigner
进行签名
使用 keytool
生成一个私钥 my-release-key.jks
1 |
|
在本例中,在使用单密钥库文件 my-release-key.jks
中存储的私钥和证书签署 APK 后,将以 my-app-release.apk
的形式输出签署的 APK。
1 |
|
验证您的 APK 是否已签署:
1 |
|
安装apk
先卸载原来的apk 否侧
adb: failed to install xxx.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package [package name] signatures do not match previously installed version; ignoring!]
1 |
|
导入到AS
安装插件
导入工程
导入反编译后的文件夹 一直next直到finish
配置project
这步做不做好像没所谓
配置jdk
debug 配置 remote
打开对应的APP
1 |
|
端口转发
1 |
|
下断点
res/values/public.xml
了解程序结构,找破解的地方。在View确定控件。
- apk toast message 反馈 直接查字符串
- 手动log
adb logcat -s SN:v
- 逐步调试
- DDMS 里面的
Method Profiling
- 找控件
adb shell dumpsys activity top > 4.txt
定位Activity,再debug
小思路
内购
登录注册
动态分析so
逆向加固
- apk 先解压出
classes.dex
使用dex2jar+jdgui
- 使用
apktool
反编译