zoukankan      html  css  js  c++  java
  • class-dump + DumpFrameworks.pl

    目的:实现生成 private framework 的 .h,以便倒入项目使用私有 api。


    一、class-dump

      下载地址: http://stevenygard.com/download/

      安装步骤:

        a) 下载了 dmg 打开并把 class-dump copy 到 /usr/bin/ 目录下;

        b) 修改 class-dump 的权限,

    $ chmod 777 /usr/bin/class-dump

    二、DumpFrameworks.pl

      从 github 上别人越狱的工程上下载: https://github.com/shuhongwu/HackSpringDemo/blob/master/DumpFrameworks.pl

      a) 放到任意目录可行。

      b) 根据自己 framework 的地址,修改路径。

      c) cd 到  DumpFrameworks.pl 的路径,并执行

    $ ./DumpFrameworks.pl
    

    DumpFrameworks.pl 文件内容:

    #!/usr/bin/perl
    #
    # 24 November 2008
    # Framework Dumping utility; requires class-dump
    #
    
    use strict;
    
    use Cwd;
    use File::Path;
    
    my $HOME = (getpwuid($<))[7] || $ENV{'HOME'} 
      or die "Could not find your home directory!";
    
    # This command must be in your path.
    # http://www.codethecode.com/projects/class-dump/
    my $CLASS_DUMP = 'class-dump'; 
    
    # 这里路径需要小心,后面像别名一样的东东需要换行的
    
    # Public Frameworks
    dump_frameworks('/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks',
    'Frameworks');
    
    # Private Frameworks
    dump_frameworks('/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/PrivateFrameworks',
    'PrivateFrameworks');
    
    sub dump_frameworks
    {
      my($dir, $subdir) = @_;
    
      opendir(my $dirh, $dir) or die "Could not opendir($dir) - $!";
    
      # Iterate through each framework found in the directory
      foreach my $file (grep { /.framework$/ } readdir($dirh))
      {
        # Extract the framework name
        (my $fname = $file) =~ s/.framework$//;
        print "Framework: $fname
    ";
    
        my $headers_dir = "$HOME/Headers/$subdir/$fname";
    
        # Create the folder to store the headers
        mkpath($headers_dir);
    
        # Perform the class-dump
        my $cwd = cwd();
        chdir($headers_dir) or die "Could not chdir($headers_dir) - $!";
    
        system($CLASS_DUMP, '-H', "$dir/$file");
       
       if($? == -1)
        {
          die "Could not execute $CLASS_DUMP - $!
    ";
        }
          
        chdir($cwd) or die "Could not chdir($cwd) - $!";
      }
    }
    

      


     三、使用

    $ class-dump -H xxx(打包好的文件) -o xxx.h
    

      


    四、其他

      class-dump 作用的对象必须是未经过加密的可执行文件,而从 app store 下载的 app 都是经过签名加密的。 

  • 相关阅读:
    使用 libevent 和 libev 提高网络应用性能
    An existing connection was forcibly closed by the remote host
    各种浏览器的兼容css
    vs输出窗口,显示build的时间
    sass
    网站设置404错误页
    List of content management systems
    css footer not displaying at the bottom of the page
    强制刷新css
    sp_executesql invalid object name
  • 原文地址:https://www.cnblogs.com/eileenleung/p/3820641.html
Copyright © 2011-2022 走看看