The previous section shared the analysis of applications with static tools-well, I'm looking for links iOS reverse engineering-static analysis
First of all, why analyze the application, if you want to get useful information from an iOS app, or if you want to modify some of the app's features, it's important to know the logic and structure of the app first.
Dynamic sharing tools Less, we first analyze a simple, universal tool Cycript
-
Cycript
Reference: http://www.cycript.org/
Http://iphonedevwiki.net/index.php/Cycript
Cycript is a scripting language, everyone says can be regarded as objective-javascript, described is very appropriate. Cycript in Cydia self-contained source Cydia/telesphoreo, after installation, SSH to the iOS device
SSH [email protected]
Drive the application you want to analyze, look at the PID, and here's an example of an auto-starting desktop Springboard.
PS aux | grep springboardmobile 1514 0.7 10.6 577300 54720?? Ss 3:46pm 1:19.28/system/library/coreservices/springboard.app/springboard
After finding the PID (1514), use the Cycript hook to apply
Cycript-p 1514 Cycript-p Springboard
The above two sentences can be put on the application, after the hook you can do whatever you like, first play a window
cy# var alert = [[Uialertview alloc] initwithtitle:@ "ASD" Message:nil delegate:nil cancelbuttontitle:@ "OK" otherbuttontitles:nil];# "<UIAlertView:0x19c200f0; frame = (0 0; 0 0); opaque = NO; Layer = <CALayer:0x19c8e730>> "cy# [Alert show]
As you can see, Cycript will print out any data that is assigned to it. In the screen, this time you will think, how to cut off the screen .... This also baffled me, so we first use the static tool Class-dump export header file, and then search shot, haha, come out
cy# var shot = [Sbscreenshotter sharedinstance]# "<SBScreenShotter:0x19ccda20>" cy# [shot Savescreenshot:yes]
Ctrl+d exit
2.GDB
Cycript powerful, similar to the syntax of OC, very useful, but there is a fatal disadvantage, is not a breakpoint, can not stay in the specific location to see the results, then gdb out, of course, GDB has come out, GDB is a powerful debugging tool, how to use GDB debugging iOS app?
GDB full Name the GNU Project debugger can be down in Cydia (data source http://cydia.radare.org).
-
GDB Hook on the application, the practice is the same as Cycript, you can use the PID, can also be used by the application name
Gdb-p springboardgdb-p 1514
Or you can call GDB first, then use the Attach hook application is the same, uncheck the use of detach
2. Breakpoint Break
b-[springboard menubuttondown:]b * (0xc41e)
b breakpoint can be broken on the function (but not every time can be successful), or can be directly broken in memory address, people will ask me how to know the memory address of the function is how much, this time please see Ida Bar
Due to ASLR, the memory addresses that are generally obtained in IDA are inaccurate because each time the program is run, the memory address will be offset to the offset address using info sh in gdb
gdb$ Info shthe DYLD Shared library State have not yet been initialized. Requested State Statenum Basename Type Address Reason | | Source | | | | | | | |
Your sister, there's nothing!!!!!!. (OK, stop this)
I found the directory file for the springboard application and imported it with the file command
yuchenghaide-ipod:~ root# ps aux | grep springboradroot 1915 0.0 0.1 338564 520 s000 s+ 11:02am 0:00.01 grep springboradyuchenghaide-ipod:~ root# ps aux | grep springboardmobile 1514 0.0 11.3 588168 58320 ?? ss 3:46pm 1:39.55 /system/library/coreservices/ springboard.app/springboardroot 1917 0.0 0.1 338608 512 s000 S+ 11:02AM 0:00.01 grep SpringBoardroot 1877 0.0 0.4 349304 &Nbsp;2124 s000 s 10:18am 0:00.29 cycript -p springboardyuchenghaide-ipod:~ root# cd /system/library/coreservices/springboard.app/ yuchenghaide-ipod:/system/library/coreservices/springboard.app root# gdbgnu gdb 6.3.50.20050815-cvs (fri may 20 08:08:42 utc 2011) Copyright 2004 Free software foundation, inc.gdb is free software, covered by the gnu general public license, and you arewelcome to change it and/or distribute copies of it under certain conditions. type "Show copying" to see the conditions. there is absolutely no warranty for gdb. type "show Warranty " for details. this gdb was configured as "--Host=arm-apple-darwin9 --target= ". Gdb$ file springboardunable to read unknown &NBSP;LOAD&NBSP;COMMAND&NBSP;0X80000028READING&NBSP;SYMBOLS&NBSP;FOR&NBSP;SHARED&NBSP;LIBRARIES&NBSP, .... doneunable to read unknown load command 0x80000028gdb$ attach springboardattaching to program: '/system/library/coreservices/springboard.app/springboard ', process 1514.0x3877aa58 in ?? () error while running hook_stop:invalid type combination in equality test.gdb$ info shThe DYLD shared library state has been Initialized from the executable ' S shared library information. all symbols should be present, but the addresses of some Symbols may move when the program is executed, as dyld may relocate library load addresses if necessary. Requested State Current StateNum Basename Type Address Reason | | Source | | | | | | | | 1 springboard - - exec y y /system/library/coreservices/ springboard.app/springboard (offset 0x0) 2 dyld - - init y y /usr/lib/dyld at 0x2be00000 with prefix "__dyld_" 3 storeservices f - init y ! /system/library/privateframeworks/storeservices.framework/storeservices 4 airtraffic f - init y ! /system/library/privateframeworks/airtraffic.framework/airtraffic 5 iosurface F - init y ! /system/library/privateframeworks/iosurface.framework/iosurface 6 multitouchsupport f - init y ! /system/library/privateframeworks/multitouchsupport.framework/multitouchsupport 7 mobilewifi F - init y ! /System/Library/PrivateFrameworks/MobileWiFi.framework/MobileWiFi 8 libioaccessorymanager.dylib - - init y ! /usr/lib/libioaccessorymanager.dylib 9 IOMobileFramebuffer F - init y ! / System/library/privateframeworks/iomobileframebuffer.framework/iomobileframebuffer 10 coresurface f - init y ! /system/library/ privateframeworks/coresurface.framework/coresurface 11 bluetoothmanager F - init y ! /system/library/privateframeworks/ bluetoothmanager.framework/bluetoothmanager 12 crashreportersupport F - init y ! /system/library/privateframeworks/crashreportersupport.framework/ crashreportersupport 13 eap8021x f - init y ! /system/library/privateframeworks/eap8021x.framework/eap8021x 14 libmis.dylib - - init Y Y /usr/lib/libmis.dylib at 0xa3e000 (offset -0xff5c2000)
Your sister! offset = 0x0, what's going on! Is it really 0? I tried.
gdb$ b-[springboard menubuttondown:]function "-[springboard Menubuttondown:]" not defined.gdb$ b * (0xc41e) Breakpoint 1 A T 0xc41egdb$ info bnum Type Disp Enb Address What1 breakpoint keep y 0x0000c41e <_mh_execute_heade r+46110>gdb$ C
Info B is to print out all breakpoints, delete breakpoint can use D breakpoint number
C means to continue the program, press the home button-the result breakpoint is not broken at all. All right, hold on, I'll come back and share with you when I get to the research! (Have a great God, please tell me what's going on) GDB command you can go to the online free inquiry!
IOS Reverse engineering-Dynamic analysis