0

I want to decompile a .a objective-c iOS library. I search to Google and the site and find a few post. Most useful one was below post:

https://stackoverflow.com/a/2336679/1939409

According to the post, I use below command in my mac os terminal:

otool -tV mylibrary.a

It is working. Actually it prints the codes of .o files in my terminal. Part of the printed text is:

    Archive : mylibrary.a (architecture armv7)
mylibrary.a(LIConnection.o) (architecture armv7):
(__TEXT,__text) section
-[LIConnection initWithURL:]:
00000000        b580    push    {r7, lr}
00000002        466f    mov r7, sp
00000004        b094    sub sp, #0x50
00000006        ab11    add r3, sp, #0x44
00000008    f2400900    movw    r9, "-[LIConnection initWithURL:]"
0000000c    f2c00900    movt    r9, "-[LIConnection initWithURL:]"
00000010        9013    str r0, [sp, #0x4c]
00000012        9112    str r1, [sp, #0x48]
00000014    f8cd9044    str.w   r9, [sp, #0x44]
00000018        4618    mov r0, r3
0000001a        4611    mov r1, r2
0000001c    f7fffff0    bl  _objc_storeStrong
00000020        a813    add r0, sp, #0x4c
00000022        a90f    add r1, sp, #0x3c
00000024    f6447238    movw    r2, :lower16:((20328-44)-4)
00000028    f2c00200    movt    r2, :upper16:((20328-44)-4)
0000002c        447a    add r2, pc
0000002e        6812    ldr r2, [r2]
00000030    f6437368    movw    r3, :lower16:((16292-56)-4)
00000034    f2c00300    movt    r3, :upper16:((16292-56)-4)
00000038        447b    add r3, pc
0000003a    f6432982    movw    r9, :lower16:((15048-66)-4)
0000003e    f2c00900    movt    r9, :upper16:((15048-66)-4)
00000042        44f9    add r9, pc
00000044    f2400c00    movw    r12, "-[LIConnection initWithURL:]"
00000048    f2c00c00    movt    r12, "-[LIConnection initWithURL:]"
0000004c    f8dde04c    ldr.w   lr, [sp, #0x4c]
00000050    f8cdc04c    str.w   r12, [sp, #0x4c]
00000054    f8cde03c    str.w   lr, [sp, #0x3c]
00000058    f8d99000    ldr.w   r9, [r9]
0000005c    f8cd9040    str.w   r9, [sp, #0x40]
00000060        681b    ldr r3, [r3]
00000062        900d    str r0, [sp, #0x34]
00000064        4608    mov r0, r1
00000066        4619    mov r1, r3
00000068        4790    blx r2
0000006a        4601    mov r1, r0
0000006c        9113    str r1, [sp, #0x4c]
0000006e        990d    ldr r1, [sp, #0x34]
00000070        900c    str r0, [sp, #0x30]
00000072        4608    mov r0, r1
00000074        990c    ldr r1, [sp, #0x30]
00000076    f7ffffc3    bl  _objc_storeStrong
0000007a        2000    movs    r0, #0x0
0000007c    f2c00000    movt    r0, "-[LIConnection initWithURL:]"
00000080        9913    ldr r1, [sp, #0x4c]
00000082        4281    cmp r1, r0
00000084        d068    beq 0x158
00000086    f64460d2    movw    r0, :lower16:((20324-142)-4)
0000008a    f2c00000    movt    r0, :upper16:((20324-142)-4)
0000008e        4478    add r0, pc
00000090        6800    ldr r0, [r0]
00000092        4601    mov r1, r0
00000094    f643720c    movw    r2, :lower16:((16300-156)-4)
00000098    f2c00200    movt    r2, :upper16:((16300-156)-4)

Now the question is that, is there any tools for convert above codes (I do not know, what is the language of the code) to a high level .m files with objective-c language?

Community
  • 1
  • 1
Husein Behboudi Rad
  • 5,434
  • 11
  • 57
  • 115

1 Answers1

1

You should have a look at this program: Hopper

Nicolas Buquet
  • 3,880
  • 28
  • 28
  • Thanks @Nicolas, but it seems very complex, isn't there any simpler and free tools for this purpose? – Husein Behboudi Rad May 05 '15 at 07:15
  • 1
    I don't think: it is a very complex task. Here another tool : https://www.hex-rays.com/products/ida/index.shtml that is far more costly and I don't know if it can rebuild a sort of objC program from its disassembly. But a free version exists. – Nicolas Buquet May 05 '15 at 07:23