mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-24 13:49:50 +00:00
343 lines
7.3 KiB
Plaintext
343 lines
7.3 KiB
Plaintext
NAME=af localflag
|
|
FILE=../bins/mach0/mac-ls2
|
|
CMDS=<<EOF
|
|
af
|
|
f.foobar=0x100001216
|
|
pd 20~foo
|
|
EOF
|
|
EXPECT=<<EOF
|
|
| ,=< 0x10000120f 7f05 jg .foobar ; main.foobar
|
|
| | .foobar:
|
|
EOF
|
|
RUN
|
|
|
|
NAME=af switch test
|
|
FILE=../bins/mach0/mac-ls2
|
|
EXPECT=<<EOF
|
|
c 0x1000012dc case.0x100001308.1
|
|
c 0x10000130a case.0x100001308.0
|
|
c 0x100001321 case.0x100001308.65
|
|
c 0x10000132a case.0x100001308.71
|
|
c 0x100001347 case.0x100001308.69
|
|
c 0x100001353 case.0x100001308.50
|
|
c 0x100001370 case.0x100001308.53
|
|
c 0x100001392 case.0x100001308.48
|
|
c 0x100001396 case.0x100001308.16
|
|
c 0x1000013a2 case.0x100001308.35
|
|
c 0x1000013b1 case.0x100001308.58
|
|
c 0x1000013bd case.0x100001308.66
|
|
c 0x1000013cc case.0x100001308.27
|
|
c 0x1000013fb case.0x100001308.55
|
|
c 0x10000140a case.0x100001308.31
|
|
c 0x10000141a case.0x100001308.61
|
|
c 0x10000143f case.0x100001308.59
|
|
c 0x10000144b case.0x100001308.54
|
|
c 0x100001473 case.0x100001308.34
|
|
c 0x10000147f case.0x100001308.51
|
|
c 0x100001492 case.0x100001308.62
|
|
c 0x1000014d0 case.0x100001308.30
|
|
c 0x1000014df case.0x100001308.64
|
|
c 0x1000014f0 case.0x100001308.15
|
|
c 0x1000014ff case.0x100001308.18
|
|
c 0x100001519 case.0x100001308.33
|
|
c 0x100001525 case.0x100001308.21
|
|
c 0x10000153e case.0x100001308.17
|
|
c 0x10000155b case.0x100001308.56
|
|
c 0x10000156a case.0x100001308.70
|
|
c 0x100001583 case.0x100001308.36
|
|
c 0x1000015a0 case.0x100001308.38
|
|
c 0x1000015ac case.0x100001308.22
|
|
c 0x1000015c9 case.0x100001308.23
|
|
c 0x1000015f7 case.0x100001308.63
|
|
c 0x10000160d case.0x100001308.49
|
|
c 0x10000162a case.0x100001308.67
|
|
c 0x100001636 case.0x100001308.52
|
|
c 0x100001645 case.0x100001308.60
|
|
c 0x100001665 case.0x100001308.68
|
|
EOF
|
|
CMDS=<<EOF
|
|
af
|
|
axf@0x100001308
|
|
EOF
|
|
RUN
|
|
|
|
NAME=af import
|
|
FILE=../bins/mach0/ls-osx-x86_64
|
|
BROKEN=1
|
|
EXPECT=<<EOF
|
|
before:
|
|
EOF
|
|
CMDS=<<EOF
|
|
s sym.imp.write
|
|
af
|
|
?v $FS
|
|
EOF
|
|
RUN
|
|
|
|
NAME=afll
|
|
FILE=../bins/mach0/ls-osx-x86_64
|
|
EXPECT=<<EOF
|
|
1
|
|
EOF
|
|
CMDS=<<EOF
|
|
aa ; afll~?entry0
|
|
EOF
|
|
RUN
|
|
|
|
NAME=missing bb fix
|
|
FILE=../bins/elf/before-after-main
|
|
CMDS=<<EOF
|
|
e asm.bytes=false
|
|
e asm.comments=false
|
|
s sym.register_tm_clones
|
|
af
|
|
pdf
|
|
EOF
|
|
EXPECT=<<EOF
|
|
/ 53: sym.register_tm_clones ();
|
|
| 0x08048410 mov eax, obj.completed.6891
|
|
| 0x08048415 sub eax, obj.completed.6891
|
|
| 0x0804841a sar eax, 2
|
|
| 0x0804841d mov edx, eax
|
|
| 0x0804841f shr edx, 0x1f
|
|
| 0x08048422 add eax, edx
|
|
| 0x08048424 sar eax, 1
|
|
| ,=< 0x08048426 je 0x8048448
|
|
| | 0x08048428 mov edx, 0
|
|
| | 0x0804842d test edx, edx
|
|
| ,==< 0x0804842f je 0x8048448
|
|
| || 0x08048431 push ebp
|
|
| || 0x08048432 mov ebp, esp
|
|
| || 0x08048434 sub esp, 0x10
|
|
| || 0x08048437 push eax
|
|
| || 0x08048438 push obj.completed.6891
|
|
| || 0x0804843d call edx
|
|
| || 0x0804843f add esp, 0x10
|
|
| || 0x08048442 leave
|
|
| || 0x08048443 ret
|
|
..
|
|
\ ``-> 0x08048448 ret
|
|
EOF
|
|
RUN
|
|
|
|
NAME=afb+
|
|
FILE=../bins/pe/a.exe
|
|
CMDS=<<EOF
|
|
s 0x004017c0
|
|
af+ 0x004017c0 fcn2.0x004017c0
|
|
afb+ 0x4017c0 0x4017c0 13 0x4017dd 0x4017cd
|
|
afi~size
|
|
afb
|
|
?e
|
|
pdf
|
|
?e
|
|
af-
|
|
af+ 0x004017c0 fcn2.0x004017c0
|
|
afb+ 0x4017c0 0x4017c0 6 0x4017dd 0x4017cd
|
|
afi~size
|
|
afb
|
|
?e
|
|
pdf
|
|
?e
|
|
afb+ 0x4017c0 0x4017c0 11 0x4017dd 0x4017cd
|
|
afi~size
|
|
afb
|
|
?e
|
|
pdf
|
|
EOF
|
|
EXPECT=<<EOF
|
|
size: 13
|
|
0x004017c0 0x004017cd 00:0000 13 j 0x004017dd f 0x004017cd
|
|
|
|
/ 13: fcn2.0x004017c0 ();
|
|
| 0x004017c0 51 push ecx
|
|
| 0x004017c1 89e1 mov ecx, esp
|
|
| 0x004017c3 83c108 add ecx, 8
|
|
| 0x004017c6 3d00100000 cmp eax, 0x1000
|
|
\ ,=< 0x004017cb 7210 jb 0x4017dd
|
|
|
|
size: 6
|
|
0x004017c0 0x004017c6 00:0000 6 j 0x004017dd f 0x004017cd
|
|
|
|
/ 6: fcn2.0x004017c0 ();
|
|
| 0x004017c0 51 push ecx
|
|
| 0x004017c1 89e1 mov ecx, esp
|
|
\ 0x004017c3 83c108 add ecx, 8
|
|
|
|
size: 11
|
|
0x004017c0 0x004017cb 00:0000 11 j 0x004017dd f 0x004017cd
|
|
|
|
/ 11: fcn2.0x004017c0 ();
|
|
| 0x004017c0 51 push ecx
|
|
| 0x004017c1 89e1 mov ecx, esp
|
|
| 0x004017c3 83c108 add ecx, 8
|
|
\ 0x004017c6 3d00100000 cmp eax, 0x1000
|
|
EOF
|
|
EXPECT_ERR=<<EOF
|
|
EOF
|
|
RUN
|
|
|
|
NAME=afb+ with wrong size
|
|
FILE=../bins/pe/a.exe
|
|
CMDS=<<EOF
|
|
s 0x004017c0
|
|
af+ 0x004017c0 fcn2.0x004017c0
|
|
afb+ 0x4017c0 0x4017c0 9 0x4017dd 0x4017cd
|
|
afi~size
|
|
afb
|
|
?e
|
|
pdf
|
|
?e
|
|
pdr
|
|
?e
|
|
afb+ 0x4017c0 0x4017c0 12 0x4017dd 0x4017cd
|
|
afi~size
|
|
afb
|
|
?e
|
|
pdf
|
|
?e
|
|
pdr
|
|
EOF
|
|
EXPECT=<<EOF
|
|
size: 9
|
|
0x004017c0 0x004017c9 00:0000 9 j 0x004017dd f 0x004017cd
|
|
|
|
/ 9: fcn2.0x004017c0 ();
|
|
| 0x004017c0 51 push ecx
|
|
| 0x004017c1 89e1 mov ecx, esp
|
|
| 0x004017c3 83c108 add ecx, 8
|
|
..
|
|
|
|
/ 9: fcn2.0x004017c0 ();
|
|
| 0x004017c0 51 push ecx
|
|
| 0x004017c1 89e1 mov ecx, esp
|
|
| 0x004017c3 83c108 add ecx, 8
|
|
| 0x004017c6 3d invalid
|
|
\ 0x004017c7 0010 add byte [eax], dl
|
|
| ----------- true: 0x004017dd false: 0x004017cd
|
|
|
|
size: 12
|
|
0x004017c0 0x004017cc 00:0000 12 j 0x004017dd f 0x004017cd
|
|
|
|
/ 12: fcn2.0x004017c0 ();
|
|
| 0x004017c0 51 push ecx
|
|
| 0x004017c1 89e1 mov ecx, esp
|
|
| 0x004017c3 83c108 add ecx, 8
|
|
| 0x004017c6 3d00100000 cmp eax, 0x1000
|
|
..
|
|
|
|
/ 12: fcn2.0x004017c0 ();
|
|
| 0x004017c0 51 push ecx
|
|
| 0x004017c1 89e1 mov ecx, esp
|
|
| 0x004017c3 83c108 add ecx, 8
|
|
| 0x004017c6 3d00100000 cmp eax, 0x1000
|
|
| 0x004017cb 72 invalid
|
|
| ----------- true: 0x004017dd false: 0x004017cd
|
|
EOF
|
|
RUN
|
|
|
|
NAME=afcf
|
|
FILE=../bins/elf/crackme0x05
|
|
CMDS=<<EOF
|
|
af@main
|
|
afcf main @ 0
|
|
afcf @ main
|
|
afcfj @ main
|
|
EOF
|
|
EXPECT=<<EOF
|
|
int main (int argc, char **argv, char **envp);
|
|
int main (int argc, char **argv, char **envp);
|
|
[{"name":"main","return":"int","args":[{"name":"argc","type":"int"},{"name":"argv","type":"char **"},{"name":"envp","type":"char **"}],"count":3}]
|
|
EOF
|
|
RUN
|
|
|
|
NAME=afcf (vars)
|
|
FILE=../bins/elf/ls
|
|
CMDS=<<EOF
|
|
s 0x00013c70
|
|
af
|
|
afcf
|
|
afcfj
|
|
EOF
|
|
EXPECT=<<EOF
|
|
fcn.00013c70 (int64_t arg1, int64_t arg2, int64_t arg3);
|
|
[{"name":"fcn.00013c70","args":[{"name":"arg1","type":"int64_t"},{"name":"arg2","type":"int64_t"},{"name":"arg3","type":"int64_t"}],"count":3}]
|
|
EOF
|
|
RUN
|
|
|
|
NAME=float args afli
|
|
FILE=../bins/elf/float_point
|
|
BROKEN=1
|
|
CMDS=<<EOF
|
|
aa
|
|
afi sym.sum_float
|
|
EOF
|
|
EXPECT=<<EOF
|
|
#
|
|
offset: 0x00001119
|
|
name: sym.sum_float
|
|
size: 26
|
|
realsz: 26
|
|
stackframe: 8
|
|
call-convention: amd64
|
|
cyclomatic-cost : 11
|
|
cyclomatic-complexity: 1
|
|
bits: 64
|
|
type: sym [NEW]
|
|
num-bbs: 1
|
|
edges: 0
|
|
end-bbs: 1
|
|
call-refs:
|
|
data-refs:
|
|
code-xrefs: 0x00001165 C
|
|
in-degree: 1
|
|
out-degree: 0
|
|
data-xrefs:
|
|
locals: 2
|
|
args: 2
|
|
var int local_8h @ rbp-0x8
|
|
var int local_4h @ rbp-0x4
|
|
arg int arg1 @ xmm0
|
|
arg int arg2 @ xmm1
|
|
diff: type: new
|
|
EOF
|
|
RUN
|
|
|
|
NAME=double args afli
|
|
FILE=../bins/elf/float_point
|
|
BROKEN=1
|
|
CMDS=<<EOF
|
|
aa
|
|
afi sym.sum_double
|
|
EOF
|
|
EXPECT=<<EOF
|
|
#
|
|
offset: 0x00001133
|
|
name: sym.sum_double
|
|
size: 26
|
|
realsz: 26
|
|
stackframe: 8
|
|
call-convention: amd64
|
|
cyclomatic-cost : 11
|
|
cyclomatic-complexity: 1
|
|
bits: 64
|
|
type: sym [NEW]
|
|
num-bbs: 1
|
|
edges: 0
|
|
end-bbs: 1
|
|
call-refs:
|
|
data-refs:
|
|
code-xrefs: 0x00001181 C
|
|
in-degree: 1
|
|
out-degree: 0
|
|
data-xrefs:
|
|
locals: 2
|
|
args: 2
|
|
var int local_10h @ rbp-0x10
|
|
var int local_8h @ rbp-0x8
|
|
arg int arg1 @ xmm0
|
|
arg int arg2 @ xmm1
|
|
diff: type: new
|
|
EOF
|
|
RUN
|