* Added build files [Capstone to Zydis] * x86 Analysis [Capstone to Zydis] * Changed x86 RzIL [Capstone to Zydis] * Changed asm and arch files [Capstone to Zydis] * Compilation, build error and test fixes [Capstone to Zydis] * Test changes [Capstone to Zydis] * Remaining changes [Capstone to Zydis] * Added BE support [Capstone to Zydis] --------- Co-authored-by: tushar3q34 <tushar3q34@gmail.com>
353 lines
11 KiB
Text
353 lines
11 KiB
Text
NAME=objc hello-objc not encrypted
|
|
FILE=bins/mach0/hello-objc
|
|
CMDS=<<EOF
|
|
ic
|
|
icf Person
|
|
icm Person
|
|
icfj Person
|
|
EOF
|
|
EXPECT=<<EOF
|
|
address min max name super
|
|
----------------------------------------------------
|
|
0x100001180 0x100000da0 0x100000e20 Person NSObject
|
|
address index class flags name type
|
|
--------------------------------------------------------------------------
|
|
---------- 0 Person Person::(property)name
|
|
---------- 1 Person isa struct objc_class *
|
|
0x100001178 2 Person Person::(ivar)name *
|
|
address index class flags name
|
|
----------------------------------------
|
|
0x100000da0 0 Person sayHello
|
|
0x100000df0 1 Person name
|
|
0x100000e20 2 Person setName:
|
|
[{"name":"Person::(property)name","class":"Person","addr":18446744073709551615},{"type":"struct objc_class *","name":"isa","class":"Person","addr":18446744073709551615},{"type":"*","name":"Person::(ivar)name","class":"Person","addr":4294971768}]
|
|
EOF
|
|
RUN
|
|
|
|
NAME=objc generics-objc
|
|
FILE=bins/mach0/generics-objc
|
|
CMDS=<<EOF
|
|
ic
|
|
icf MyCustomClass
|
|
icm MyCustomClass
|
|
EOF
|
|
EXPECT=<<EOF
|
|
address min max name super
|
|
-----------------------------------------------------------
|
|
0x100001120 0x100000e70 0x100000e70 MyCustomClass NSObject
|
|
address index class flags name type
|
|
------------------------------------
|
|
address index class flags name
|
|
--------------------------------------------------------------
|
|
0x100000e70 0 MyCustomClass doSomethingWithGeneric:
|
|
EOF
|
|
RUN
|
|
|
|
NAME=objc method flags (ic ViewController)
|
|
FILE=bins/mach0/TestMethods
|
|
CMDS=<<EOF
|
|
icf ViewController
|
|
icm ViewController
|
|
EOF
|
|
EXPECT=<<EOF
|
|
address index class flags name type
|
|
------------------------------------
|
|
address index class flags name
|
|
---------------------------------------------------------------
|
|
0x10000676c 0 ViewController viewDidLoad
|
|
0x1000067bc 1 ViewController c thisIsAClassMethod
|
|
0x1000067d0 2 ViewController didReceiveMemoryWarning
|
|
0x100006820 3 ViewController c andAnotherOne
|
|
EOF
|
|
RUN
|
|
|
|
NAME=objc method flags (icj)
|
|
FILE=bins/mach0/TestMethods
|
|
CMDS=icj~{[0].methods[1].flags[0]}
|
|
EXPECT=<<EOF
|
|
class
|
|
EOF
|
|
RUN
|
|
|
|
NAME=objc method flags (ic*)
|
|
FILE=bins/mach0/TestMethods
|
|
CMDS=ic*~thisIsAClassMethod
|
|
EXPECT=<<EOF
|
|
f method.class.ViewController.thisIsAClassMethod @ 0x1000067bc
|
|
EOF
|
|
RUN
|
|
|
|
NAME=objc categories (mangled)
|
|
FILE=bins/mach0/Alamofire-stripped
|
|
CMDS=<<EOF
|
|
icf 'Alamofire.SessionDelegate(Alamofire)'
|
|
icm 'Alamofire.SessionDelegate(Alamofire)'
|
|
EOF
|
|
EXPECT=<<EOF
|
|
address index class flags name type
|
|
------------------------------------
|
|
address index class flags name
|
|
--------------------------------------------------------------------------------------------------------------
|
|
0x00048e14 0 Alamofire.SessionDelegate(Alamofire) URLSession:didBecomeInvalidWithError:
|
|
0x0004990c 1 Alamofire.SessionDelegate(Alamofire) URLSession:didReceiveChallenge:completionHandler:
|
|
0x000499c8 2 Alamofire.SessionDelegate(Alamofire) URLSessionDidFinishEventsForBackgroundURLSession:
|
|
EOF
|
|
RUN
|
|
|
|
NAME=infinite aalor
|
|
FILE=bins/mach0/r2_hang_test
|
|
CMDS=aalor
|
|
EXPECT=
|
|
RUN
|
|
|
|
NAME=objc categories (swift)
|
|
FILE=bins/mach0/TestSwiftObjc
|
|
CMDS=ic
|
|
EXPECT=<<EOF
|
|
address min max name super
|
|
-----------------------------------------------------------------------------------
|
|
0x100003078 0x100001ad0 0x100001ad0 TestSwiftObjc.ThisIsASwiftClass(TEST)
|
|
0x1000031e8 0x100001d80 0x100001d80 TestSwiftObjc.ThisIsASwiftClass NSObject
|
|
EOF
|
|
RUN
|
|
|
|
NAME=aalor hello-objc selrefs
|
|
FILE=bins/mach0/hello-objc
|
|
CMDS=<<EOF
|
|
e analysis.jmp.cref=true
|
|
aalor
|
|
axl~?
|
|
axl~selref
|
|
EOF
|
|
EXPECT=<<EOF
|
|
92
|
|
section.0.__TEXT.__text+20 0x100000db4 -> DATA -> 0x100001150 section.14.__DATA.__objc_selrefs
|
|
main+15 0x100000e5f -> DATA -> 0x100001158 section.14.__DATA.__objc_selrefs+8
|
|
main+45 0x100000e7d -> DATA -> 0x100001160 section.14.__DATA.__objc_selrefs+16
|
|
main+64 0x100000e90 -> DATA -> 0x100001168 section.14.__DATA.__objc_selrefs+24
|
|
main+86 0x100000ea6 -> DATA -> 0x100001158 section.14.__DATA.__objc_selrefs+8
|
|
main+116 0x100000ec4 -> DATA -> 0x100001160 section.14.__DATA.__objc_selrefs+16
|
|
main+135 0x100000ed7 -> DATA -> 0x100001168 section.14.__DATA.__objc_selrefs+24
|
|
EOF
|
|
RUN
|
|
|
|
NAME=aalor hello-objc methods references
|
|
FILE=bins/mach0/hello-objc
|
|
CMDS=aalor;axl~method
|
|
EXPECT=<<EOF
|
|
section.0.__TEXT.__text+20 0x100000db4 -> CODE -> 0x100000df0 method.Person.name
|
|
main+45 0x100000e7d -> CODE -> 0x100000e20 method.Person.setName:
|
|
main+116 0x100000ec4 -> CODE -> 0x100000e20 method.Person.setName:
|
|
EOF
|
|
RUN
|
|
|
|
NAME=objc_stubs arm64e
|
|
FILE=bins/mach0/hello-macos-arm64e-objc-stubs-stripped
|
|
CMDS=<<EOF
|
|
aalos
|
|
fl@F:objc-stubs
|
|
fl@F:objc-stubs@e:asm.flags.real=1
|
|
EOF
|
|
EXPECT=<<EOF
|
|
0x100003d80 32 stub.objc_msgSend_methodWithOneArg:
|
|
0x100003da0 32 stub.objc_msgSend_methodWithReturn
|
|
0x100003dc0 32 stub.objc_msgSend_methodWithTwoArgs:secondArg:
|
|
0x100003de0 32 stub.objc_msgSend_methodWithoutArgs
|
|
0x100003d80 32 objc_msgSend$methodWithOneArg:
|
|
0x100003da0 32 objc_msgSend$methodWithReturn
|
|
0x100003dc0 32 objc_msgSend$methodWithTwoArgs:secondArg:
|
|
0x100003de0 32 objc_msgSend$methodWithoutArgs
|
|
EOF
|
|
RUN
|
|
|
|
NAME=objc_stubs arm64
|
|
FILE=bins/mach0/hello-macos-arm64-objc-stubs-stripped
|
|
CMDS=<<EOF
|
|
aalos
|
|
fl@F:objc-stubs
|
|
fl@F:objc-stubs@e:asm.flags.real=1
|
|
EOF
|
|
EXPECT=<<EOF
|
|
0x100003d80 32 stub.objc_msgSend_methodWithOneArg:
|
|
0x100003da0 32 stub.objc_msgSend_methodWithReturn
|
|
0x100003dc0 32 stub.objc_msgSend_methodWithTwoArgs:secondArg:
|
|
0x100003de0 32 stub.objc_msgSend_methodWithoutArgs
|
|
0x100003d80 32 objc_msgSend$methodWithOneArg:
|
|
0x100003da0 32 objc_msgSend$methodWithReturn
|
|
0x100003dc0 32 objc_msgSend$methodWithTwoArgs:secondArg:
|
|
0x100003de0 32 objc_msgSend$methodWithoutArgs
|
|
EOF
|
|
RUN
|
|
|
|
NAME=objc_stubs arm64 small
|
|
FILE=bins/mach0/hello-macos-arm64-objc-stubs-small-stripped
|
|
CMDS=<<EOF
|
|
aalos
|
|
fl@F:objc-stubs
|
|
fl@F:objc-stubs@e:asm.flags.real=1
|
|
EOF
|
|
EXPECT=<<EOF
|
|
0x100003dd8 12 stub.objc_msgSend_methodWithOneArg:
|
|
0x100003de4 12 stub.objc_msgSend_methodWithReturn
|
|
0x100003df0 12 stub.objc_msgSend_methodWithTwoArgs:secondArg:
|
|
0x100003dfc 12 stub.objc_msgSend_methodWithoutArgs
|
|
0x100003dd8 12 objc_msgSend$methodWithOneArg:
|
|
0x100003de4 12 objc_msgSend$methodWithReturn
|
|
0x100003df0 12 objc_msgSend$methodWithTwoArgs:secondArg:
|
|
0x100003dfc 12 objc_msgSend$methodWithoutArgs
|
|
EOF
|
|
RUN
|
|
|
|
NAME=objc_stubs arm64_32
|
|
FILE=bins/mach0/hello-watchos-arm64_32-objc-stubs-stripped
|
|
CMDS=<<EOF
|
|
aalos
|
|
fl@F:objc-stubs
|
|
fl@F:objc-stubs@e:asm.flags.real=1
|
|
EOF
|
|
EXPECT=<<EOF
|
|
0x0000bd80 32 stub.objc_msgSend_methodWithOneArg:
|
|
0x0000bda0 32 stub.objc_msgSend_methodWithReturn
|
|
0x0000bdc0 32 stub.objc_msgSend_methodWithTwoArgs:secondArg:
|
|
0x0000bde0 32 stub.objc_msgSend_methodWithoutArgs
|
|
0x0000bd80 32 objc_msgSend$methodWithOneArg:
|
|
0x0000bda0 32 objc_msgSend$methodWithReturn
|
|
0x0000bdc0 32 objc_msgSend$methodWithTwoArgs:secondArg:
|
|
0x0000bde0 32 objc_msgSend$methodWithoutArgs
|
|
EOF
|
|
RUN
|
|
|
|
NAME=objc_stubs arm64_32 small
|
|
FILE=bins/mach0/hello-watchos-arm64_32-objc-stubs-small-stripped
|
|
CMDS=<<EOF
|
|
aalos
|
|
fl@F:objc-stubs
|
|
fl@F:objc-stubs@e:asm.flags.real=1
|
|
EOF
|
|
EXPECT=<<EOF
|
|
0x0000bde8 12 stub.objc_msgSend_methodWithOneArg:
|
|
0x0000bdf4 12 stub.objc_msgSend_methodWithReturn
|
|
0x0000be00 12 stub.objc_msgSend_methodWithTwoArgs:secondArg:
|
|
0x0000be0c 12 stub.objc_msgSend_methodWithoutArgs
|
|
0x0000bde8 12 objc_msgSend$methodWithOneArg:
|
|
0x0000bdf4 12 objc_msgSend$methodWithReturn
|
|
0x0000be00 12 objc_msgSend$methodWithTwoArgs:secondArg:
|
|
0x0000be0c 12 objc_msgSend$methodWithoutArgs
|
|
EOF
|
|
RUN
|
|
|
|
NAME=objc_stubs x86_64
|
|
FILE=bins/mach0/hello-macos-x86_64-objc-stubs-stripped
|
|
CMDS=<<EOF
|
|
aalos
|
|
fl@F:objc-stubs
|
|
fl@F:objc-stubs@e:asm.flags.real=1
|
|
EOF
|
|
EXPECT=<<EOF
|
|
0x100003e50 13 stub.objc_msgSend_methodWithOneArg:
|
|
0x100003e5d 13 stub.objc_msgSend_methodWithReturn
|
|
0x100003e6a 13 stub.objc_msgSend_methodWithTwoArgs:secondArg:
|
|
0x100003e77 13 stub.objc_msgSend_methodWithoutArgs
|
|
0x100003e50 13 objc_msgSend$methodWithOneArg:
|
|
0x100003e5d 13 objc_msgSend$methodWithReturn
|
|
0x100003e6a 13 objc_msgSend$methodWithTwoArgs:secondArg:
|
|
0x100003e77 13 objc_msgSend$methodWithoutArgs
|
|
EOF
|
|
RUN
|
|
|
|
NAME=objc_stubs do not create if there are syms
|
|
FILE=bins/mach0/hello-macos-arm64e-objc-stubs
|
|
CMDS=<<EOF
|
|
aalos
|
|
fl@F:objc-stubs
|
|
echo --
|
|
fl@F:symbols~objc_msgSend
|
|
EOF
|
|
EXPECT=<<EOF
|
|
--
|
|
0x100003d80 0 sym._objc_msgSend_methodWithOneArg:
|
|
0x100003da0 0 sym._objc_msgSend_methodWithReturn
|
|
0x100003dc0 0 sym._objc_msgSend_methodWithTwoArgs:secondArg:
|
|
0x100003de0 0 sym._objc_msgSend_methodWithoutArgs
|
|
EOF
|
|
RUN
|
|
|
|
NAME=objc_stubs integrated in aaa
|
|
FILE=bins/mach0/hello-macos-arm64-objc-stubs-stripped
|
|
CMDS=<<EOF
|
|
aaa
|
|
pif @ main
|
|
afl~msgSend
|
|
echo -- clean function rename
|
|
s 0x100003da0
|
|
pdf
|
|
EOF
|
|
EXPECT=<<EOF
|
|
sub sp, sp, 0x60
|
|
stp fp, lr, [var_10h]
|
|
add fp, sp, 0x50
|
|
adrp x8, section.13.__DATA.__objc_const
|
|
add x8, x8, 0x150
|
|
str x8, [var_50h]
|
|
stur w0, [var_14h]
|
|
stur x1, [var_20h]
|
|
bl sym.imp.objc_autoreleasePoolPush
|
|
ldr x8, [var_50h]
|
|
str x0, [var_40h]
|
|
adrp x9, section.13.__DATA.__objc_const
|
|
add x9, x9, 0x148
|
|
stur x9, [var_28h]
|
|
ldr x8, [x8, 8]
|
|
ldur x0, [var_28h]
|
|
blr x8
|
|
stur w0, [var_2ch]
|
|
adrp x0, reloc.NSLog
|
|
add x0, x0, 0xa8
|
|
bl sym.imp.NSLog
|
|
adrp x8, section.13.__DATA.__objc_const
|
|
ldr x0, [x8, 0xe8]
|
|
bl sym.imp.objc_alloc_init
|
|
ldr x1, [var_48h]
|
|
str x0, [var_38h]
|
|
ldr x0, [var_38h]
|
|
bl stub.objc_msgSend_methodWithoutArgs
|
|
ldr x1, [var_48h]
|
|
ldr x0, [var_38h]
|
|
mov w2, 0x7b
|
|
bl stub.objc_msgSend_methodWithOneArg:
|
|
ldr x1, [var_48h]
|
|
ldr x0, [var_38h]
|
|
ldur w3, [var_2ch]
|
|
mov w2, 0x539
|
|
bl stub.objc_msgSend_methodWithTwoArgs:secondArg:
|
|
ldr x1, [var_48h]
|
|
ldr x0, [var_38h]
|
|
bl stub.objc_msgSend_methodWithReturn
|
|
stur w0, [var_2ch]
|
|
ldur w9, [var_2ch]
|
|
mov x8, x9
|
|
mov x9, sp
|
|
str x8, [x9]
|
|
adrp x0, reloc.NSLog
|
|
add x0, x0, 0xc8
|
|
bl sym.imp.NSLog
|
|
ldr x0, [var_40h]
|
|
bl sym.imp.objc_autoreleasePoolPop
|
|
mov w0, 0
|
|
ldp fp, lr, [var_10h]
|
|
add sp, sp, 0x60
|
|
ret
|
|
0x100003d80 1 20 stub.objc_msgSend_methodWithOneArg:
|
|
0x100003da0 1 20 stub.objc_msgSend_methodWithReturn
|
|
0x100003dc0 1 20 stub.objc_msgSend_methodWithTwoArgs:secondArg:
|
|
0x100003de0 1 20 stub.objc_msgSend_methodWithoutArgs
|
|
-- clean function rename
|
|
; CALL XREF from entry0 @ 0x100003d14
|
|
/ stub.objc_msgSend_methodWithReturn();
|
|
| 0x100003da0 adrp x1, section.13.__DATA.__objc_const ; 0x100008000
|
|
| 0x100003da4 ldr x1, [x1, 0xc8] ; [0x100003f3c:4]=0x6874656d ; "methodWithReturn"
|
|
| 0x100003da8 adrp x16, reloc.NSLog ; 0x100004000
|
|
| 0x100003dac ldr x16, [x16, 0x20] ; [0x100004020:4]=0x10028 ; u"(\U00000001\U00000001"
|
|
\ 0x100003db0 br x16
|
|
EOF
|
|
RUN
|