While developing a tweak, you may find these tools useful to analyze how iOS and apps work, and to find where to interpose your functionality.
blacktop's ipsw tool is an absolute juggernaut, capable of doing ( __to some extent__ ) what every single tool on this page can do (and more).
It's written in golang and works on macos, and to some extent, linux.
Class/Metadata Dumping tools
iOS Header Dumps
- headers.cynder.me (Has syntax highlighting, version diffing, and logos hook generation (click a line number))
- developer.limneos.net (Has a solid search tool, automatic logify.pl, and dumps for every major ios version from iOS 3 through 14)
- iOS-Runtime-Headers (Hosted on github, with access to the slightly superior github search bar)
ktool is a fully cross-platform tool and library for ObjC class dumping/header generating (among many other things).
Tested on Windows x86/ARM, MacOS x86/M1, Linux x86/ARM, iOS (in both iSH and SSH), and Android.
Things it can do:
- Browse and/or Hexdump Load Commands, Segments, etc via the GUI
- Dump/Browse ObjC headers, classes, .tbds (a la class-dump, tapi, otool, etc.)
- Insert/replace load commands, etc (a la optool, install-name-tool)
- Display a lot of valuable info about MachO binaries, including ones with mangled/corrupted load commands.
- Plenty more
dsdump is a tool (compatible with MacOS and and iOS), notable for being also able to dump Swift metadata.
It's self-described as "An improved nm + objc/swift class-dump".
It also comes with a splendid writeup on ObjC/Swift class-dumping: https://derekselander.github.io/dsdump/
class-dump, class_dump_z, classdump-dyld
From a given executable, class-dump and class_dump_z will generate header files with class interfaces. (class-dump may produce better headers than class-dump-z for recent binaries.) This allows for an analysis of what methods exist in the executable, which can help you guess which ones to hook to get given functionality.
All default (private and public) libraries on iOS are combined into a big cache file to improve performance in
/System/Library/Caches/com.apple.dyld/dyld_shared_cache_armX (see dyld_shared_cache for more details). If you want to class-dump private frameworks, you can either install Xcode and class-dump the frameworks on your Mac using the above tools, or you can use classdump-dyld, which works right on your device (classdump-dyld can also be installed via its package hosted on BigBoss). Remember that the resulting files are not the original headers, so use them with caution.
The following tools can be used to analyze an executable.
Decrypting App Store Applications
flexdecrypt is an app/macho decryption tool, notable for not requiring app launch to decrypt executables.
On a static cache, using DyldExtractor is recommended. It works across all platforms.
See the dyld_shared_cache page on this wiki for a full list of tools and info.
Disassemblers are useful when you need an in-depth analysis of a binary. These programs are designed to aid and facilitate reverse engineering of compiled software.
Although all can "Disassemble", that is, provide assembly code, some can also provide near-perfect C pseudocode from the assembly. This is called decompiling, and IDA, Hopper, and Ghidra all have powerful decompilers bundled with them.
IDA has a massive amount of features and has been in development for over three decades. It's typically regarded as the industry standard for Reverse Engineering. Recent versions include unrivalled dyld_shared_cache tools. These have been documented in the page linked below.
|Subproduct Name||Key Features||Includes Decompiler||Includes Debugger||Approximate price|
|IDA Pro||"Full Version". Capable of disassembling/debugging most binary types, both 32 and 64 bit.||With Purchase||Yes||~$4248 With 1 Decompiler|
|IDA Home||"Lite Version". One processor type per license.||"Cloud Decompiler"||Yes||~$370/year|
|IDA Freeware||even "lite-er' version. x86 and x86_64 only. Presumably good for simulator binaries.||Cloud Decompiler||No||$0|
Hopper is a newer disassembler and decompiler that offers an excellent choice for hobbyists that don't have several thousand to spare.
Some crucial Hopper features:
- Basic dyld_shared_cache handling
- Excellent UI and UX.
- Only local x64 Debugging
- Missing some crucial features for iOS
- Pseudocode cannot be edited, and is often difficult to read.
The standard License is $99.
A free, evaluation copy of the program is offered which limits functionality and showcases a much older version of the program.
Ghidra is a free, very powerful reverse-engineering tool released by the NSA. The pseudocode it generates is on par with IDA, and offers an alternative to Hopper's pseudocode, which can be difficult to work with.
For those who can't afford expensive licenses, Ghidra is more than enough for any developer or engineer.
Binary Ninja is a newer Disassembler with a fleshed-out Python / C++ API capable of static Reverse Engineering.
It is easily extensible with plugins. It currently runs for approximately $299 USD (for the non-commercial version).
jtool is a project by morpheus which provides a powerful command-line utility for static analysis of Mach-O caches, objects, files, and more. Documentation is available on the linked page.
The otool command displays specified parts of object files or libraries. It can also disassemble:
bash$ xcrun -sdk iphoneos otool -arch arm64 -tV FaceCore /Applications/Xcode.app/.../PrivateFrameworks/FaceCore.framework/FaceCore: (__TEXT,__text) section 0000000000001100 stp fp, lr, [sp, #-16]! 0000000000001104 add fp, sp, 0 0000000000001108 stp x20, x19, [sp, #-16]! 000000000000110c sub sp, sp, #16 ...
strings is a simple utility that will print all the strings in a given binary.
bash$ strings crash_mover moveLogsAtPath Could not open and lock %s: %s. Proceeding with copy anyway. Extensions ...
nm is a utility that displays the symbol table of a given binary.
bash$ nm CoreTelephony 000234c4 t +[CTCall callForCTCallRef:] 0001ee90 t +[CTEmailAddress emailAddress:] 000199b8 t +[CTMessageCenter sharedMessageCenter] 0001db54 t +[CTMmsEncoder decodeMessageFromData:] ...
The following tools are useful for analyzing a program during runtime.
GDB / LLDB
When writing software, a debugger can help determine what is causing a crash, to find backtrace information on certain points of a program, and so on. Attaching the debugger to normal processes running on the iPhone can be done with the description on debugserver, and see Debugging on iOS 7 for more context.
objtree is a tool for displaying entire trees of objc method calls within the scope of a function call.
- Trace all ObjC methods within the scope of a method or function (symbolicated or by relative address), `tree`-style
- Stack-depth filters
- All the `frida-trace` goodies: spawn file, attach to pid, remote frida-server, etc.
xpcspy is a tool for intercepting Interprocess Communication.
While not a runtime analysis tool, Logify takes an Objective-C header file containing a class interface and generates a Logos file hooking all methods in the given class, and for each hook logging the call of the method (with parameters) to the syslog. Logify allows for convenient analysis of what methods of a class get called during runtime, and when.
InspectiveC allows you to log message hierarchies of certain objects, classes, and selectors. It is very useful if you're trying to figure out how a certain method or class works without having to go into the assembly. You can temporarily use InspectiveC in your tweak to log objects as needed.
Runtime View Debugging
Reveal is a macOS App designed for UI Debugging. In terms of UX, it appears to replicate the XCode storyboard layout, offering a plethora of layout tools and the ability to edit UI in real-time.
It is worth noting that version 24 and 25 exhibit terrible performance in most use cases. A free trial is offered, and it's advised that you evaluate the product before purchasing, as for some users, it has completely failed to work as advertised. It is a powerful debugging application when it works properly.
On iOS 13, and/or Version 24, a change was made that broke Reveal's ability to load into SpringBoard. You will need to use or copy the below project's fix for this issue below:
Reveal Loader will dynamically load the RevealServer framework into applications the user selects, and will automatically load itself into SpringBoard without requiring user intervention.
When you load an application using Reveal, the application will appear to become unresponsive, as Reveal will "pause" execution in order to "snapshot" the current UI state. This is expected and may take several minutes to complete.
Lookin is an alternative to Reveal that, in addition to being free, performs much better and offers many more features than Reveal. The installation method is identical to Reveal.
FLEX is an in-app debugging and exploration tool for iOS.
FLEXall is an updated version of FLEXing.
FLEXing will help you load (the up-to-date) FLEX into your applications by holding the status bar.