Convert '..' tests to <<EOF

This commit is contained in:
Khairul Kasmiran 2020-02-09 12:12:49 +08:00 committed by radare
parent 38252427fc
commit 2bb96ad4b9
21 changed files with 216 additions and 139 deletions

View File

@ -1,7 +1,8 @@
NAME=java prototypes in json
FILE=../bins/java/jdwpexeccmd.class
EXPECT='{"access_flags":33,"is_public":1,"is_final":0,"is_super":1,"is_interface":0,"is_abstract":0,"is_synthetic":0,"is_annotation":0,"is_enum":0,"name":"JDWPExecCmd","super":"java/lang/Object","interfaces":[],"methods":[],"fields":[],"imports":[]}
'
EXPECT=<<EOF
{"access_flags":33,"is_public":1,"is_final":0,"is_super":1,"is_interface":0,"is_abstract":0,"is_synthetic":0,"is_annotation":0,"is_enum":0,"name":"JDWPExecCmd","super":"java/lang/Object","interfaces":[],"methods":[],"fields":[],"imports":[]}
EOF
CMDS=<<EOF
java prototypes j
EOF

View File

@ -1,7 +1,8 @@
NAME=arj x86 16 bits
FILE=malloc://0x100
EXPECT='{"ip":0,"ax":0,"bx":0,"cx":0,"dx":0,"sp":0,"bp":0,"si":0,"di":0,"flags":0}
'
EXPECT=<<EOF
{"ip":0,"ax":0,"bx":0,"cx":0,"dx":0,"sp":0,"bp":0,"si":0,"di":0,"flags":0}
EOF
CMDS=<<EOF
e asm.arch = x86
e anal.arch = x86

View File

@ -2850,8 +2850,9 @@ RUN
NAME=arj x86 32 bits
FILE=malloc://0x100
EXPECT='{"oeax":0,"eax":0,"ebx":0,"ecx":0,"edx":0,"esi":0,"edi":0,"esp":0,"ebp":0,"eip":0,"eflags":0}
'
EXPECT=<<EOF
{"oeax":0,"eax":0,"ebx":0,"ecx":0,"edx":0,"esi":0,"edi":0,"esp":0,"ebp":0,"eip":0,"eflags":0}
EOF
CMDS=<<EOF
e asm.arch = x86
e anal.arch = x86
@ -3094,7 +3095,8 @@ RUN
NAME=aoj 31c0
FILE=-
EXPECT='[
EXPECT=<<EOF
[
{
"opcode": "xor eax, eax",
"disasm": "xor eax, eax",
@ -3136,7 +3138,7 @@ EXPECT='[
"family": "cpu"
}
]
'
EOF
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32

View File

@ -648,7 +648,8 @@ RUN
NAME=sym is not fcn
FILE=../bins/mach0/mach0-i386
EXPECT=''
EXPECT=<<EOF
EOF
CMDS=<<EOF
aa > /dev/null
afl~sym.__mh_execute_header[0]
@ -751,7 +752,8 @@ RUN
NAME=iS. and iSj. implementation
FILE=../bins/elf/lab1B
EXPECT='Current section
EXPECT=<<EOF
Current section
nth paddr size vaddr vsize perm name
------------------------------------------------
@ -762,7 +764,8 @@ Current section
nth paddr size vaddr vsize perm name
--------------------------------------
{"name":".plt","size":240,"vsize":240,"perm":"-r-x","paddr":1888,"vaddr":134514528}'
{"name":".plt","size":240,"vsize":240,"perm":"-r-x","paddr":1888,"vaddr":134514528}
EOF
CMDS=<<EOF
s 0x188
iS.
@ -775,11 +778,13 @@ RUN
NAME=iE and iE. implementation
FILE=../bins/elf/lab1B
EXPECT='
EXPECT=<<EOF
nth paddr vaddr bind type size lib name
----------------------------------------------------
22 0x000009b7 0x080489b7 GLOBAL FUNC 189 decrypt
{"name":"prog_timeout","flagname":"sym.prog_timeout","realname":"prog_timeout","ordinal":35,"bind":"GLOBAL","size":17,"type":"FUNC","vaddr":134515110,"paddr":2470,"is_imported":false}'
{"name":"prog_timeout","flagname":"sym.prog_timeout","realname":"prog_timeout","ordinal":35,"bind":"GLOBAL","size":17,"type":"FUNC","vaddr":134515110,"paddr":2470,"is_imported":false}
EOF
CMDS=<<EOF
s 0x080489b9
iE.
@ -2277,7 +2282,8 @@ CMDS=<<EOF
aaa
f~strlen~390
EOF
EXPECT=''
EXPECT=<<EOF
EOF
RUN
NAME=no function split without overlapping blocks

View File

@ -238,11 +238,12 @@ RUN
NAME=afcf
FILE=../bins/elf/crackme0x05
CMDS='af@main
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);
@ -252,11 +253,12 @@ RUN
NAME=afcf (vars)
FILE=../bins/elf/ls
CMDS='s 0x00013c70
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}]

View File

@ -246,8 +246,9 @@ RUN
NAME=fj
FILE=malloc://1024
EXPECT='[{"name":"bloh","size":3,"offset":2},{"name":"blah","size":10,"offset":11}]
'
EXPECT=<<EOF
[{"name":"bloh","size":3,"offset":2},{"name":"blah","size":10,"offset":11}]
EOF
CMDS=<<EOF
f blah 0x0000000a @ 0x0000000b
f bloh 0x00000003 @ 0x00000002
@ -439,8 +440,9 @@ RUN
NAME=flags (JSON)
FILE=-
EXPECT='[{"name":"cat","size":1,"offset":0},{"name":"rimmer","size":12,"offset":0},{"name":"skutter","size":1,"offset":12},{"name":"lister","size":32,"offset":666},{"name":"kryten","size":32,"offset":666}]
'
EXPECT=<<EOF
[{"name":"cat","size":1,"offset":0},{"name":"rimmer","size":12,"offset":0},{"name":"skutter","size":1,"offset":12},{"name":"lister","size":32,"offset":666},{"name":"kryten","size":32,"offset":666}]
EOF
CMDS=<<EOF
# Add flags.
f cat

View File

@ -228,8 +228,9 @@ RUN
NAME=pcj hello-linux-x86_64
FILE=../bins/elf/analysis/hello-linux-x86_64
EXPECT='[49,237,73,137,209,94,72,137,226,72,131,228,240,80,84,73,199,192,176,5,64,0,72,199,193,32,5,64,0,72,199,199,252,4,64,0,232,183,255,255,255,244,102,144,15,31,64,0,184,23,9,96,0,85,72,45,16,9,96,0,72,131,248,14,72,137,229,119,2,93,195,184,0,0,0,0,72,133,192,116,244,93,191,16,9,96,0,255,224,15,31,128,0,0,0,0,184,16,9,96,0,85,72,45,16,9,96,0,72,193,248,3,72,137,229,72,137,194,72,193,234,63,72,1,208,72,137,198,72,209,254,117,2,93,195,186,0,0,0,0,72,133,210,116,244,93,191,16,9,96,0,255,226,15,31,128,0,0,0,0,128,61,89,4,32,0,0,117,17,85,72,137,229,232,126,255,255,255,93,198,5,70,4,32,0,1,243,195,15,31,64,0,72,131,61,24,2,32,0,0,116,27,184,0,0,0,0,72,133,192,116,17,85,191,240,6,96,0,72,137,229,255,208,93,233,123,255,255,255,233,118,255,255,255,102,144,85,72,137,229,191,196,5,64,0,232,214,254,255,255,184,0,0,0,0,93]
'
EXPECT=<<EOF
[49,237,73,137,209,94,72,137,226,72,131,228,240,80,84,73,199,192,176,5,64,0,72,199,193,32,5,64,0,72,199,199,252,4,64,0,232,183,255,255,255,244,102,144,15,31,64,0,184,23,9,96,0,85,72,45,16,9,96,0,72,131,248,14,72,137,229,119,2,93,195,184,0,0,0,0,72,133,192,116,244,93,191,16,9,96,0,255,224,15,31,128,0,0,0,0,184,16,9,96,0,85,72,45,16,9,96,0,72,193,248,3,72,137,229,72,137,194,72,193,234,63,72,1,208,72,137,198,72,209,254,117,2,93,195,186,0,0,0,0,72,133,210,116,244,93,191,16,9,96,0,255,226,15,31,128,0,0,0,0,128,61,89,4,32,0,0,117,17,85,72,137,229,232,126,255,255,255,93,198,5,70,4,32,0,1,243,195,15,31,64,0,72,131,61,24,2,32,0,0,116,27,184,0,0,0,0,72,133,192,116,17,85,191,240,6,96,0,72,137,229,255,208,93,233,123,255,255,255,233,118,255,255,255,102,144,85,72,137,229,191,196,5,64,0,232,214,254,255,255,184,0,0,0,0,93]
EOF
CMDS=<<EOF
pcj
EOF

View File

@ -449,9 +449,10 @@ RUN
NAME=pdj 3 @ main
FILE=../bins/elf/analysis/main
EXPECT='[{"offset":4195590,"esil":"rbp,8,rsp,-,=[8],8,rsp,-=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":1,"opcode":"push rbp","disasm":"push rbp","bytes":"55","family":"cpu","type":"rpush","reloc":false,"type_num":268435468,"type2_num":0,"flags":["main","sym.main"]},{"offset":4195591,"esil":"rsp,rbp,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":3,"opcode":"mov rbp, rsp","disasm":"mov rbp, rsp","bytes":"4889e5","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":4195594,"ptr":4195780,"val":4195780,"esil":"4195780,rdi,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":5,"opcode":"mov edi, 0x4005c4","disasm":"mov edi, str.Hello_World","bytes":"bfc4054000","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0}]
EXPECT=<<EOF
[{"offset":4195590,"esil":"rbp,8,rsp,-,=[8],8,rsp,-=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":1,"opcode":"push rbp","disasm":"push rbp","bytes":"55","family":"cpu","type":"rpush","reloc":false,"type_num":268435468,"type2_num":0,"flags":["main","sym.main"]},{"offset":4195591,"esil":"rsp,rbp,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":3,"opcode":"mov rbp, rsp","disasm":"mov rbp, rsp","bytes":"4889e5","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":4195594,"ptr":4195780,"val":4195780,"esil":"4195780,rdi,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":5,"opcode":"mov edi, 0x4005c4","disasm":"mov edi, str.Hello_World","bytes":"bfc4054000","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0}]
'
EOF
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
@ -461,9 +462,10 @@ RUN
NAME=pdj -3 @ 0x0040050f
FILE=../bins/elf/analysis/main
EXPECT='[{"offset":4195590,"esil":"rbp,8,rsp,-,=[8],8,rsp,-=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":1,"opcode":"push rbp","disasm":"push rbp","bytes":"55","family":"cpu","type":"rpush","reloc":false,"type_num":268435468,"type2_num":0,"flags":["main","sym.main"]},{"offset":4195591,"esil":"rsp,rbp,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":3,"opcode":"mov rbp, rsp","disasm":"mov rbp, rsp","bytes":"4889e5","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":4195594,"ptr":4195780,"val":4195780,"esil":"4195780,rdi,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":5,"opcode":"mov edi, 0x4005c4","disasm":"mov edi, str.Hello_World","bytes":"bfc4054000","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0}]
EXPECT=<<EOF
[{"offset":4195590,"esil":"rbp,8,rsp,-,=[8],8,rsp,-=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":1,"opcode":"push rbp","disasm":"push rbp","bytes":"55","family":"cpu","type":"rpush","reloc":false,"type_num":268435468,"type2_num":0,"flags":["main","sym.main"]},{"offset":4195591,"esil":"rsp,rbp,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":3,"opcode":"mov rbp, rsp","disasm":"mov rbp, rsp","bytes":"4889e5","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":4195594,"ptr":4195780,"val":4195780,"esil":"4195780,rdi,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":5,"opcode":"mov edi, 0x4005c4","disasm":"mov edi, str.Hello_World","bytes":"bfc4054000","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0}]
'
EOF
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
@ -473,9 +475,10 @@ RUN
NAME=pdj str in opcode
FILE=../bins/java/Hello.class
EXPECT='[{"offset":686,"esil":"","refptr":false,"fcn_addr":0,"fcn_last":0,"size":2,"opcode":"ldc \"World\"","disasm":"ldc \"World\"","bytes":"120b","family":"cpu","type":"push","reloc":false,"type_num":13,"type2_num":2138640}]
EXPECT=<<EOF
[{"offset":686,"esil":"","refptr":false,"fcn_addr":0,"fcn_last":0,"size":2,"opcode":"ldc \"World\"","disasm":"ldc \"World\"","bytes":"120b","family":"cpu","type":"push","reloc":false,"type_num":13,"type2_num":2138640}]
'
EOF
CMDS=<<EOF
pdj 1 @ 0x000002ae
EOF
@ -1239,8 +1242,9 @@ RUN
NAME=pdJ 2
FILE=malloc://128
EXPECT='[{"offset":0,"text":" 0x00000000 90 nop"},{"offset":1,"text":" 0x00000001 90 nop"}]
'
EXPECT=<<EOF
[{"offset":0,"text":" 0x00000000 90 nop"},{"offset":1,"text":" 0x00000001 90 nop"}]
EOF
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
@ -1252,10 +1256,11 @@ RUN
NAME=pdJ comments
FILE=malloc://128
EXPECT='[{"offset":0,"text":" 0x00000000 90 nop ; test"}]
EXPECT=<<EOF
[{"offset":0,"text":" 0x00000000 90 nop ; test"}]
[{"offset":0,"text":" 0x00000000 90 nop ; test \"with quotes\""}]
[{"offset":0,"text":" ; test \"with quotes\"\n"},{"offset":0,"text":" 0x00000000 90 nop"}]
'
EOF
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
@ -1272,8 +1277,9 @@ RUN
NAME=pdJ string comment
FILE=../bins/elf/analysis/main
EXPECT='[{"offset":4195594,"text":"| 0x0040050a bfc4054000 mov edi, str.Hello_World ; 0x4005c4 ; \"Hello World\""}]
'
EXPECT=<<EOF
[{"offset":4195594,"text":"| 0x0040050a bfc4054000 mov edi, str.Hello_World ; 0x4005c4 ; \"Hello World\""}]
EOF
CMDS=<<EOF
aa
pdJ 1 @ 0x0040050a
@ -1282,9 +1288,10 @@ RUN
NAME=pdJ flags
FILE=../bins/elf/analysis/main
EXPECT='[{"offset":4195590,"text":" ;-- main:"},{"offset":4195590,"text":" 0x00400506 55 push rbp"}]
EXPECT=<<EOF
[{"offset":4195590,"text":" ;-- main:"},{"offset":4195590,"text":" 0x00400506 55 push rbp"}]
[{"offset":4195590,"text":" ; DATA XREF from entry0 @ 0x40042d"},{"offset":4195590,"text":"/ 16: int main (int argc, char **argv, char **envp);"},{"offset":4195590,"text":"| 0x00400506 55 push rbp"}]
'
EOF
CMDS=<<EOF
s main
pdJ 1 @ 0x00400506
@ -1295,8 +1302,9 @@ RUN
NAME=pdJ midflags reloc
FILE=malloc://8
EXPECT='[{"offset":0,"text":"(reloc.test)"},{"offset":0,"text":" 0x00000000 0000 add byte [rax], al"}]
'
EXPECT=<<EOF
[{"offset":0,"text":"(reloc.test)"},{"offset":0,"text":" 0x00000000 0000 add byte [rax], al"}]
EOF
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
@ -1307,8 +1315,9 @@ RUN
NAME=pdJ string
FILE=malloc://128
EXPECT='[{"offset":0,"text":" 0x00000000 .string \"Snoo\\\"ping as\\\" usual,\" ; len=30"}]
'
EXPECT=<<EOF
[{"offset":0,"text":" 0x00000000 .string \"Snoo\\\"ping as\\\" usual,\" ; len=30"}]
EOF
CMDS=<<EOF
w Snoo"ping as" usual,
\I see...
@ -1319,8 +1328,9 @@ RUN
NAME=pdJ str in opcode
FILE=../bins/java/Hello.class
EXPECT='[{"offset":686,"text":" 0x000002ae 120b ldc \"World\""}]
'
EXPECT=<<EOF
[{"offset":686,"text":" 0x000002ae 120b ldc \"World\""}]
EOF
CMDS=<<EOF
pdJ 1 @ 0x000002ae
EOF
@ -1328,24 +1338,28 @@ RUN
NAME=pdJ asm.cmt.right=0 + html
FILE=../bins/elf/crackme0x05
CMDS='aaa
CMDS=<<EOF
aaa
e asm.cmt.right=0
e scr.colors=1
e scr.html=1
e str.escbslash=1
pdJ 1 @ 0x08048532
'
EXPECT='[{"offset":134513970,"text":"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;[0x8048679:4]=0x73736150"},{"offset":134513970,"text":"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;\"Password&nbsp;Incorrect!\\n\""},{"offset":134513970,"text":"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x08048532&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c70424798604.&nbsp;&nbsp;mov&nbsp;dword&nbsp;[esp],&nbsp;str.Password_Incorrect"}]
'
EOF
EXPECT=<<EOF
[{"offset":134513970,"text":"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;[0x8048679:4]=0x73736150"},{"offset":134513970,"text":"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;\"Password&nbsp;Incorrect!\\n\""},{"offset":134513970,"text":"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x08048532&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c70424798604.&nbsp;&nbsp;mov&nbsp;dword&nbsp;[esp],&nbsp;str.Password_Incorrect"}]
EOF
RUN
NAME=pdJ asm.cmt.right=0 fcn name
FILE=../bins/elf/crackme0x05
EXPECT='[{"offset":134514169,"arrow":134514133,"text":"| `=< 0x080485f9 72da if (((unsigned) var) < 0) goto 0x80485d5"}]
EXPECT=<<EOF
[{"offset":134514169,"arrow":134514133,"text":"| `=< 0x080485f9 72da if (((unsigned) var) < 0) goto 0x80485d5"}]
[{"offset":134513644,"text":" ; sym.imp.__libc_start_main"},{"offset":134513644,"text":" ; int __libc_start_main(func main, int argc, char **ubp_av, func init, func fini, func rtld_fini, void *stack_end)"},{"offset":134513644,"text":" 0x080483ec e873ffffff 134513508,eip,4,esp,-=,esp,=[],eip,="}]
[{"offset":134513644,"text":" 0x080483ec e873ffffff 134513508,eip,4,esp,-=,esp,=[],eip,= ; sym.imp.__libc_start_main ; int __libc_start_main(func main, int argc, char **ubp_av, func init, func fini, func rtld_fini, void *stack_end)"}]
'
CMDS='af@sym.imp.__libc_start_main
EOF
CMDS=<<EOF
af@sym.imp.__libc_start_main
af@0x080485a0
e asm.pseudo=1
e asm.cmt.right=0
@ -1354,7 +1368,7 @@ e asm.esil=1
pdJ 1 @ 0x080483ec
e asm.cmt.right=1
pdJ 1 @ 0x080483ec
'
EOF
RUN
NAME=pdJ asm.emu=1 comment
@ -1376,7 +1390,8 @@ EXPECT=<<EOF
0x080484aa b8e1850408 mov eax, 0x80485e1 ; eax=0x80485e1 "%ls"
[{"offset":134513834,"text":" \u001b[32m0x080484aa\u001b[0m \u001b[37mb8\u001b[37me1\u001b[37m85\u001b[37m04\u001b[37m08\u001b[0m \u001b[37mmov\u001b[36m eax\u001b[0m,\u001b[36m\u001b[36m \u001b[33m0x80485e1\u001b[0m\u001b[0m\u001b[0m\u001b[31m ; eax=0x80485e1 \u001b[7m\"%ls\"\u001b[27m\u001b[0m"}]
EOF
CMDS='s 0x080484aa
CMDS=<<EOF
s 0x080484aa
e asm.emu=1
e scr.color=0
pd 1
@ -1384,15 +1399,17 @@ pdJ 1
e scr.color=1
pd 1
pdJ 1
'
EOF
RUN
NAME=pdJ asm.xrefs.fold asm.xrefs.max
FILE=-
EXPECT='[{"offset":0,"text":" ; XREFS: CODE 0x00000001 "},{"offset":0,"text":" 0x00000000 0000 add byte [rax], al"}]
EXPECT=<<EOF
[{"offset":0,"text":" ; XREFS: CODE 0x00000001 "},{"offset":0,"text":" 0x00000000 0000 add byte [rax], al"}]
[{"offset":0,"text":" ; XREFS(1)"},{"offset":0,"text":" 0x00000000 0000 add byte [rax], al"}]
'
CMDS='s 0
EOF
CMDS=<<EOF
s 0
e asm.arch=x86
e asm.bits=64
axc 0 1
@ -1402,15 +1419,17 @@ pdJ 1
e asm.xrefs.fold=5
e asm.xrefs.max=0
pdJ 1
'
EOF
RUN
NAME=pdJ escape flagname
FILE=../bins/elf/crackme
EXPECT='[{"offset":4196399,"text":" ;-- str.Password_Correct:"},{"offset":4196399,"text":" 0x0040082f .string \"Password Correct!\" ; len=18"}]
'
CMDS='pdJ 1 @ 0x0040082f
'
EXPECT=<<EOF
[{"offset":4196399,"text":" ;-- str.Password_Correct:"},{"offset":4196399,"text":" 0x0040082f .string \"Password Correct!\" ; len=18"}]
EOF
CMDS=<<EOF
pdJ 1 @ 0x0040082f
EOF
RUN
NAME=pd0~{} - crash
@ -1631,30 +1650,34 @@ RUN
NAME=pd bin.str.filter
FILE=../bins/elf/analysis/ls2
CMDS='e asm.bytes=false
CMDS=<<EOF
e asm.bytes=false
e asm.cmt.off=false
s 0x004028e0
e bin.str.filter=
pd 1
e bin.str.filter=U
pd 1
'
EXPECT=' 0x004028e0 mov esi, str.usr_share_locale ; "/usr/share/locale"
EOF
EXPECT=<<EOF
0x004028e0 mov esi, str.usr_share_locale ; "/usr/share/locale"
0x004028e0 mov esi, str.usr_share_locale
'
EOF
RUN
NAME=emu.str dup str/flag cmt fix
FILE=../bins/elf/analysis/ls2
CMDS='e emu.str=true
CMDS=<<EOF
e emu.str=true
e asm.filter=true
pd 1 @ 0x00402a5f
e asm.filter=false
pd 1 @ 0x00402a5f
'
EXPECT=' 0x00402a5f bfdf4f4100 mov edi, str.COLUMNS ; 0x414fdf ; "COLUMNS"
EOF
EXPECT=<<EOF
0x00402a5f bfdf4f4100 mov edi, str.COLUMNS ; 0x414fdf ; "COLUMNS"
0x00402a5f bfdf4f4100 mov edi, 0x414fdf ; str.COLUMNS ; "COLUMNS"
'
EOF
RUN
NAME=emu.strinv
@ -1716,59 +1739,69 @@ RUN
NAME=ctrl chars
FILE=../bins/elf/strenc-ctrlchars
CMDS='e asm.bytes=false
CMDS=<<EOF
e asm.bytes=false
e asm.cmt.off=false
pd 1 @ 0x0040040b
'
EXPECT=' 0x0040040b mov edi, str.Control_chars: ; "Control chars: \b\v\f\n\r\t\a"
'
EOF
EXPECT=<<EOF
0x0040040b mov edi, str.Control_chars: ; "Control chars: \b\v\f\n\r\t\a"
EOF
RUN
NAME=data ref with no analop.ptr (#9610)
FILE=../bins/firmware/main.bin
CMDS='f str.hello 12 @ 0x276
CMDS=<<EOF
f str.hello 12 @ 0x276
axd str.hello @ 0x260
pd 1 @ 0x260
'
EXPECT=' 0x00000260 80e0 ldi r24, 0x00 ; 0x276 ; "hello world!"
'
EOF
EXPECT=<<EOF
0x00000260 80e0 ldi r24, 0x00 ; 0x276 ; "hello world!"
EOF
RUN
NAME=@b and @addr should coexist
FILE=../bins/firmware/armthumb.bin
ARGS=-aarm -b32
CMDS='pd 1 @b:32 @0xc
'
EXPECT=' 0x0000000c 01207047 ldrbmi r2, [r0, -r1]!
'
CMDS=<<EOF
pd 1 @b:32 @0xc
EOF
EXPECT=<<EOF
0x0000000c 01207047 ldrbmi r2, [r0, -r1]!
EOF
RUN
NAME=ahb should not be deleted with @b (#9751)
FILE=../bins/firmware/armthumb.bin
ARGS=-aarm -b32
CMDS='ahb 16 @0xc
CMDS=<<EOF
ahb 16 @0xc
ah*
pd 1 @b:32 @0xc
ah*
'
EXPECT='ahb 16 @ 0xc
EOF
EXPECT=<<EOF
ahb 16 @ 0xc
0x0000000c 01207047 ldrbmi r2, [r0, -r1]!
ahb 16 @ 0xc
'
EOF
RUN
NAME=ahb should not override @b
FILE=../bins/firmware/armthumb.bin
ARGS=-aarm -b32
CMDS='ahb 16 @0xc
CMDS=<<EOF
ahb 16 @0xc
pd 5 @b:32
'
EXPECT=' 0x00000000 0000a0e1 mov r0, r0
EOF
EXPECT=<<EOF
0x00000000 0000a0e1 mov r0, r0
0x00000004 010000eb bl 0x10
@-> 0x00000008 feffffea b 8
0x0000000c 01207047 ldrbmi r2, [r0, -r1]!
0x00000010 00c09fe5 ldr ip, [pc] ; [0x18:4]=13 ; 24
'
EOF
RUN
NAME=two-operand line highlight; asm.highlight ecHw fix; ec wordhl/linehl
@ -2141,7 +2174,8 @@ RUN
NAME=pd grep chain fail
FILE=malloc://8
EXPECT=''
EXPECT=<<EOF
EOF
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64

View File

@ -200,8 +200,9 @@ RUN
NAME=pij 3
FILE=malloc://512
EXPECT='[{"offset":0,"val":1,"esil":"1,rax,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":5,"opcode":"mov eax, 1","disasm":"mov eax, 1","bytes":"b801000000","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":5,"esil":"rcx,rdx,==,$z,zf,:=,64,$b,cf,:=,$p,pf,:=,63,$s,sf,:=,63,$o,of,:=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":3,"opcode":"cmp rdx, rcx","disasm":"cmp rdx, rcx","bytes":"4839ca","family":"cpu","type":"cmp","reloc":false,"type_num":15,"type2_num":0},{"offset":8,"esil":"sf,of,!,^,zf,!,&,?{,10,rip,=,}","refptr":false,"fcn_addr":0,"fcn_last":0,"size":2,"opcode":"jg 0xa","disasm":"jg 0xa","bytes":"7f00","family":"cpu","type":"cjmp","reloc":false,"type_num":2147483649,"type2_num":0,"jump":10,"fail":10}]
'
EXPECT=<<EOF
[{"offset":0,"val":1,"esil":"1,rax,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":5,"opcode":"mov eax, 1","disasm":"mov eax, 1","bytes":"b801000000","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":5,"esil":"rcx,rdx,==,$z,zf,:=,64,$b,cf,:=,$p,pf,:=,63,$s,sf,:=,63,$o,of,:=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":3,"opcode":"cmp rdx, rcx","disasm":"cmp rdx, rcx","bytes":"4839ca","family":"cpu","type":"cmp","reloc":false,"type_num":15,"type2_num":0},{"offset":8,"esil":"sf,of,!,^,zf,!,&,?{,10,rip,=,}","refptr":false,"fcn_addr":0,"fcn_last":0,"size":2,"opcode":"jg 0xa","disasm":"jg 0xa","bytes":"7f00","family":"cpu","type":"cjmp","reloc":false,"type_num":2147483649,"type2_num":0,"jump":10,"fail":10}]
EOF
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
@ -263,8 +264,9 @@ RUN
NAME=pij -5 @ 0x0040050f
FILE=../bins/elf/analysis/main
EXPECT='[{"offset":4195590,"esil":"rbp,8,rsp,-,=[8],8,rsp,-=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":1,"opcode":"push rbp","disasm":"push rbp","bytes":"55","family":"cpu","type":"rpush","reloc":false,"type_num":268435468,"type2_num":0,"flags":["main","sym.main"]},{"offset":4195591,"esil":"rsp,rbp,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":3,"opcode":"mov rbp, rsp","disasm":"mov rbp, rsp","bytes":"4889e5","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":4195594,"ptr":4195780,"val":4195780,"esil":"4195780,rdi,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":5,"opcode":"mov edi, 0x4005c4","disasm":"mov edi, str.Hello_World","bytes":"bfc4054000","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0}]
'
EXPECT=<<EOF
[{"offset":4195590,"esil":"rbp,8,rsp,-,=[8],8,rsp,-=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":1,"opcode":"push rbp","disasm":"push rbp","bytes":"55","family":"cpu","type":"rpush","reloc":false,"type_num":268435468,"type2_num":0,"flags":["main","sym.main"]},{"offset":4195591,"esil":"rsp,rbp,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":3,"opcode":"mov rbp, rsp","disasm":"mov rbp, rsp","bytes":"4889e5","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":4195594,"ptr":4195780,"val":4195780,"esil":"4195780,rdi,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":5,"opcode":"mov edi, 0x4005c4","disasm":"mov edi, str.Hello_World","bytes":"bfc4054000","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0}]
EOF
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
@ -369,8 +371,9 @@ RUN
NAME=pij 3 (2)
FILE=malloc://512
EXPECT='[{"offset":0,"val":1,"esil":"1,rax,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":5,"opcode":"mov eax, 1","disasm":"mov eax, 1","bytes":"b801000000","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":5,"esil":"rcx,rdx,==,$z,zf,:=,64,$b,cf,:=,$p,pf,:=,63,$s,sf,:=,63,$o,of,:=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":3,"opcode":"cmp rdx, rcx","disasm":"cmp rdx, rcx","bytes":"4839ca","family":"cpu","type":"cmp","reloc":false,"type_num":15,"type2_num":0},{"offset":8,"esil":"sf,of,!,^,zf,!,&,?{,10,rip,=,}","refptr":false,"fcn_addr":0,"fcn_last":0,"size":2,"opcode":"jg 0xa","disasm":"jg 0xa","bytes":"7f00","family":"cpu","type":"cjmp","reloc":false,"type_num":2147483649,"type2_num":0,"jump":10,"fail":10}]
'
EXPECT=<<EOF
[{"offset":0,"val":1,"esil":"1,rax,=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":5,"opcode":"mov eax, 1","disasm":"mov eax, 1","bytes":"b801000000","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":5,"esil":"rcx,rdx,==,$z,zf,:=,64,$b,cf,:=,$p,pf,:=,63,$s,sf,:=,63,$o,of,:=","refptr":false,"fcn_addr":0,"fcn_last":0,"size":3,"opcode":"cmp rdx, rcx","disasm":"cmp rdx, rcx","bytes":"4839ca","family":"cpu","type":"cmp","reloc":false,"type_num":15,"type2_num":0},{"offset":8,"esil":"sf,of,!,^,zf,!,&,?{,10,rip,=,}","refptr":false,"fcn_addr":0,"fcn_last":0,"size":2,"opcode":"jg 0xa","disasm":"jg 0xa","bytes":"7f00","family":"cpu","type":"cjmp","reloc":false,"type_num":2147483649,"type2_num":0,"jump":10,"fail":10}]
EOF
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
@ -414,7 +417,8 @@ RUN
NAME=pij -3 @ 3
FILE=malloc://512
EXPECT='[
EXPECT=<<EOF
[
{
"offset": 3,
"esil": "al,rax,+=[1],7,$o,of,:=,7,$s,sf,:=,$z,zf,:=,7,$c,cf,:=,$p,pf,:=",
@ -466,7 +470,7 @@ EXPECT='[
"fail": 10
}
]
'
EOF
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64

View File

@ -1,7 +1,8 @@
NAME=pvj JSON indent - crash
FILE=-
EXPECT='[{"value":0,"string":""}]
'
EXPECT=<<EOF
[{"value":0,"string":""}]
EOF
CMDS=<<EOF
pvj ~{
EOF

View File

@ -1,7 +1,8 @@
NAME=psj ascii
FILE=malloc://128
EXPECT='{"string":"radare is cool","offset":0,"section":"unknown","length":14,"type":"ascii"}
'
EXPECT=<<EOF
{"string":"radare is cool","offset":0,"section":"unknown","length":14,"type":"ascii"}
EOF
CMDS=<<EOF
wx 72616461726520697320636f6f6c
psj 14
@ -10,8 +11,9 @@ RUN
NAME=psj utf
FILE=malloc://128
EXPECT='{"string":"\u00e9\u00bb\u0091\u00e5\u00ae\u00a2","offset":0,"section":"unknown","length":6,"type":"utf"}
'
EXPECT=<<EOF
{"string":"\u00e9\u00bb\u0091\u00e5\u00ae\u00a2","offset":0,"section":"unknown","length":6,"type":"utf"}
EOF
CMDS=<<EOF
wx e9bb91e5aea2
psj 6
@ -20,8 +22,9 @@ RUN
NAME=psj wide
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT='{"string":"\u000b\u0000\u0000\u0000","offset":134518272,"section":".dynamic","length":4,"type":"wide"}
'
EXPECT=<<EOF
{"string":"\u000b\u0000\u0000\u0000","offset":134518272,"section":".dynamic","length":4,"type":"wide"}
EOF
CMDS=<<EOF
s 0x08049600
psj 4
@ -30,8 +33,9 @@ RUN
NAME=psj ascii 2
FILE=../bins/elf/analysis/hello-android-arm
EXPECT='{"string":"Hello World","offset":33624,"section":".rodata","length":11,"type":"ascii"}
'
EXPECT=<<EOF
{"string":"Hello World","offset":33624,"section":".rodata","length":11,"type":"ascii"}
EOF
CMDS=<<EOF
s 0x00008358
psj 11

View File

@ -134,9 +134,10 @@ RUN
NAME=search rop gadgets with filter and output JSON
FILE=../bins/elf/analysis/x86-helloworld-phdr
EXPECT='[{"opcodes":[{"offset":180,"size":2,"opcode":"int 0x80","type":"swi"},{"offset":182,"size":5,"opcode":"mov eax, 1","type":"mov"},{"offset":187,"size":5,"opcode":"mov ecx, 0","type":"mov"},{"offset":192,"size":2,"opcode":"int 0x80","type":"swi"},{"offset":194,"size":1,"opcode":"ret","type":"ret"}],"retaddr":194,"size":15},{"opcodes":[{"offset":183,"size":2,"opcode":"add dword [eax], eax","type":"add"},{"offset":185,"size":2,"opcode":"add byte [eax], al","type":"add"},{"offset":187,"size":5,"opcode":"mov ecx, 0","type":"mov"},{"offset":192,"size":2,"opcode":"int 0x80","type":"swi"},{"offset":194,"size":1,"opcode":"ret","type":"ret"}],"retaddr":194,"size":12},{"opcodes":[{"offset":184,"size":2,"opcode":"add byte [eax], al","type":"add"},{"offset":186,"size":6,"opcode":"add byte [ecx], bh","type":"add"},{"offset":192,"size":2,"opcode":"int 0x80","type":"swi"},{"offset":194,"size":1,"opcode":"ret","type":"ret"}],"retaddr":194,"size":11}]
EXPECT=<<EOF
[{"opcodes":[{"offset":180,"size":2,"opcode":"int 0x80","type":"swi"},{"offset":182,"size":5,"opcode":"mov eax, 1","type":"mov"},{"offset":187,"size":5,"opcode":"mov ecx, 0","type":"mov"},{"offset":192,"size":2,"opcode":"int 0x80","type":"swi"},{"offset":194,"size":1,"opcode":"ret","type":"ret"}],"retaddr":194,"size":15},{"opcodes":[{"offset":183,"size":2,"opcode":"add dword [eax], eax","type":"add"},{"offset":185,"size":2,"opcode":"add byte [eax], al","type":"add"},{"offset":187,"size":5,"opcode":"mov ecx, 0","type":"mov"},{"offset":192,"size":2,"opcode":"int 0x80","type":"swi"},{"offset":194,"size":1,"opcode":"ret","type":"ret"}],"retaddr":194,"size":12},{"opcodes":[{"offset":184,"size":2,"opcode":"add byte [eax], al","type":"add"},{"offset":186,"size":6,"opcode":"add byte [ecx], bh","type":"add"},{"offset":192,"size":2,"opcode":"int 0x80","type":"swi"},{"offset":194,"size":1,"opcode":"ret","type":"ret"}],"retaddr":194,"size":11}]
'
EOF
ARGS=-n
CMDS=<<EOF
e asm.arch=x86

View File

@ -88,8 +88,9 @@ RUN
NAME=/j escaped
FILE=../bins/mach0/escaped
EXPECT='[{"offset":8019,"type":"string","data":"]c:\\hello\\worldM"}]
'
EXPECT=<<EOF
[{"offset":8019,"type":"string","data":"]c:\\hello\\worldM"}]
EOF
CMDS=<<EOF
/j hello
EOF
@ -126,8 +127,9 @@ RUN
NAME=/j search
FILE=malloc://1024
EXPECT='[{"offset":0,"type":"string","data":"foo\\"}]
'
EXPECT=<<EOF
[{"offset":0,"type":"string","data":"foo\\"}]
EOF
CMDS=<<EOF
wx 666f6f005c
/j foo
@ -537,8 +539,9 @@ RUN
NAME=/mj test json output
FILE=../bins/elf/analysis/x86-simple
EXPECT='[{"offset":134512640,"depth":1,"info":"ELF 32-bit LSB executable, Intel 80386, version 1"}]
'
EXPECT=<<EOF
[{"offset":134512640,"depth":1,"info":"ELF 32-bit LSB executable, Intel 80386, version 1"}]
EOF
CMDS=<<EOF
/mj
EOF
@ -584,8 +587,9 @@ RUN
NAME=/v4j search 4 byte with json output
FILE=-
EXPECT='[{"offset":0,"type":"hexpair","data":"12345678"},{"offset":10,"type":"hexpair","data":"12345678"}]
'
EXPECT=<<EOF
[{"offset":0,"type":"hexpair","data":"12345678"},{"offset":10,"type":"hexpair","data":"12345678"}]
EOF
CMDS=<<EOF
wx 0x12345678aabbccddeeff12345678
/v4j 0x78563412
@ -605,8 +609,9 @@ RUN
NAME=/V4j search 4 byte with json
FILE=-
EXPECT='[{"offset":0,"value":2018915346},{"offset":10,"value":2018915346}]
'
EXPECT=<<EOF
[{"offset":0,"value":2018915346},{"offset":10,"value":2018915346}]
EOF
CMDS=<<EOF
wx 0x12345678aabbccddeeff12345678
/V4j 0x78563412 0x78563420

View File

@ -449,7 +449,8 @@ RUN
NAME=x86 - pdj 4
FILE=../bins/elf/analysis/x86-helloworld-gcc
EXPECT='[
EXPECT=<<EOF
[
{
"offset": 134513408,
"esil": "ebp,ebp,^=,$z,zf,:=,$p,pf,:=,31,$s,sf,:=,0,cf,:=,0,of,:=",
@ -525,7 +526,7 @@ EXPECT='[
]
'
EOF
CMDS=<<EOF
pdj 4~{}
?e

View File

@ -74,7 +74,8 @@ RUN
NAME=ELF: local symbols
FILE=../bins/elf/analysis/example.elf
EXPECT=''
EXPECT=<<EOF
EOF
CMDS=<<EOF
is*~d_41
EOF

View File

@ -3,10 +3,11 @@ FILE=../bins/elf/pngrutil_o
CMDS=<<EOF
ie
EOF
EXPECT='[Entrypoints]
EXPECT=<<EOF
[Entrypoints]
0 entrypoints
'
EOF
RUN

View File

@ -77,8 +77,9 @@ RUN
NAME=MSVC import symbol demangling
FILE=../bins/pe/libzmq-v100-mt-4_0_4.dll
CMDS=f~0x1004e0f4[2]
EXPECT='sym.imp.MSVCP100.dll_public:_void___thiscall_std::basic_ostream_char__struct_std::char_traits_char__::_Osfx_void
'
EXPECT=<<EOF
sym.imp.MSVCP100.dll_public:_void___thiscall_std::basic_ostream_char__struct_std::char_traits_char__::_Osfx_void
EOF
RUN
NAME=C++ demangle relocs
@ -106,16 +107,18 @@ RUN
NAME=demangle in irj
FILE=../bins/elf/demangle-test-cpp
EXPECT='{"name":"_ZSt20__throw_length_errorPKc","demname":"std::__throw_length_error(char const*)","type":"SET_64","vaddr":16424,"paddr":12328,"is_ifunc":false}
'
EXPECT=<<EOF
{"name":"_ZSt20__throw_length_errorPKc","demname":"std::__throw_length_error(char const*)","type":"SET_64","vaddr":16424,"paddr":12328,"is_ifunc":false}
EOF
CMDS=irj~{9}
RUN
NAME=demangle obj in pd
FILE=../bins/elf/ch25.bin
EXPECT=' 0x08048aac c7042460b004. mov dword [esp], obj.std::cerr ; sym..bss
EXPECT=<<EOF
0x08048aac c7042460b004. mov dword [esp], obj.std::cerr ; sym..bss
; [0x804b060:4]=0
'
EOF
CMDS=pd 1 @0x08048aac
RUN

View File

@ -1,6 +1,7 @@
NAME=PE: corkami imports_tinyW7.exe - open
FILE=../bins/pe/imports_tinyW7.exe
EXPECT=''
EXPECT=<<EOF
EOF
CMDS=<<EOF
q!
EOF

File diff suppressed because one or more lines are too long

View File

@ -50,7 +50,8 @@ RUN
NAME=rabin -k file
FILE=../bins/elf/analysis/hello-linux-x86_64
CMDS=!rabin2 -k ${R2_FILE}
EXPECT=''
EXPECT=<<EOF
EOF
EXPECT_ERR=Missing file.
RUN
@ -375,7 +376,8 @@ RUN
NAME=rabin2 -ee -j
FILE=../bins/elf/analysis/x86-helloworld-gcc
CMDS=!!rabin2 -ee -j ${R2_FILE}~{}
EXPECT='{
EXPECT=<<EOF
{
"initfini": [
{
"vaddr": 134513616,
@ -396,7 +398,8 @@ EXPECT='{
"type": "fini"
}
]
}'
}
EOF
RUN
NAME=-ee baddr 0

View File

@ -441,8 +441,9 @@ RUN
NAME=rasm2 -a x86 -b 64 -Aj 0x55
FILE=-
CMDS=!rasm2 -a x86 -b 64 -Aj 0x55
EXPECT='[{"opcode":0,"bytes":"55","type":"rpush","stackop":"unknown","esil":"rbp,8,rsp,-,=[8],8,rsp,-=","stackptr":8}]
'
EXPECT=<<EOF
[{"opcode":0,"bytes":"55","type":"rpush","stackop":"unknown","esil":"rbp,8,rsp,-,=[8],8,rsp,-=","stackptr":8}]
EOF
RUN
NAME=rasm2 -L