Patching up decrypted files (removing LCCODESIGNATURE)

——————————————————————————————

Make sure you have got the files thinned (ditto —arch i386) before proceeding.

To remove a code signature you need to do the following steps:

NOTE:

Intel Mach-O binaries start with 0xCEFAEDFE

PPC Mach-O binaries start with 0xFEEDFACE

    • Modify the number of load commands (Starts at offset 0×10/16, 4B size).
  1. If the load commands are e.g. 0x2C subtract 0×1 -> 0x2B.

    • Modify the size of the load commands (Starts at offset 0×14/20, 4B size).
  2. remember for Intel you need to swap the bytes to get the value…

If it reads as FC 17 00 00 it actually is 0x000017FC

  • Subtract 0×10 or 16 from the value. in the case above -> 0x000017EC

  • swap bytes again (for Intel). 0x000017EC is thus EC 17 00 00

    • Modify the 16 Bytes from the load command entry for LCCODESIGNATURE.

Replace them with 16 x 0×00.

This entry starts with 0x1D000000 on Intel and 0x0000001D on PPC.

  • This modifies the load command (8B) and the contents of the load command (8B).

In this case the load command in total should allways be:

Intel: 0x1D00000010000000

PPC: 0x0000001D00000010

    • Remove the actual code signature.

This starts with 0xFADE0CC0 on both Intel and PPC.

Replace the entire code signature with 0×00 bytes.

Leave A Comment, Written on September 5th, 2011 , Reverse Engineering

delete removed files in svn:

svn rm $( svn status | sed -e ‘/^!/!d’ -e ‘s/^!//’ )

Leave A Comment, Written on August 30th, 2011 , Uncategorized

1. NSTimer会增加对象的retainCount,释放前要先invalidate

2. NSString最好用copy来作为实现方式

3. delegate使用assign的实现方式,retain实现方式时容易造成循环引用,内存无法释放

4.NSThread会retain对象,如果NSThread调用的线程还在运行,而对象已经释放,在thread中的函数中如果有调用对象的方法,程序将会crash

5.NSZombieEnabled为YES的时候,程序频繁alloc和release会出现内存无法正常释放的现象,所以在发布程序和真机测试的时候一定要禁用这个选项,只在调试crash的时候才开启

6.UITableView插入和删除的时候,插入的行的数量加上目前的行的数量要等于插入后的数量,或者当前行的数量减去删除的行的数量要等于删除后行的数量,否则程序崩溃

7.当用NSURLRequest发送包含内容的POST请求超时时,超时时间并不由设置的timeout决定,而是2个小时

Leave A Comment, Written on May 6th, 2011 , iOS Development

Always Dreaming is proudly powered by WordPress and the Theme Adventure by Eric Schwarz
Entries (RSS) and Comments (RSS).

Always Dreaming

in the sunshine