mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-25 07:15:19 +00:00
449 lines
5.0 KiB
Plaintext
449 lines
5.0 KiB
Plaintext
NAME=?e ~
|
|
FILE=malloc://1024
|
|
CMDS=?e jeje~jojo
|
|
EXPECT=<<EOF
|
|
EOF
|
|
RUN
|
|
|
|
NAME=quote grep
|
|
FILE=malloc://1024
|
|
BROKEN=1
|
|
CMDS=<<EOF
|
|
e asm.arch=x86
|
|
e asm.bits=32
|
|
wx 90cc90cc
|
|
"pd 4"~nop
|
|
EOF
|
|
EXPECT=<<EOF
|
|
0x00000000 90 nop
|
|
0x00000002 90 nop
|
|
EOF
|
|
RUN
|
|
|
|
NAME=grep and/or
|
|
FILE=malloc://1024
|
|
CMDS=<<EOF
|
|
e asm.arch=x86
|
|
e asm.bits=32
|
|
wx 90cc90cc
|
|
pd 4~nop
|
|
?e ==
|
|
pd 4~&90,nop
|
|
?e ==
|
|
pd 4~&90,404
|
|
?e ==
|
|
pd 4~90,404
|
|
EOF
|
|
EXPECT=<<EOF
|
|
0x00000000 90 nop
|
|
0x00000002 90 nop
|
|
==
|
|
0x00000000 90 nop
|
|
0x00000002 90 nop
|
|
==
|
|
==
|
|
0x00000000 90 nop
|
|
0x00000002 90 nop
|
|
EOF
|
|
RUN
|
|
|
|
NAME=?e \~
|
|
FILE=malloc://1024
|
|
CMDS=?e jeje\~jojo
|
|
EXPECT=<<EOF
|
|
jeje~jojo
|
|
EOF
|
|
RUN
|
|
|
|
# Basic grep.
|
|
NAME=px~:1[1]
|
|
FILE=malloc://1024
|
|
CMDS=<<EOF
|
|
wx 10203040
|
|
px~:1[1]
|
|
EOF
|
|
EXPECT=<<EOF
|
|
1020
|
|
EOF
|
|
RUN
|
|
|
|
NAME=px~:1[1-3]
|
|
FILE=malloc://1024
|
|
CMDS=<<EOF
|
|
wx 102030405060708090
|
|
px~:1[1-3]
|
|
EOF
|
|
EXPECT=<<EOF
|
|
1020 3040 5060
|
|
EOF
|
|
RUN
|
|
|
|
NAME=px~:1[1-]
|
|
FILE=malloc://1024
|
|
CMDS=<<EOF
|
|
wx 10203040506070809010203040506070
|
|
px~:1[1-]
|
|
EOF
|
|
EXPECT=<<EOF
|
|
1020 3040 5060 7080 9010 2030 4050 6070 . 0@P`p... 0@P`p
|
|
EOF
|
|
RUN
|
|
|
|
NAME=px~?
|
|
FILE=malloc://1024
|
|
CMDS=<<EOF
|
|
wx 10203040
|
|
b 128
|
|
px~?
|
|
EOF
|
|
EXPECT=<<EOF
|
|
9
|
|
EOF
|
|
RUN
|
|
|
|
NAME=grep begin
|
|
FILE=malloc://1024
|
|
CMDS=i~^size
|
|
EXPECT=<<EOF
|
|
size 0x400
|
|
EOF
|
|
RUN
|
|
|
|
NAME=grep neg begin
|
|
FILE=malloc://1024
|
|
CMDS=i~!^size
|
|
EXPECT=<<EOF
|
|
fd 3
|
|
file malloc://1024
|
|
humansz 1K
|
|
minopsz 1
|
|
maxopsz 16
|
|
invopsz 1
|
|
mode rwx
|
|
format any
|
|
iorw true
|
|
block 0x100
|
|
EOF
|
|
RUN
|
|
|
|
NAME=grep neg begin
|
|
FILE=malloc://1024
|
|
CMDS=i~!^size
|
|
EXPECT=<<EOF
|
|
fd 3
|
|
file malloc://1024
|
|
humansz 1K
|
|
minopsz 1
|
|
maxopsz 16
|
|
invopsz 1
|
|
mode rwx
|
|
format any
|
|
iorw true
|
|
block 0x100
|
|
EOF
|
|
RUN
|
|
|
|
NAME=grep neg
|
|
FILE=malloc://1024
|
|
CMDS=i~!fd
|
|
EXPECT=<<EOF
|
|
file malloc://1024
|
|
size 0x400
|
|
humansz 1K
|
|
minopsz 1
|
|
maxopsz 16
|
|
invopsz 1
|
|
mode rwx
|
|
format any
|
|
iorw true
|
|
block 0x100
|
|
EOF
|
|
RUN
|
|
|
|
NAME=double grep
|
|
FILE=malloc://1024
|
|
CMDS=i~f~d
|
|
EXPECT=<<EOF
|
|
fd 3
|
|
EOF
|
|
RUN
|
|
|
|
NAME=double grep neg
|
|
FILE=malloc://1024
|
|
CMDS=i~f~!file
|
|
EXPECT=<<EOF
|
|
fd 3
|
|
format any
|
|
EOF
|
|
RUN
|
|
|
|
NAME=i;$s
|
|
FILE=malloc://1024
|
|
CMDS=?v `i~size[1]`-$s;?! ?e works
|
|
EXPECT=<<EOF
|
|
0x0
|
|
works
|
|
EOF
|
|
RUN
|
|
|
|
NAME=?e~[0]
|
|
FILE=malloc://1024
|
|
CMDS=?e 0x3~[0];?e 0x999~[0]
|
|
EXPECT=<<EOF
|
|
0x3
|
|
0x999
|
|
EOF
|
|
RUN
|
|
|
|
NAME=?e~[0]
|
|
FILE=malloc://1024
|
|
CMDS=<<EOF
|
|
?e hello world~[0]
|
|
?e hello world~[1]
|
|
EOF
|
|
EXPECT=<<EOF
|
|
hello
|
|
world
|
|
EOF
|
|
RUN
|
|
|
|
NAME=px~:1[3,5,0-1]
|
|
FILE=malloc://1024
|
|
CMDS=wx 102030405060708090;px~:1[3,5,0-1]
|
|
EXPECT=<<EOF
|
|
0x00000000 1020 5060 9000
|
|
EOF
|
|
RUN
|
|
|
|
NAME=px~[3,5,0-1]:1
|
|
FILE=malloc://1024
|
|
CMDS=wx 102030405060708090;px~[3,5,0-1]:1
|
|
EXPECT=<<EOF
|
|
0x00000000 1020 5060 9000
|
|
EOF
|
|
RUN
|
|
|
|
NAME=px~[3,5,0-1]:0..3
|
|
FILE=malloc://1024
|
|
CMDS=wx 102030405060708090;px~[3,5,0-1]:0..3
|
|
EXPECT=<<EOF
|
|
- offset 0 2
|
|
0x00000000 1020 5060 9000
|
|
0x00000010 0000 0000 0000
|
|
EOF
|
|
RUN
|
|
|
|
NAME=px~[3,5,0-1]:-16
|
|
FILE=malloc://1024
|
|
CMDS=wx 102030405060708090;px~[3,5,0-1]:-16
|
|
EXPECT=<<EOF
|
|
0x00000000 1020 5060 9000
|
|
EOF
|
|
RUN
|
|
|
|
NAME=range
|
|
FILE=malloc://1024
|
|
CMDS=<<EOF
|
|
i~:0
|
|
i~:1
|
|
i~:2
|
|
i~:..3
|
|
i~:1..2
|
|
i~:-2
|
|
i~:-1
|
|
?e 0\n1\n2\n3\n4~:-2
|
|
?e 0\n1\n2\n3\n4~:-2..
|
|
?e 0\n1\n2~:0..
|
|
?e 0\n1\n2~:..
|
|
EOF
|
|
EXPECT=<<EOF
|
|
fd 3
|
|
file malloc://1024
|
|
size 0x400
|
|
fd 3
|
|
file malloc://1024
|
|
size 0x400
|
|
file malloc://1024
|
|
iorw true
|
|
block 0x100
|
|
3
|
|
3
|
|
4
|
|
0
|
|
1
|
|
2
|
|
0
|
|
1
|
|
2
|
|
EOF
|
|
RUN
|
|
|
|
NAME=multigrep
|
|
FILE=malloc://1024
|
|
CMDS=<<EOF
|
|
i~size~?
|
|
i~nosuchstring~?
|
|
i~^f~or~?
|
|
i~?&f,or
|
|
i~or~true
|
|
i~&or,true
|
|
i~or~ny[0]
|
|
i~&or,ny[0]
|
|
i~or[1]~any
|
|
i~or[1]~:1
|
|
EOF
|
|
EXPECT=<<EOF
|
|
1
|
|
0
|
|
1
|
|
1
|
|
iorw true
|
|
iorw true
|
|
format
|
|
format
|
|
any
|
|
true
|
|
EOF
|
|
RUN
|
|
|
|
NAME=multigrep2
|
|
FILE=malloc://1024
|
|
CMDS=<<EOF
|
|
?e hello world~hello~!boing
|
|
?e hello world~hello~world
|
|
?e hello world~!boing~world
|
|
?e hello world~!boing~!pongo
|
|
EOF
|
|
EXPECT=<<EOF
|
|
hello world
|
|
hello world
|
|
hello world
|
|
hello world
|
|
EOF
|
|
RUN
|
|
|
|
NAME=colgrep
|
|
CMDS=<<EOF
|
|
?e 0x3~[0]
|
|
?e 0x999~[0]'
|
|
EOF
|
|
EXPECT=<<EOF
|
|
0x3
|
|
0x999
|
|
EOF
|
|
RUN
|
|
|
|
NAME=colgrep
|
|
CMDS=<<EOF
|
|
?e hello world~[0]
|
|
?e hello world~[1]
|
|
EOF
|
|
EXPECT=<<EOF
|
|
hello
|
|
world
|
|
EOF
|
|
RUN
|
|
|
|
NAME=colgrep
|
|
CMDS=<<EOF
|
|
?e a\na b\na b c~[0]
|
|
?e a\na b\na b c~[1]
|
|
?e a\na b\na b c~[2]
|
|
EOF
|
|
EXPECT=<<EOF
|
|
a
|
|
a
|
|
a
|
|
b
|
|
b
|
|
c
|
|
EOF
|
|
RUN
|
|
|
|
NAME=colgrep
|
|
FILE=malloc://1024
|
|
CMDS=<<EOF
|
|
wx 10203040
|
|
px~:1[1]
|
|
EOF
|
|
EXPECT=<<EOF
|
|
1020
|
|
EOF
|
|
RUN
|
|
|
|
NAME=count grep
|
|
CMDS=<<EOF
|
|
wx 10203040
|
|
b 128
|
|
px~?
|
|
EOF
|
|
EXPECT=<<EOF
|
|
9
|
|
EOF
|
|
RUN
|
|
|
|
NAME=escaped grep
|
|
FILE=bins/elf/crackme
|
|
CMDS=pd 40~0x004005fe
|
|
EXPECT=<<EOF
|
|
`-> 0x004005fe 4883c408 add rsp, 8
|
|
EOF
|
|
RUN
|
|
|
|
NAME=sort lines
|
|
CMDS=<<EOF
|
|
?e 3\n2\n4\n1~$
|
|
?e 3\n2\n4\n1~$!
|
|
EOF
|
|
EXPECT=<<EOF
|
|
1
|
|
2
|
|
3
|
|
4
|
|
4
|
|
3
|
|
2
|
|
1
|
|
EOF
|
|
RUN
|
|
|
|
NAME=escaped chars
|
|
CMDS=<<EOF
|
|
?e Hello\x40World~Hello\@
|
|
?e Hello\x24World~Hello\@
|
|
?e Hello\n\x23World~\#
|
|
EOF
|
|
EXPECT=<<EOF
|
|
Hello@World
|
|
#World
|
|
EOF
|
|
RUN
|
|
|
|
NAME=escaped chars 2
|
|
CMDS=?e Hello\n\x3bWorld~\;
|
|
EXPECT=<<EOF
|
|
;World
|
|
EOF
|
|
RUN
|
|
|
|
NAME=multi-command single-line grep
|
|
CMDS=<<EOF
|
|
?e Hello World; ?e 4e2420~4e2420
|
|
EOF
|
|
EXPECT=<<EOF
|
|
Hello World
|
|
4e2420
|
|
EOF
|
|
RUN
|
|
|
|
NAME=highlight grep with empty string
|
|
ARGS=-escr.highlight.grep=true
|
|
TIMEOUT=2
|
|
CMDS=<<EOF
|
|
i~[0]:0
|
|
EOF
|
|
EXPECT=<<EOF
|
|
fd
|
|
EOF
|
|
RUN
|