Giter Club home page Giter Club logo

dexrewrite-1's Introduction

DexRewrite

A Framework for Rewriting DEX Files,Mainly for Android shell unpack,

How to build?

  1. Build in android studio with cmake
  2. Build in clion with cmake

Usage

There are usage examples in library.cpp

eg.1

Lookup all class

void lookup_all_class(dex_ir::Header *mHeader) {
    for (auto &class_item : mHeader->GetCollections().ClassDefs()) {
    }
}

eg.2

Look up all Dexcode,you can modify Dexcode.

/**
 * look up all dexcode item
 * @param mHeader
 */
void lookup_all_code(dex_ir::Header *mHeader) {
    for (auto &code_item : mHeader->GetCollections().CodeItems()) {

    }
}

eg.3

lookup all method

void lookup_all_method(dex_ir::Header *mHeader) {
    for (auto &method_item : mHeader->GetCollections().MethodItems()) {
        //name
        auto method_name = method_item.second->GetMethodId()->Name()->Data();
        auto method_sign = method_item.second->GetSignure();
        auto class_name = method_item.second->GetClassName();

        //dex_code
        auto code_item = method_item.second->GetCodeItem();
        if (code_item != nullptr) {

        }
        //fix 3
        // memcpy(method->GetCodeItem()->Insns(), dexcode_i1, method->GetCodeItem()->InsnsSize() * 2);
        //create new code_item
        //dex_ir::CodeItem *codeItem = mHeader->GetCollections().CreateCodeItem(*mDexFile.get(),reinterpret_cast<uint8_t *>(dexCode),index,code_items->GetMethodItem()->GetMethodId()->GetIndex());
        //code_items->GetMethodItem()->SetCodeItem(codeItem);
        // change AccessFlags to remove native falgs
        // method_item.second->SetAccessFlags()
    }
}

About

Copy from AOSP https://android.googlesource.com/platform/art/+/master/dexlayout/ https://android.googlesource.com/platform/art/+/refs/heads/master/libdexfile/

dexrewrite-1's People

Contributors

xiaobaiyey 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.