IPAPatch

NaituwMIT更新放缓

无需越狱就能给 iOS 应用(IPA)打补丁,方便逆向分析和修改 App 行为。

Patch iOS Apps, The Easy Way, Without Jailbreak.

1.0.1发布于 2017-03-23 12:10 UTC5,307star +1 / 7 天765fork同步于 2026-11-10 11:36 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/Naituw/IPAPatch
将解密后的 ipa 替换到 IPAPatch/Assets/app.ipa 后用 Xcode 打开 IPAPatch.xcodeproj 运行
硬件要求按 README 说明

需要一台真实 iOS 设备用于运行调试,以及安装 Xcode 的 macOS 环境;README 未说明具体机型或系统版本要求。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用 Xcode 模板给第三方 iOS App 注入代码并重打包,免越狱

无需越狱就能给 iOS 应用(IPA)打补丁,方便逆向分析和修改 App 行为。

核心能力

  • 以动态库形式向 ipa 注入自写代码,借 Objective-C runtime 改行为
  • 用 lldb 对第三方 App 单步调试、下断点、打印对象
  • 自动链接 Assets/Frameworks 与 Dylibs 下的外部框架和动态库
  • 通过 options.plist 开关生成可分发 ipa、恢复符号表等行为
  • 入口在 +[IPAPatchEntry load],可配合 Aspects 做方法交换

容易踩的坑

使用的 ipa 必须已解密,否则会报 process launch failed: Unspecified (Disabled);注入的 Swift 框架版本需与当前 Xcode 的 Swift 版本兼容,否则报 libswiftXXX.dylib 符号缺失;架构不匹配会报 mach-o, but wrong architecture,需调整 Valid Architectures;替换的占位文件必须仍命名为 app.ipa。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

2 个版本1.0.1
  1. 1.0.1Demo-Cycript最新正式版2017-03-23 · 2017-03-23 12:10 UTC

    This package demonstrates how to integrate Cycript to Youtube app with IPAPatch, Includes:

    • Decrypted Youtube IPA file, placed at Assets/app.ipa
    • IPAPatch target linked with Cycript.framework
    • CycriptServer started when app finish launching, listen on port 4567
    • BundleID set to com.wutian.youtube-cycript
    • DisplayName Prefix set to Reveal

    Try it by download IPAPatch-Youtube-Cycript.zip

  2. 1.0Demo-Youtube-Integrate-Reveal2017-03-18 · 2017-03-18 16:55 UTC
    查看更新说明

    This package demonstrates how to integrate Reveal to Youtube app with IPAPatch, Includes:

    • Decrypted Youtube IPA file, placed at Assets/app.ipa
    • Reveal framework RevealServer.framework, placed at Assets/Frameworks/RevealServer.framework
    • BundleID set to com.wutian.youtube
    • DisplayName Prefix set to Reveal

    Try it by download IPAPatch-Youtube-Reveal.zip

    Update 201703192337:

    • Demo now works as expected with whitespace contained in project path

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    IPAPatch Logo

    IPAPatch provide a simple way to patch iOS Apps, without needing to jailbreak.

    [ Features • Instructions • Example • FAQ • License ]

    Features

    IPAPatch includes an template Xcode project, that provides following features:

    • Build & Run third-party ipa with your code injected

      You can run your own code inside ipa file as a dynamic library. So you can change behavior of that app by utilizing Objective-C runtime.

      Presented an custom alert in Youtube app

    • Step-by-step Debugging with lldb

      You can debug third-party apps like your own. For example:

      • Step-by-Step debug your code inside other app
      • Set Breakpoints
      • Print objects in Xcode console with lldb

      Debugging Youtube with Xcode

    • Link external frameworks

      By linking existing frameworks, you can integrate third-party services to apps very easily, such as Reveal.

      Inspect Youtube by linking RevealServer.framework

    • Generate distributable .ipa files

      You can distribute your patch/work to your friends very easily, with IPAPatch generated modified version of .ipa files

      Modified version of Facebook.ipa created by IPAPatch

      687474703a2f2f7778312e73696e61696d672e636e2f6c617267652f62656265646262356c7931666979617775357133366a32306774303766676d722e6a7067

    Instructions

    1. Clone or Download This Project

      Download this project to your local disk

    2. Prepare Decrypted IPA File

      The IPA file you use need to be decrypted, you can get a decrypted ipa from a jailbroken device or download it directly from an ipa download site, such as http://www.iphonecake.com

    3. Replace Placeholder IPA

      Replace the IPA file located at IPAPatch/Assets/app.ipa with yours, this is a placeholder file. The filename should remain app.ipa after replacing.

    4. Place External Resources/Frameworks (Optional)

      Follow types of external file are supported:

      • Frameworks:
        • External frameworks can be placed at IPAPatch/Assets/Frameworks folder.
        • Frameworks will be linked automatically.
        • For example IPAPatch/Assets/Frameworks/RevealServer.framework
      • Dynamic Libraries:
        • External dynamic libraries can be placed at IPAPatch/Assets/Dylibs folder.
        • Libraries will be linked automatically
      • Resources/Bundles:
        • Other resources or bundles can be placed at IPAPatch/Assets/Resources
        • Resources will be copied directly to the main bundle of original app
    5. Configure Build Settings

      • Open IPAPatch.xcodeproj
      • In the Project Editor, Select Target IPAPatch-DummyApp
      • Display Name defaults to "💊", this is used as prefix of the final display name.
      • Change Bundle Identifier to match your provisioning profiles
      • Fix signing issues if any.
    6. Configure IPPatch Options

      • You can config IPAPatch's behavior with Tools/options.plist

        NameDescriptionDefault
        RESTORE_SYMBOLSWhen YES, IPAPatch will try to restore symbol table from Mach-O for debugging propose (with tools from https://github.com/tobefuturer/restore-symbol, also thanks to @henrayluo and @dannion)NO
        CREATE_IPA_FILEWhen YES, IPAPatch will generate a ipa file on each build. Genrated file is located at SRCROOT/ProductNO
        IGNORE_UI_SUPPORTED_DEVICESWhen YES, IPAPatch will delete UISupportedDevices from source app's Info.plistNO
        REMOVE_WATCHPLACEHOLDERWhen YES, IPAPatch will remove com.apple.WatchPlaceholder folder from source app's bundleYES
        USE_ORIGINAL_ENTITLEMENTSWhen YES, IPAPatch will use source app's entitlements to resign, you need to make sure your Provisioning Profile matches the entitlements, or you need to disable AMFI on target deviceNO
    7. Code Your Patch

      The entry is at +[IPAPatchEntry load], you can write code start from here. To change apps' behavior, You may need to use some method swizzling library, such as steipete/Aspects.

    8. Build and Run

      Select a real device, and hit the "Run" button at the top-left corner of Xcode. The code your wrote and external frameworks you placed will inject to the ipa file automatically.

    Example

    I created some demo project, which shows you how to use IPAPatch:

    FAQ

    • Q: Library not loaded with reason: mach-o, but wrong architecture ?

      • A: Try set IPAPatch target's Valid Architectures to match your ipa binary's architecture.
    • Q: process launch failed: Unspecified (Disabled) ?

      • A: The ipa file use with IPAPatch must be decrypted, See step.2 of Instructions.
    • Q: dyld: Symbol not found: XXX, Referenced from: XXX, Expected in: XXX/libswiftXXX.dylib

      • The swift version the framework you injecting use, is incompatible with the version of your Xcode

    License

    IPAPatch

       IPAPatch is licensed under the MIT license.

    Copyright (c) 2017-present Wu Tian <[email protected]>.
      
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
      
    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.
      
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.
    
    OPTOOL
    Copyright (c) 2014, Alex Zielenski
    All rights reserved.
    
    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:
    
    * Redistributions of source code must retain the above copyright notice, this
      list of conditions and the following disclaimer.
    
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    
    fishhook
    Copyright (c) 2013, Facebook, Inc.
    All rights reserved.
    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:
      * Redistributions of source code must retain the above copyright notice,
        this list of conditions and the following disclaimer.
      * Redistributions in binary form must reproduce the above copyright notice,
        this list of conditions and the following disclaimer in the documentation
        and/or other materials provided with the distribution.
      * Neither the name Facebook nor the names of its contributors may be used to
        endorse or promote products derived from this software without specific
        prior written permission.
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.