I want to know the IPA file execution thread

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

Thanks in advance.

+4
source share
1 answer

An IPA file is just an application zip file. It contains the binary file itself, Info.plist, codes defining files, icons and other resources.

When you download the application from the AppStore, the IPA file is uploaded to / var / mobile / Media / Downloads along with the metafile. After it is fully downloaded, the installation daemon (installd) is launched, which retrieves the IPA in / var / mobile / Applications / <UUID here> /. This directory goes:

  • A .app folder containing all application resources and an executable file.
  • The Documents folder for storing files of any type (read / write).
  • A library folder for caching data and storing key / value data in plist format using NSUserDefaults (Library / Preferences / .plist).
  • The tmp folder used to store temporary data. The contents of this folder are deleted when the application is not running.

Then the IPA file is deleted, freeing up space, deleting the application archive.

When the SpringBoard (desktop application) loads, it reads the Info.plist of each application and caches it. From this, among other things, it gets the display name (the name under the icon), the icon itself and the name of the executable file.

When you click the application icon, SpringBoard displays the Default.png application as a splash screen when the executable is loaded into memory. It decrypts during this process, as each AppStore application is encrypted when it is signed by Apple. As soon as the executable file is loaded into memory, dyld (dynamic linker) loads any frameworks or libraries with which it is associated (for example, UIKit, libobjc, libSystem, etc.). Applications cannot include any libraries; The executable must be offline. Then the app main () function is called and the application code is run.

There are a few things you should know:

  • Changing it in the same way as one byte in the application executable will invalidate the code and the kernel will refuse to run the application.

  • If you are not working on a jailbreak device, the executable file cannot be edited or modified even at run time. You cannot change the way the application starts without starting the incorrect code anyway (binary modification or runtime dylib injection).

  • IPA can only be set by YOUR ACCOUNT. You cannot download IPA and wait for it to start. Code signature is invalid.

  • Incorrectly change the way the application starts. Some applications save all their configuration parameters in a plist, whose identity has not been verified, but these applications are a little and far from each other. Most applications will check the configuration or save files using a hash algorithm (for example, md5 or sha1), which greatly complicates editing these files without rejecting the application. Many other applications simply do not use plists or other easily editable file types. They will either use a lesser-known, or proprietary format, or will not use configuration files.

Understand what you are entering before listening to it. I do not discourage you from trying; I'm just trying to help you understand the obstacles that need to be overcome in order to remove this.

+9
source

All Articles