初始化配置iOSOpenDev的Xcode项目

去掉Deploymen Info中的Mac和确保iOS版本一致

此处,先去做第一个配置方面的改动:

  • TARGETS->General->Deploymen Info:去掉Mac,因为我们开发的是iOS的插件,不需要发布到Mac,且设置好iOS的最低版本
    • deployment_remove_mac
  • PROJECT->Info->Deployment Target->iOS Deployment Target,也要同步设置iOS的最低版本
    • target_deployment_ios_version

导入依赖库libsubstrate.dylib

libsubstrate.dylib(一般在/opt/iOSOpenDev/lib/libsubstrate.dylib):

import_libsubstrate_dylib

导入到项目中的:Targets->YourProjectName->Build Phases->Link Binary With Libraries

imported_link_lib

设置被hook的app包名或二进制文件名

去把要hook的,被拦截的app的包名,加到被hook的包名的列表中:

YourProjectName->YourProjectName->Package->Libarary->MobileSubstrate->DynamicLibraries->CurrentProjectBundleIdentifier.plist

Root->Filter->Bundles,会看到Item 0

  • TypeString
  • Value:填入你要hook的app的包名
    • 举例
      • com.crifan.ShowSystemInfo

set_filter_bundle

  • 另外
    • 如果要新增一行
      • 移动到Item 0所在的行,会看到出现个=加号,点击加号,会新增一行

如何hook二进制?

如果需要hook二进制,则是新建Array类型的(和Bundles并列的)Executables子项,再加上对应的二进制文件名

举例:

  • hook二进制:akd = AuthKit.framework的daemon进程
    • hook_target_executables_akd

此时,对应的plist文件内容是:

  • jailAppleAccount/Package/Library/MobileSubstrate/DynamicLibraries/jailAppleAccount.plist
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
      <key>Filter</key>
      <dict>
        <key>Executables</key>
        <array>
          <string>akd</string>
          <string>amsaccountsd</string>
          <string>AppleMediaServices</string>
          <string>AppleAccount</string>
          <string>Preferences</string>
        </array>
        <key>Bundles</key>
        <array>
          <string>com.apple.Preferences</string>
        </array>
      </dict>
    </dict>
    </plist>
    

设置iPhone的IP

把此处要把iOS调试设备(iPhone)中的IP地址:

iphone_ip_address

此处是:192.168.1.27

去加到配置中去:

  • iOSOpenDevDevice = 192.168.1.27

user_define_device_ip

附上原默认的更新后的配置:

iOSOpenDevBuildPackageOnAnyBuild = NO
iOSOpenDevCopyOnBuild = NO
iOSOpenDevDevice = 192.168.1.27
iOSOpenDevInstallOnAnyBuild = NO
iOSOpenDevInstallOnProfiling = YES
iOSOpenDevPath = /opt/iOSOpenDev
iOSOpenDevRespringOnInstall = YES
iOSOpenDevUsePackageVersionPList = YES

另外,理论上,去把对应变量加到环境变量:

➜  ~ cat ~/.zshrc | grep iOSOpenDevDevice
export iOSOpenDevDevice=192.168.1.27

效果应该也是一样的。

results matching ""

    No results matching ""