Giter Site home page Giter Site logo

ldexparser's Introduction

LDexParser

Android Dex parser 用于Xposed查找被混淆的方法 目前只写了查找方法出现的的字符串
更推荐使用 性能更好 更方便使用的dexkit
写此项目仅用于自用与学习 该项目在所有方面都有待优化 我也正在持续优化 可参阅文章学习


基本实现 第一步

                //先初始化 参数一是目标应用类加载器 参数二是apk路径
                DexFinder dexFinder = new DexFinder.Builder(ClassUtils.getHostLoader(), HookEnv.getHostApkPath())
                        .setCachePath(PathTool.getModuleDataPath() + "/MethodFinderCache")//设置运行缓存路径 将使用本地内存代表堆内存 这样可以避免在解析大且多的dex时造成堆溢出
                        .setOnProgress(new DexFinder.OnProgress() {
                            //重写此方法以监听dex解析数量情况 可以用作通知View解析进度
                    @Override
                    public void init(int dexSize) {
                        new Handler(Looper.getMainLooper()).post(() -> loadingDialog.progressBar.setMax(dexSize));
                    }

                    @Override
                    public void parse(int progress, String dexName) {
                        new Handler(Looper.getMainLooper()).post(() -> loadingDialog.progressBar.setProgress(progress));
                    }
                }).build();//调用build方法后会开始解析 目测300MB的qq解析时间在8 - 20s内

第二步 分析查找
我们可以通过jadx或者mt管理器来分析出方法内具体做了什么
比如下面是目标apk的实现代码

public class a {
    private final String s;
    private String b() {
        return PathTool.getDataPath() + "/data/simple/" + s;
    }
}

很多地方 比如类名方法已经经过混淆 使得我们难以hook以实现自适配
下面看如何查找方法内出现的的字符串

    //查找方法内包含"/data/simple/"字符串的方法
    ArrayList<Method> methodList = dexFinder.findMethodString("/data/simple/");
    //findMethodString返回的是一个ArrayList , 查找所有符合的方法 查找不到不会为null而是为size == 0

ldexparser's People

Contributors

suzhelan avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

lianquke

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.