android脫殼-修改dex2oat

android 6.0.1 dex2oat.cc文件Setup函數(shù)中 修改如下

    // 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)使用

對應(yīng)aosp源碼版本
M4B30Z android-6.0.1_r77 Marshmallow Nexus 5
下載地址:
鏈接: https://pan.baidu.com/s/1p6NuuvJ5KUegf5zCGAvRGQ 密碼: itf3

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容

  • Android 自定義View的各種姿勢1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 173,335評論 25 708
  • 大部分的后端會很很鄙視前端。我也不知道為什么,可能大部分人都會覺得腳本語言根本不算語言。 大多人 會叫我們切圖仔,...
    小黑的眼閱讀 3,432評論 0 15
  • 無事翻電腦,發(fā)現(xiàn)以前給寶寶畫的圖,我這么懶散的人也畫了不少呢..... 這些....我太佩服自己了,我太勤勞了 還...
    司徒軒轅閱讀 714評論 6 12
  • 理發(fā)師一手拿推子,一手持梳子, “哧” 地一聲過去,一絡(luò)頭發(fā)應(yīng)聲而落。看,理發(fā)就這么簡單,似乎人人都可以做理發(fā)師。...
    免貴姓汪閱讀 443評論 0 1
  • 憧憬的生活不一定美好 努力很久也不一定有別人跳的高, 你所謂的堅持還不及別人的四分之一 你所謂的成功僅僅是別人的初...
    龍侯侯閱讀 193評論 0 2