Code Monkey home page Code Monkey logo

Comments (1)

yongyecc avatar yongyecc commented on August 17, 2024

请教一下大佬,现在的版本只能进行单classes.dex文件的加固 如果是多classes.dex文件,应该如何实现加固呢?

通过下面这个函数,将dump下来的其他DEX拼接到pathList字段里面去即可。

public void load(Context oApp, String path) {
        try {
            // 已加载的dex
            Object dexPathList = getField(BaseDexClassLoader.class, "pathList", oApp.getClassLoader());
            Object dexElements = getField(dexPathList.getClass(), "dexElements", dexPathList);

            // patchdex
            String dexOptDir = oApp.getCacheDir().getAbsolutePath();
            DexClassLoader dcl = new DexClassLoader(path, dexOptDir, null, oApp.getClassLoader());
            Object patchDexPathList = getField(BaseDexClassLoader.class, "pathList", dcl);
            Object patchDexElements = getField(patchDexPathList.getClass(), "dexElements", patchDexPathList);

            // 将patchdex和已加载的dexes数组拼接连接
            Object concatDexElements = concatArray(patchDexElements, dexElements);

            // 重新给dexPathList#dexElements赋值
            setField(dexPathList.getClass(), "dexElements", dexPathList, concatDexElements);
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }

from apksheller.

Related Issues (8)

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.