5

I'm trying to get jailbreak statistics for a University project related to security in mobile devices. My purpose is to disassemble, add a sample code and re-assemble to obtain a runnable iOS app again.

I have read a lot about IDA, IDA pro, HEX-Rays, and o'tool to disassemble an ipa file.

Since i'm working with a macbook pro, i think that using otool to disassemble an '.ipa' file is the best and faster way. I have tried it with a non-signed .ipa and I have obtained the assembly code.

Then, I have difficulties. I have tried to create a new Xcode project, import this assembly code and try to compile it to generate a new app, without inserting new code just to simplify the process.

But when i tried to compile, Xcode fails in every single code line.

I think that my problem is, that the process described:

  1. Disassemble with otool
  2. Import the code in XCode
  3. Compile and build
  4. Obtain the new app

Is not correct.

1
  • I was trying to add some functionality, but the solution of edit in HEX, is not good for add code. I was thinking to create my own code in XCode, compile and add it to the main program, but i think this will not work because my program will use memory positions that are already used in the main program. Thank you
    – swoken
    Oct 23, 2013 at 14:22

2 Answers 2

6

You won't be able to rebuild with XCode. You'd need to patch the decrypted app with a hex editor in order to make your desired changes.

See http://www.minecraftforum.net/topic/1363777-how-to-make-mods-for-ios/ for a sample walkthrough.

1
  • Hello Jason, I have seen in that forum the way to edit some things changing values in HEX after decrypting the code. I was trying to add some functionality, but this way to edit HEX is really hard to add code. I was thinking to create my own code in XCode, compile and add it to the main program, but i think this will not work because my program will use memory positions that are already used in the main program. Thank you
    – swoken
    Oct 20, 2013 at 9:57
0

Depending on your need

If you need to change the behavior of Objective-C (possibly also Swift) methods or classes, it is way easier to create a tweak for the app. There are also many advantages in doing so, one of them being that a tweak can be un/-installed easily at a large scale (just create a source for Cydia with your tweak).

Note that if you need a one-time and non permanent change, consider using Cycript instead. It is really straightforward (cycript.org). Just inspect the target app's headers with Clutch and class-dump-z in order to have an idea of what you want to modify and you're good to go.

Creating a tweak

In order to create a tweak, you can use iOSOpenDev (and its Logos template) or Theos. iOSOpendev allows you to create your tweak in Xcode and install it to your device, making it really convenient to use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.