zoukankan      html  css  js  c++  java
  • class-dump在osx 10.11以后安装方法

    当Mac升级了OSX 10.11后,配置class-dump的时候,会发现逆向书上推荐的class-dump存放目录/usr/bin,class-dump存放不进去,尝试过用sudo 还是不被允许。

    • 原因是 OSX10.11的一个新特性 Rootless,也叫System Integrity Protection(SIP)和SELinux差不多,都是限制root用户的权限。
      其实可以在RecoveryMode关闭这个特性,这样就直接可以读写/usr/bin了,不过不建议。
      (关闭方法:开机的时候按住option出现选择磁盘的界面按command + R进入RecoveryMode,选择实用工具终端,输入csrutil disable回车搞定)

    查找网上的资料,目前我用的方法是改变 class-dump 的环境变量来使用。
    class-dump下载地址:http://stevenygard.com/projects/class-dump/

    1. 首先打开Terminal,输入mkdir ~/bin,在当前用户根目录下创建一个bin目录。
    2. 把下载下来的 dmg 打开,复制文件里面的class-dump到创建的bin目录下。赋予其可执行权限:
      chmod +x ~/bin/class-dump
    3. 打开bash_profile文件配置环境变量:
      vim ~/.bash_profile
      按下 i 键进入编辑状态,在最下方加一行 
      export PATH=$HOME/bin/:$PATH
      按下esc键,再按shift+: 输入 wq进行保存退出编辑
    4. 在Terminal中执行source ~/.bash_profile
    5. 测试是否改变成功

    测试结果为:

    MelodydeMBP:~ melody$ class-dump 
    class-dump 3.5 (64 bit)
    Usage: class-dump [options] <mach-o-file>
    
      where options are:
            -a             show instance variable offsets
            -A             show implementation addresses
            --arch <arch>  choose a specific architecture from a universal binary (ppc, ppc64, i386, x86_64, armv6, armv7, armv7s, arm64)
            -C <regex>     only display classes matching regular expression
            -f <str>       find string in method name
            -H             generate header files in current directory, or directory specified with -o
            -I             sort classes, categories, and protocols by inheritance (overrides -s)
            -o <dir>       output directory used for -H
            -r             recursively expand frameworks and fixed VM shared libraries
            -s             sort classes and categories by name
            -S             sort methods by name
            -t             suppress header in output, for testing
            --list-arches  list the arches in the file, then exit
            --sdk-ios      specify iOS SDK version (will look in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS<version>.sdk
            --sdk-mac      specify Mac OS X version (will look in /Developer/SDKs/MacOSX<version>.sdk
            --sdk-root     specify the full SDK root path (or use --sdk-ios/--sdk-mac for a shortcut)
    MelodydeMBP:~ melody$

    到了这里 class-dump的安装基本完成了^ ^

  • 相关阅读:
    实时黄金价格[自动刷新]
    ping不通动态域名,解决方法
    清除新版阿里旺旺2008自动添加的右键菜单
    MPLS 原理详解
    windows远程桌面缺陷单用户和多用户
    Flash player ActiveX 9错误的解决办法
    关于DHCP原理的讲解
    找回丢失的IE、网上邻居等桌面图标
    xp安装了SP3以后无法更新的解决办法(XP自动更新下载后安装失败)
    ADSL 定时断线重连bat文件 [转载]
  • 原文地址:https://www.cnblogs.com/isItOk/p/7498804.html
Copyright © 2011-2022 走看看