通過蘋果提供的dsc_extractor
來提取
- 蘋果將大部分系統動態庫都打包放在一個緩存文件中(
dyld shared cache
)
- 該文件存放在設施的
/System/Library/Caches/com.apple.dyld/dyld_shared_cache_armX
,越獄后通過xx助手
,或者ifunbox
導出
截屏2021-02-03 下午9.36.51.png
- 下載最新dyld源碼
- 找到
dsc_extractor.cpp
,我下的832.7.1
,路徑在dyld-832.7.1/dyld3/shared-cache/dsc_extractor.cpp
- 將里面的
int main
代碼留下·其他都刪了,打印也可以刪了。
#include <stdio.h>
#include <stddef.h>
#include <dlfcn.h>
typedef int (*extractor_proc)(const char* shared_cache_file_path, const char* extraction_root_path,
void (^progress)(unsigned current, unsigned total));
int main(int argc, const char* argv[])
{
if ( argc != 3 ) {
//fprintf(stderr, "usage: dsc_extractor <path-to-cache-file> <path-to-device-dir>\n");
return 1;
}
//void* handle = dlopen("/Volumes/my/src/dyld/build/Debug/dsc_extractor.bundle", RTLD_LAZY);
void* handle = dlopen("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/lib/dsc_extractor.bundle", RTLD_LAZY);
if ( handle == NULL ) {
//fprintf(stderr, "dsc_extractor.bundle could not be loaded\n");
return 1;
}
extractor_proc proc = (extractor_proc)dlsym(handle, "dyld_shared_cache_extract_dylibs_progress");
if ( proc == NULL ) {
//fprintf(stderr, "dsc_extractor.bundle did not have dyld_shared_cache_extract_dylibs_progress symbol\n");
return 1;
}
int result = (*proc)(argv[1], argv[2], ^(unsigned c, unsigned total) { printf("%d/%d\n", c, total); } );
//fprintf(stderr, "dyld_shared_cache_extract_dylibs_progress() => %d\n", result);
return 0;
}
-
clang++ -o dsc_extractor dsc_extractor.cpp
得到dsc_extractor
可執行文件
截屏2021-02-03 下午9.42.14.png
- 將
dsc_extractor
和dyld_shared_cache_arm64
放在一個文件夾
-
./dsc_extractor dyld_shared_cache_arm64 framework_arm64
提取動態庫
截屏2021-02-03 下午9.43.08.png
- 即可在
framework_arm64/System/Library/Frameworks
里找到
- 然后就可以丟到
hopper
里反編譯了
截屏2021-02-03 下午9.45.01.png
截屏2021-02-03 下午9.45.58.png
- 但是現在卻不像以前那樣,能看到大致偽代碼了,可能跟更新系統,Xcode有關吧,有點難受,有知道的大佬可以DDDD。
end