android脱壳-修改dex2oat

android 6.0.1 dex2oat.cc文件Setup函数中 修改如下

    // Ensure opened dex files are writable for dex-to-dex transformations.
    for (const auto& dex_file : dex_files_) {
      if (!dex_file->EnableWrite()) {
        PLOG(ERROR) << "Failed to make .dex file writeable '" << dex_file->GetLocation() << "'\n";
      }
////////////////////////////分割线 以下为添加的代码///////////////////////////////////////////////////////////
      std::string dex_name = dex_file->GetLocation();
      LOG(INFO) << "dex2oat::dex_file name-->" << dex_name;

      if (dex_name.find("jiagu") != std::string::npos
        || dex_name.find("cache") != std::string::npos
        || dex_name.find("files") != std::string::npos
        || dex_name.find("tx_shell") != std::string::npos
        || dex_name.find("app_dex") != std::string::npos
        || dex_name.find("nagain") != std::string::npos) {
        int nDexLen = dex_file->Size();
        char pszDexFileName[260] = {0};
        sprintf(pszDexFileName, "%s_%d", dex_name.c_str(), nDexLen);
        int fd = open(pszDexFileName, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU);
        if (fd > 0) {
          if (write(fd, (char*)dex_file->Begin(), nDexLen) <= 0) {
            LOG(INFO) << "dex2oat::write dex file failed-->" << pszDexFileName;
          } else {
            LOG(INFO) << "dex2oat::write dex file success-->" << pszDexFileName;
          }
          close(fd);
        } else {
          LOG(INFO) << "dex2oat::open dex file failed-->" << pszDexFileName;
        }
      }
////////////////////////////分割线 以上为添加的代码///////////////////////////////////////////////////////////
    }

参考资料:
http://www.mottoin.com/89035.html
http://bbs.pediy.com/showthread.php?t=210275

下面的dex2oat 仅供nexus5(6.0.1)使用

对应aosp源码版本
M4B30Z android-6.0.1_r77 Marshmallow Nexus 5
下载地址:
链接: https://pan.baidu.com/s/1p6NuuvJ5KUegf5zCGAvRGQ 密码: itf3

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 175,807评论 25 709
  • 大部分的后端会很很鄙视前端。我也不知道为什么,可能大部分人都会觉得脚本语言根本不算语言。 大多人 会叫我们切图仔,...
    小黑的眼阅读 8,815评论 0 15
  • 无事翻电脑,发现以前给宝宝画的图,我这么懒散的人也画了不少呢..... 这些....我太佩服自己了,我太勤劳了 还...
    司徒轩辕阅读 3,954评论 6 12
  • 理发师一手拿推子,一手持梳子, “哧” 地一声过去,一络头发应声而落。看,理发就这么简单,似乎人人都可以做理发师。...
    免贵姓汪阅读 3,184评论 0 1
  • 憧憬的生活不一定美好 努力很久也不一定有别人跳的高, 你所谓的坚持还不及别人的四分之一 你所谓的成功仅仅是别人的初...
    龙侯侯阅读 1,332评论 0 2