美文网首页ReverseiOS逆向
dsc_extractor工具安装及使用 (dyld_share

dsc_extractor工具安装及使用 (dyld_share

作者: 不聪明的猿类 | 来源:发表于2017-12-11 22:31 被阅读0次

    此贴步骤通过狗神原贴整理,问题为自己总结
    1、leo-MacBook-Pro:~ leo$ cd ~

    2、leo-MacBook-Pro:~ leo$ mkdir dsc_extractor

    3、leo-MacBook-Pro:~ leo$ cd dsc_extractor

    4、leo-MacBook-Pro:~ leo$ wget http://opensource.apple.com/tarballs/dyld/dyld-210.2.3.tar.gz (提示无wget 个通过brew安装 brew install wget)

    5、leo-MacBook-Pro:dsc_extractor leo$ tar xvf dyld-210.2.3.tar.gz

    6、leo-MacBook-Pro:~ leo$ cd dyld-210.2.3/launch-cache/

    7、leo-MacBook-Pro:launch-cache leo$ touch dsc_extractor.patch (ls 看下多出一个 dsc_extractor.patch 文件)

    8、拷贝如下内容到dsc_extractor.patch文件中

    https://gist.githubusercontent.com/lightbulbone/6092321/raw/305c9cc67a2379cdf852903de2d4b102c8e7bf4a/dsc_extractor.patch
    

    9、leo-MacBook-Pro:launch-cache leo$ patch < dsc_extractor.patch (如遇问题可参考问题一)

    10、leo-MacBook-Pro:launch-cache leo$ clang++ -o dsc_extractor dsc_extractor.cpp dsc_iterator.cpp (如遇问题可参考问题二)

    xtractor.cpp dsc_iterator.cpp
    In file included from dsc_extractor.cpp:51:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ext/hash_map:213:5: warning:
      Use of the header <ext/hash_map> is deprecated. Migrate to
      <unordered_map> [-W#warnings]
    #   warning Use of the header <ext/hash_map> is deprecat...
        ^
    1 warning generated.
    

    安装成功
    11、使用

    leo-MacBook-Pro:launch-cache leo$ ./dsc_extractor  /Users/leo/Desktop/iosRETest/dyld_shared_cache_arm64  /Users/leo/Desktop/iosRETest/dyldarm64
    

    launch-cache目录下,./dsc_extractor dyld_shared_cache存放目录 /xxx/xx/x/解出的文件存放目录

    问题一:

    leo-MacBook-Pro:launch-cache leo$ patch < dsc_extractor.patch
    
    patching file dsc_extractor.cpp
    patch unexpectedly ends in middle of line
    patch: **** unexpected end of file in patch
    

    原处:

    -#if 0 
    +/* #if 0 */
    

    修改成

    -#if 1 
    +/* #if 1 */
    

    在+/* #endif */ 后 按下回车,添加一行

    再次运行

    patch < dsc_extractor.patch
    

    问题二:

    leo-MacBook-Pro:launch-cache leo$ clang++ -o dsc_extractor dsc_extractor.cpp dsc_iterator.cpp
    In file included from dsc_extractor.cpp:51:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ext/hash_map:213:5: warning:
      Use of the header <ext/hash_map> is deprecated. Migrate to
      <unordered_map> [-W#warnings]
    #   warning Use of the header <ext/hash_map> is deprecat...
    ^
    dsc_extractor.cpp:232:20: error: assigning to 'char *' from
      incompatible type 'const char *'
    ...while ( (slash = strchr(afterSlash, '/')) != NULL ) {
                      ^~~~~~~~~~~~~~~~~~~~~~~
    dsc_extractor.cpp:460:2: error: unterminated conditional
      directive
    #if 0
    ^
    1 warning and 2 errors generated.
    

    原处:230行

    const char* afterSlash = &dirs[1];
    

    修改成:

    char* afterSlash = &dirs[1];  去除const
    

    原处:460行

    #if 0
    

    修改成:

    #if 1
    

    原处:488行

    /* #endif */
    

    修改成:

    #endif 放开注释
    

    再次运行
    clang++ -o dsc_extractor dsc_extractor.cpp dsc_iterator.cpp

    步骤参考:http://iosre.com/t/when-dyld-decache-fails-on-dyld-shared-cache-arm64-dsc-extractor-saves-our-days/1974

    相关文章

      网友评论

        本文标题:dsc_extractor工具安装及使用 (dyld_share

        本文链接:https://www.haomeiwen.com/subject/osgwixtx.html