日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

【Android 逆向】ART 脱壳 ( InMemoryDexClassLoader 脱壳 | DexFile 构造函数及相关调用函数 | Android 源码中查找 native 函数 )

發布時間:2025/6/17 Android 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【Android 逆向】ART 脱壳 ( InMemoryDexClassLoader 脱壳 | DexFile 构造函数及相关调用函数 | Android 源码中查找 native 函数 ) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

文章目錄

  • 一、DexFile 構造函數
  • 二、DexFile.openInMemoryDexFile 函數
  • 三、Android 源碼中查找 native 函數





一、DexFile 構造函數



上一篇博客 【Android 逆向】ART 脫殼 ( InMemoryDexClassLoader 脫殼 | BaseDexClassLoader 構造函數 | DexPathList 構造函數及后續調用 ) 分析到 , 在 DexPathList 中的 makeInMemoryDexElements 方法中 , 調用了 DexFile(ByteBuffer buf) 構造函數 , 創建 DexFile ;


DexFile 構造函數中 , 調用了 openInMemoryDexFile 函數 ;


DexFile 構造函數源碼 :

/*** 加載DEX文件。此類僅供內部使用,不應使用* 通過申請。* * @已棄用的此類不應由應用程序直接使用。會痛的* 在大多數情況下,會導致字節碼的錯誤執行* 最壞的情況。應用程序應該使用一個標準類加載器,例如* 改為{@link dalvik.system.PathClassLoader}<b> 此API將被刪除* 在未來的Android版本中</b>。*/ @Deprecated public final class DexFile {DexFile(ByteBuffer buf) throws IOException {// ★ 核心跳轉mCookie = openInMemoryDexFile(buf);mInternalCookie = mCookie;mFileName = null;} }



二、DexFile.openInMemoryDexFile 函數



在 DexFile.openInMemoryDexFile 函數中 , 調用了 222 個 native 方法 ,

/*** 加載DEX文件。此類僅供內部使用,不應使用* 通過申請。* * @已棄用的此類不應由應用程序直接使用。會痛的* 在大多數情況下,會導致字節碼的錯誤執行* 最壞的情況。應用程序應該使用一個標準類加載器,例如* 改為{@link dalvik.system.PathClassLoader}<b> 此API將被刪除* 在未來的Android版本中</b>。*/ @Deprecated public final class DexFile {private static Object openInMemoryDexFile(ByteBuffer buf) throws IOException {if (buf.isDirect()) {// ★ 核心跳轉return createCookieWithDirectBuffer(buf, buf.position(), buf.limit());} else {// ★ 核心跳轉return createCookieWithArray(buf.array(), buf.position(), buf.limit());}}private static native Object createCookieWithDirectBuffer(ByteBuffer buf, int start, int end);private static native Object createCookieWithArray(byte[] buf, int start, int end); }

源碼路徑 : /libcore/dalvik/src/main/java/dalvik/system/DexFile.java#openInMemoryDexFile





三、Android 源碼中查找 native 函數



進入 Android 源碼查看網站 http://aospxref.com/android-8.0.0_r36/ ,

在 Project(s) 中 , 選擇 " select all " , 選中所有模塊 , 在 " Full Search " 中 搜索 createCookieWithDirectBuffer 函數 , 這是 native 函數 ,

搜索出該 native 函數在 /art/runtime/native/dalvik_system_DexFile.cc 中定義 ;

總結

以上是生活随笔為你收集整理的【Android 逆向】ART 脱壳 ( InMemoryDexClassLoader 脱壳 | DexFile 构造函数及相关调用函数 | Android 源码中查找 native 函数 )的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。