Reverse engineering and patching of iOS app (IPA file) - ios

For my master thesis I am working on reverse engineering a IPA file, since I'm new to this topic I'm open on all kind of suggestions. If anyone has any good tutorial or readings or just some personal knowledge to share with me, I would really appreciate it.
Long story short, I must:
RE the IPA: for this I'm focusing on two tools, IDA Pro (that isn't free) and Radare2 (open source).
Patch the RE app: I need to find specific safety checks (e.g. login, jailbreak, etc.), change the specific check in such a way that it returns the value I want.
Install the modified IPA on a jailbroken device to see that what I did worked :D
As I said, I am not expecting any ready-to-go solution for this question, instead I just would like to have some hints that could bring me on the right learning tracks.
Thanks a lot!!

Related

Xcode / IOS Code visibility

How easy can it be for people to see the code / inner working mechanics of a published iOS app?
E.g if there was a certain algorithm or function/class, how easily could people be able to read that?
If it’s possible, is there any way to camouflage or encrypt it so the code can’t be read?
Cheers
A certain algorithm or function/class is not going to be visible to anyone just from having access to a published app. The apps executable has been compiled and optimised so the original source does not even exist inside it. The executables are also encrypted and while can be decrypted if you jail brake a device even then you won't get much info.
While a lot of information about how an app works can be deduced by examining how it works individual algorithms is not something to worry about.
Plus what makes you think anyone is even going to bother trying for your app.
EDIT
As there was some confusion here is a link which talks about the binaries being encrypted when producing universal and thinned ipa files:
https://developer.apple.com/library/content/qa/qa1795/_index.html#//apple_ref/doc/uid/DTS40014195-CH1-APP_STORE_CONSIDERATIONS

Want to build iOS app

What is the best application or programming languages to build an iOS application platform for chat application for beginner like me. Please anyone can tell me about it.
Apple put a lot of effort in its new `Swift' language.
On any Mac computer, you will find XCode on the app store.
iBook has a nice and clear electronic copy of the guide.
I've gotta admit I was a bit circumspect ("yet a new language ?") but it appears has they sell it, solid and sound.(It's compiled and based on llvm. It is open as well, perhaps MIT license?)
I think they basically came up with C# for iPhone (it may even spawn from `mono'?)
But, again, the license model for the source make it sound more promising.
I found the iBook guide for very comprehensive when it came to the very basic of the language and the libraries.
XCode comes with quite a few templates showcasing each major application type. (You can also check the other languages for yourself: Objective-C and javascript)
So the two complement nicely.
If you are starting from scratch, I see no reason not to start on this train.
Since it's straight from Apple, and if coming up with Android isn't yet part of your plan, it will also be your path of least resistance when it comes to technical difficulties.

Using packagemaker to build iOS app installer

I'm developing a sophisticated engineering calculation iPad app for a specific customer (much like the poster of this question). I'm getting ready to release a first version to them, and trying to get this distribution issue sorted out. There are pretty much 5 methods covered throughout that post (general App Store, B2B, Enterprise, Ad Hoc, and stuff requiring Jail Breaking), and most of the searching I've done has shown those same 5 options. I've been looking into TestFlight to manage the Ad Hoc distribution for beta testing right now, but down the road I'm going to need to allow my customer to mass install my app onto as many devices as desired (hopefully without needing to involve me at all by that point). So in the end, none of these 5 options are really attractive as a final solution.
A colleague found this App Doc that mentions something call packagemaker, which sounds like it's a Terminal tool, but I can't really find much on it (the Apple Doc simply says "create the package as you normally do", which is pretty much meaningless since I normally don't - and everything else I can find is from around 2009, and I've learned that anything described in those old posts is almost certainly wrong by this point when it comes to the Apple world). From what I can tell, packagemaker should let me build an installer executable that I can send to my customer, and they could just run that installer and it would put the app on their device. This is how we currently distribute similar software for Windows environment devices, and it would be ideal for what I'm trying to do.
Does anyone know if packagemaker can be used as I've described to install iOS apps? If so, can anyone point me toward a beginner-orientated tutorial on how to use it?
Packagemaker sounds like overkill. The old tuts should still work though, it hasn't changed much (or at all) since 10.5. It's a separate download from Apple Developer center.
You could use testflight, though I presume you want to install B2B apps, and not ad-hoc apps for testing.
In that case just create a bash script that builds and/or deploys your app to a connected device with xcodebuild and related tools. If you're concerned that your end user will find Terminal use appalling, write a tiny Cocoa app to support & run the script, and put the script and your iPad app into the bundle.
For example the app's User Interface could query the user for paths, the device, and whatever is necessary to deploy your app and pass it to the bash script which you can run easily with NSTask.
This is certainly going to be many times faster than getting into PackageMaker, and figuring out how it works - cause it really doesn't work in a straightforward way, unfortunately.

Is it possible to recover an iOS app from my iPhone?

I was halfway through developing an iOS app but have sadly lost the development files (it's a long story). I have the latest version still on my iPhone. Is there some way of recovering it or even just part of it for use in Xcode?
Thanks.
In theory you can decompile the binary, which should be backed up in your iTunes backup. It is not a simple process, and if you encrypted the binary you should maybe just give up. The result of the decompilation will be nothing like what you started with -- rather it will be a bunch of cryptic C functions that don't necessarily make sense but which will compile back to your app. You might get something usable. Assuming that you actually are able to decompile and rebuild your app, the challenge you will face is in the future -- maintaining/updating cryptic code.
So my advice is to check the possibility of local backups/checkins (as per other answers here). You might try undeleting the files from your hard drive (DON'T save any more files to your disk, just download undelete software and try it). Short of those things, you can take to heart the advice of my Comp Sci 101 professor. I quote:
Don't fret - it's always easier the second time around.
Good luck.
If you have Time machine enabled on your mac you may want to look in there. But other than that I don't think so.

iOS sample projects to learn from

I am just starting iOS development. I read some tutorials, watched stuff on iTunes U and wrote some sample code myself. Now I want to take the next step. I want to learn about best practices for iOS development in XCode.
Are there any well written and well organized iOS projects that one could take a look at?
(As I see it, iOS is not exactly the place for open source enthusiasts, however.)
Thanks
Mike.
I agree with several of the other answers that state that looking at many, many projects for mini-examples of what you want to do in your own app is the way to go.
However, you asked for an example of an app demonstrating best practices.
You could do worse than to read Matt Gallagher's blog, Cocoa with Love from beginning to end. However, the app example you asked for is right here.
Not only will it show a variety of techniques, some novel design and best-practices, but also he points out where he feels that he might have done something better.
It's a great read.
I would suggest the following process: (it worked for me)
Think of an advanced app. that you eventually want to be proficient enough to create.
Make a top-down problem-solving tree containing the necessary skills required to build your final app.
Use this tree to divide your final app. into 'sub apps'. Start at the bottom of the tree, find a tutorial specifically for that skill, and make a "Hello World" app. that uses that skill.
Keep progressing upwards, creating 'sub apps' as you go.
When you are finally ready to make your final app. (it will take a while), you will have a good handle on how iOS development works. It will also be a great test of your knowledge via direct application!
Getting the hang of iOS development can be tricky; it really does require a top-down approach, and every online resource I've found takes a linear one. The only way that I think a linear approach to learning iOS development would be manageable, is to take it one small task at a time.
As for specific resources, I always google "[what I want to do] iPhone SDK" and browse the tutorials and forum posts that come up.
Here are some open source iOS apps. However, they aren't very well documented and are also very advanced.
TKAWebView - A subclass of UIWebView that handles authentication and downloading.
Welcome to your Mac - An iOS app. to VNC into a PC/Mac and do some cool stuff.
InAppSettingsKit - A settings screen creator for your apps.
Good luck!
The people behind the Parse platform have made two complete projects.
For each project there is the complete source code, a tutorial and the resulting app is also available from the AppStore.
Anywall: https://parse.com/anywall
Anypic: https://parse.com/anypic
They both rely heavily on the Parse platform as the data source, but you still get a feel for an iOS project.
Molecules is a great open-source app that uses 3D OpenGL to render complex models of molecules.
Just keep coding my friend. You'll learn over a period of time. The best way to get dirty in a mud fight is to jump into it... Weird analogy but you get the point.
Maybe someday, we all will learn from you then !
Like you said there many and many source codes are available internet, but most are incomplete.
I found some Open source codes of REAL application currently available through Apple app store are given here
Free iPhone App Source Codes of real apps
and also, you can find many answers here on stackoverflow question - Are there any Open-source iPhone applications around?
You can download free IOS sample projects from http://devcodemarket.com
I realize this is an old thread but I've also been looking for good objective-c code examples recently and I just realized that TextEdit's source code is available at the Mac Developer Library webpage.
Also, here are some popular objective-c libraries that have caught my attention:
CocoaPods
AFNetworking.
you can also go through UICatalog from Developers Library and download the sample code. just google it and you will find a project containing all basics of iphone.
I don't think there is any perfect project that can demonstrate all the qualities of great code. Developers have stylistic preferences and may make mistakes. That said, you should look at a lot of different projects and try to look at the conventions used.
I'd suggest starting on GitHub. Besides for seeing code, you'll see what libraries are out there, which may help further your projects later on. Here's the Objective-C page on GitHub.
(Also, I (GitHub link) think you're wrong about iOS devs not being in favor open source. Yes, there's money to be made, but you can't sell a CSV paring library on the App Store as is.)
Have a look at https://github.com/mozilla/firefox-ios
That is Firefox for iOS, written in Swift.
Cocoacontrols has a wide range of controls written using Objective-C & Swift.
I believe these days, this is one of the most famous website for iOS Developers.
But, before you jump onto this, you have to learn Objective-C & Swift very well, so that you will understand how to use the controls in your app which makes your app smooth.

Resources