我想知道IPA文件的执行流程 [英] I want to know the flow of execution of an IPA file

查看:189
本文介绍了我想知道IPA文件的执行流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个IPA文件,其中包含info.plist,可执行文件,package.info,配置证书,动态库,代码资源等。我想知道首先执行哪个文件以及执行发生的顺序。我想在IPA中添加一些内容,为此我需要了解现有的IPA如何运作。

I have an IPA file which contains info.plist, executable file, package.info, provision certificate, dynamic library, code resources etc. I want to know which file is executed first and in what order the execution takes place. I want to add some content to the IPA and for that I need to understand how the existing IPA works.

提前致谢。

推荐答案

IPA文件只是应用程序的zip文件。它包含二进制本身,Info.plist,代码签名文件,图标和其他资源。

An IPA file is simply a zip file of an application. It contains the binary itself, an Info.plist, codesigning files, icons, and other resources.

从AppStore下载应用程序时,IPA文件将下载到/ var / mobile / Media / Downloads以及元文件。完全下载后,运行安装守护程序(installd),将IPA提取到/ var / mobile / Applications /< UUID here> /。在这个目录中:

When you download an app from the AppStore, the IPA file is downloaded to /var/mobile/Media/Downloads along with a meta file. After it is fully downloaded, an installation daemon (installd) is run which extracts the IPA to /var/mobile/Applications/<UUID here>/. In this directory goes:


  • 包含所有应用程序资源和可执行文件的.app文件夹。

  • 用于存储任何类型文件的文档文件夹(读/写privelages)。

  • 一个Library文件夹,用于使用NSUserDefaults缓存数据并以plist格式存储键/值数据(Library /首选项/ .plist)。

  • 用于存储临时数据的tmp文件夹。当应用程序未运行时,将删除此文件夹的内容。

  • The .app folder which contains all of the app's resources and the executable.
  • A Documents folder for storing any type of file (read/write privelages).
  • A Library folder for caching data and storing key/value data in plist format using NSUserDefaults (Library/Preferences/.plist).
  • A tmp folder used to store temporary data. This folder's contents are removed when the app is not running.

然后删除IPA文件,从而通过删除应用程序释放空间存档。

The IPA file is then deleted, thus freeing up space by removing the application archive.

当加载SpringBoard(主屏幕应用程序)时,它会读取每个应用程序的Info.plist并对其进行缓存。从中,它获取显示名称(图标下的名称),图标本身以及可执行文件的名称等。

When SpringBoard (the homescreen app) is loaded, it reads the Info.plist of every app and caches it. From this, it gets the display name (name under icon), the icon itself, and the name of the executable, among other things.

当您单击应用程序时图标,当可执行文件加载到内存中时,SpringBoard将应用程序的Default.png显示为闪屏。它在此过程中被解密,因为每个AppStore应用程序在Apple签名时都会被加密。只要可执行文件加载到内存中,dyld(动态链接器)就会加载它所链接的任何框架或库(例如UIKit,libobjc,libSystem等)。应用不能包含任何自己的库;可执行文件必须是独立的。然后,调用app的main()函数,并运行应用程序的代码。

When you click on the app's icon, SpringBoard displays the app's Default.png as a splash screen while the executable is loaded into memory. It is decrypted during this process, as every AppStore app is encrypted when it's signed by Apple. As soon as the executable is loaded in memory, dyld (the dynamic linker) loads any frameworks or libraries that it is linked against (such as UIKit, libobjc, libSystem, etc.). Apps cannot include any libraries of its own; the executable must be standalone. Then, the app's main() function is called, and the app's code is run.

您应该知道一些事项:


  1. 修改应用程序可执行文件中的单个字节将导致代码签名无效,内核将拒绝运行该应用程序。

  1. Modifying so much as a single byte in an app's executable file will invalidate the code signature, and the kernel will refuse to run the app.

除非您在越狱设备上运行,否则即使在运行时也无法编辑或修改可执行文件。如果不以某种方式运行未编码的代码(二进制修改或运行时dylib注入),则无法更改应用程序运行的方式。

Unless you are running on a jailbroken device, the executable file cannot be edited or modified, even at runtime. You cannot change the way that an application runs without running unsinged code in one way or another (binary modding or runtime dylib injection).

IPA只能是由您的帐户安装。您无法下载IPA并希望它能够运行。代码签名无效。

An IPA can only be installed by YOUR ACCOUNT. You cannot download an IPA and expect it to run. The code signature would be invalid.

修改应用程序的运行方式并非易事。有些应用程序将所有配置设置存储在未经验证身份的plist中,但这些应用程序很少见。大多数应用程序将使用散列算法(例如md5或sha1)验证配置或保存文件,这使得在不让应用程序拒绝它们的情况下编辑这些文件变得更加困难。许多其他应用程序根本不使用plist或其他易于编辑的文件类型。他们将使用鲜为人知或专有的格式,或者他们不会使用配置文件。

It is not trivial to modify the way an application runs. Some apps store all of their configuration settings in a plist whose identity is not verified, but these apps are few and far between. The majority of apps will verify configuration or save files with a hashing algorithm (such as md5 or sha1), which makes it much more difficult to edit these files without having the app reject them. Many other apps simply don't use plists or other easily edited filetypes. They will either use a lesser known or proprietary format, or they will not use configuration files.

了解你的意思在关注声音之前重新进入。我并不劝你不要尝试;我只是想帮助你理解为了解决这个问题必须克服的障碍。

Understand what you're getting into before attenpting sonething. I am not discouraging you from trying; I'm just trying to help you understand the obstacles that must be overcome in order to pull this off.

这篇关于我想知道IPA文件的执行流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆