Giter VIP home page Giter VIP logo

debugapksmali's Introduction

基于 Smali 文件 Android Studio 动态调试 APP

最近在研究动态调试技术,网上关于基于 Smali 动态调试App的教程很多,很多细节都没有贴出来,走了很多弯路,将调研结果分享一下,如果有写的不好地方,欢迎指正

Github:https://github.com/hi-dhl/DebugApkSmali

准备工作

  • 一部 Root 过的 Android 手机,打开开发者模式
  • Xposed 的运行的环境
  • 安装 smalidea 插件,点击这里下载
  • 安装 BDOpener.apk 或者 XDebug.apk

反编译 Apk(apktool)

点击 这里下载 最新的 apktool , 并配置好环境(不同环境配置的方式不同,参考 官网

下载你需要反编译的 Apk 文件,执行

apktool d 反编译Apk名字.apk

如果反编译出来多个smali文件夹,可以用ant写个脚本,多个文件夹合并成一个

smalidea

AndroidStudio 如果要调试smali代码,需要安装第三方插件: smalidea

AS中【Android Studio-->Preferences-->Plugins-->Install plugin from desk...】,安装插件

Android Studio 导入 smali

  • **一个 Android 工程项目(ps: 一定要新建Android项目,否则可能会找不到 “Attach debuger to Android Process”)删掉自动创建的资源和代码文件

  • 复制反编译好的 smali 文件, 到新建 Android 项目 java 文件夹下

PS: 也可以使用我配置好的项目 "ApkSampleSmali" , 需要安装提供的 Sample.apk进行测试

Android Studio 动态调试配置

新建调试配置,【Run-->Edit Configurations--> + -->Remote】,name 随意,端口 8700

动态调试

  • 在 smali 代码中打入断点,如下图标记1

  • 然后点击 “Attach debuger to Android Process” ,如下图标记2

  • 选择你要调试的进程,手动进入对应功能, 即进入断点动态调试(ps: 如果你想要的进程没有展示出来,请重新勾选 xposed module(BDOpener), 重启手机)

运行环境信息

  • Xposed Version90-beta3
  • BDOpener 1.0
  • AndoridStudio 3.3.2
  • smalidea 0.0.5
  • apktool 2.4.0

结语

致力于分享一系列 Android 系统源码、逆向分析、算法、翻译、Jetpack 源码相关的文章,如果你喜欢这篇文章欢迎 Star 一起来学习,期待与你一起成长

文章列表

Android 10 源码系列

Android 应用系列

工具系列

逆向系列

debugapksmali's People

Contributors

hi-dhl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.