macos iOS:如何修改 .app 文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11248045/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 09:17:20  来源:igfitidea点击:

iOS: How to modify .app file?

iosmacosreverse-engineering

提问by iamMobile

I've to de-compile iOS .app file and then insert my code and then re-package back to ipa file.

我必须反编译 iOS .app 文件,然后插入我的代码,然后重新打包回 ipa 文件。

Can you please suggest some pointers how to do it?

你能提出一些如何去做的建议吗?

回答by Nirma

You simply can't do this.

你根本无法做到这一点。

Once the app is compiled down to machine code, the best you can get from reverse engineering it is just assembly and unless you are willing to write your fix in assembly I don't see how you are going to integrate your code.

一旦应用程序被编译成机器代码,你可以从逆向工程中得到最好的结果就是汇编,除非你愿意在汇编中编写你的修复程序,否则我不知道你将如何集成你的代码。

Also the code signing will be corrupted by doing this as well. Unless you have valid provisioning set up on your machine you can't repackage the app with the original code signing.

这样做也会破坏代码签名。除非您在计算机上设置了有效的配置,否则您无法使用原始代码签名重新打包应用程序。

Try to get the source or similar source to write an app with the functionality you need.

尝试获取源或类似源以编写具有您需要的功能的应用程序。

回答by gtangil

Yes you can if the device is jailbroken and the signature check is removed.

是的,如果设备已越狱并且签名检查被删除,则可以。

Here there is one case:

这里有一种情况:

Is it possible to edit and recompile an iOS Binary?

是否可以编辑和重新编译 iOS 二进制文件?

In the reply they suggest that the modifications have been taken directly on the binary (by replacing some functions with other of the same size). However, I believe that you can do more advanced things.

在答复中,他们建议直接对二进制文件进行修改(通过用其他相同大小的函数替换一些函数)。不过,我相信你可以做更高级的事情。

You could, for instance, include the assembly of the application into your own objective-c code using XCode:

例如,您可以使用 XCode 将应用程序的程序集包含到您自己的 Objective-c 代码中:

Compiling Assembly (.S) file alongside iPhone project

与 iPhone 项目一起编译程序集 (.S) 文件

Or directly compile the modified assembly into the binary (mach-o) and then repackage.

或者直接将修改后的程序集编译成二进制(mach-o),然后重新打包。

How to create an iPhone mach-o file?

如何创建 iPhone 的 Mach-o 文件?

Maybe GNU ARMor LLVM toolchaincan assit you on doing this: Compile, Assemble and Disassemble Using the LLVM Tool Chain

也许GNU ARMLLVM 工具链可以帮助您执行此操作:使用 LLVM 工具链编译、组装和反汇编

There are just some approaches which I'm currently investigating on. It is not straightforward, so any other know-how on the topic will be very appreciated.

我目前正在研究一些方法。这并不简单,因此将非常感谢有关该主题的任何其他专业知识。