2020-02-28 00:06:45 +00:00
|
|
|
NAME=?e ~
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-03-05 16:01:28 +00:00
|
|
|
CMDS=?e jeje~jojo
|
2020-01-17 13:58:18 +00:00
|
|
|
EXPECT=<<EOF
|
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=?e \~
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-03-05 16:01:28 +00:00
|
|
|
CMDS=?e jeje\~jojo
|
2020-01-17 13:58:18 +00:00
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
jeje~jojo
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
|
|
|
# Basic grep.
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=px~:1[1]
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-01-17 13:58:18 +00:00
|
|
|
CMDS=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
wx 10203040
|
|
|
|
px~:1[1]
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
1020
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=px~:1[1-3]
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-01-17 13:58:18 +00:00
|
|
|
CMDS=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
wx 102030405060708090
|
|
|
|
px~:1[1-3]
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
1020 3040 5060
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=px~:1[1-]
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-01-17 13:58:18 +00:00
|
|
|
CMDS=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
wx 10203040506070809010203040506070
|
|
|
|
px~:1[1-]
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
1020 3040 5060 7080 9010 2030 4050 6070 . 0@P`p... 0@P`p
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=px~?
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-01-17 13:58:18 +00:00
|
|
|
CMDS=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
wx 10203040
|
|
|
|
b 128
|
|
|
|
px~?
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
9
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=grep begin
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-03-05 16:01:28 +00:00
|
|
|
CMDS=i~^size
|
2020-01-17 13:58:18 +00:00
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
size 0x400
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=grep end
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-03-05 16:01:28 +00:00
|
|
|
CMDS=i~0x400$
|
2020-01-17 13:58:18 +00:00
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
size 0x400
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=i;$s
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-03-05 16:01:28 +00:00
|
|
|
CMDS=?v `i~size[1]`-$s;?! ?e works
|
2020-01-17 13:58:18 +00:00
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
0x0
|
|
|
|
works
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=?e~[0]
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-03-05 16:01:28 +00:00
|
|
|
CMDS=?e 0x3~[0];?e 0x999~[0]
|
2020-01-17 13:58:18 +00:00
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
0x3
|
|
|
|
0x999
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=?e~[0]
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-01-17 13:58:18 +00:00
|
|
|
CMDS=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
?e hello world~[0]
|
|
|
|
?e hello world~[1]
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
hello
|
|
|
|
world
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=px~:1[3,5,0-1]
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-03-05 16:01:28 +00:00
|
|
|
CMDS=wx 102030405060708090;px~:1[3,5,0-1]
|
2020-01-17 13:58:18 +00:00
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
0x00000000 1020 5060 9000
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=px~[3,5,0-1]:1
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-03-05 16:01:28 +00:00
|
|
|
CMDS=wx 102030405060708090;px~[3,5,0-1]:1
|
2020-01-17 13:58:18 +00:00
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
0x00000000 1020 5060 9000
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=px~[3,5,0-1]:0..3
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-03-05 16:01:28 +00:00
|
|
|
CMDS=wx 102030405060708090;px~[3,5,0-1]:0..3
|
2020-01-17 13:58:18 +00:00
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
- offset 0 2
|
|
|
|
0x00000000 1020 5060 9000
|
|
|
|
0x00000010 0000 0000 0000
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=px~[3,5,0-1]:-16
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-03-05 16:01:28 +00:00
|
|
|
CMDS=wx 102030405060708090;px~[3,5,0-1]:-16
|
2020-01-17 13:58:18 +00:00
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
0x00000000 1020 5060 9000
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=range
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-01-17 13:58:18 +00:00
|
|
|
CMDS=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
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~:..
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
fd 3
|
|
|
|
file malloc://1024
|
|
|
|
size 0x400
|
|
|
|
fd 3
|
|
|
|
file malloc://1024
|
|
|
|
size 0x400
|
|
|
|
file malloc://1024
|
|
|
|
blksz 0x0
|
|
|
|
block 0x100
|
|
|
|
3
|
|
|
|
3
|
|
|
|
4
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=multigrep
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2020-01-17 13:58:18 +00:00
|
|
|
CMDS=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
i~size~?
|
|
|
|
i~nosuchstring~?
|
|
|
|
i~^f~or~?
|
|
|
|
i~?&f,or
|
|
|
|
i~or~true
|
|
|
|
i~&or,true
|
|
|
|
i~or~ny[0]
|
|
|
|
i~&or,ny[0]
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
1
|
|
|
|
0
|
|
|
|
1
|
|
|
|
1
|
|
|
|
iorw true
|
|
|
|
iorw true
|
|
|
|
format
|
|
|
|
format
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-06-16 21:00:45 +00:00
|
|
|
NAME=multigrep2
|
|
|
|
BROKEN=1
|
|
|
|
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
|
|
|
|
|
2019-12-08 14:31:14 +00:00
|
|
|
NAME=colgrep
|
2020-01-17 13:58:18 +00:00
|
|
|
CMDS=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
?e 0x3~[0]
|
|
|
|
?e 0x999~[0]'
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
0x3
|
|
|
|
0x999
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
|
|
|
NAME=colgrep
|
2020-01-17 13:58:18 +00:00
|
|
|
CMDS=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
?e hello world~[0]
|
|
|
|
?e hello world~[1]
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
hello
|
|
|
|
world
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
|
|
|
NAME=colgrep
|
2020-01-17 13:58:18 +00:00
|
|
|
CMDS=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
?e a\na b\na b c~[0]
|
|
|
|
?e a\na b\na b c~[1]
|
|
|
|
?e a\na b\na b c~[2]
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
a
|
|
|
|
a
|
|
|
|
a
|
|
|
|
b
|
|
|
|
b
|
|
|
|
c
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
|
|
|
NAME=colgrep
|
|
|
|
FILE=malloc://1024
|
2020-01-17 13:58:18 +00:00
|
|
|
CMDS=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
wx 10203040
|
|
|
|
px~:1[1]
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
1020
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=count grep
|
2020-01-17 13:58:18 +00:00
|
|
|
CMDS=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
wx 10203040
|
|
|
|
b 128
|
|
|
|
px~?
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
9
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=escaped grep
|
2020-04-13 17:49:23 +00:00
|
|
|
FILE=bins/elf/crackme
|
2020-03-05 16:01:28 +00:00
|
|
|
CMDS=pd 40~0x004005fe
|
2020-01-17 13:58:18 +00:00
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
`-> 0x004005fe 4883c408 add rsp, 8
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2020-02-28 00:06:45 +00:00
|
|
|
NAME=sort lines
|
2020-01-17 13:58:18 +00:00
|
|
|
CMDS=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
?e 3\n2\n4\n1~$
|
|
|
|
?e 3\n2\n4\n1~$!
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
4
|
|
|
|
3
|
|
|
|
2
|
|
|
|
1
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
2020-03-12 10:28:45 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
BROKEN=1
|
2020-04-07 14:06:47 +00:00
|
|
|
CMDS=?e Hello\n\x3bWorld~\;
|
2020-03-12 10:28:45 +00:00
|
|
|
EXPECT=<<EOF
|
|
|
|
;World
|
|
|
|
EOF
|
2020-04-13 17:49:23 +00:00
|
|
|
RUN
|