2022-07-30 23:50:50 +00:00
|
|
|
NAME=?e ~$! invert tac
|
|
|
|
FILE=bins/elf/crackme
|
|
|
|
CMDS=<<EOF
|
|
|
|
iS
|
|
|
|
?e --
|
|
|
|
iS~$!!
|
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
|
|
|
[Sections]
|
|
|
|
|
2022-11-11 15:12:59 +00:00
|
|
|
nth paddr size vaddr vsize perm type name
|
|
|
|
-------------------------------------------------------------
|
|
|
|
0 0x00000000 0x0 0x00000000 0x0 ---- NULL
|
|
|
|
1 0x00000200 0x1c 0x00400200 0x1c -r-- PROGBITS .interp
|
|
|
|
2 0x0000021c 0x20 0x0040021c 0x20 -r-- NOTE .note.ABI-tag
|
|
|
|
3 0x0000023c 0x24 0x0040023c 0x24 -r-- NOTE .note.gnu.build-id
|
|
|
|
4 0x00000260 0x3c 0x00400260 0x3c -r-- HASH .hash
|
|
|
|
5 0x000002a0 0x28 0x004002a0 0x28 -r-- GNU_HASH .gnu.hash
|
|
|
|
6 0x000002c8 0xf0 0x004002c8 0xf0 -r-- DYNSYM .dynsym
|
|
|
|
7 0x000003b8 0x65 0x004003b8 0x65 -r-- STRTAB .dynstr
|
|
|
|
8 0x0000041e 0x14 0x0040041e 0x14 -r-- GNU_VERSYM .gnu.version
|
|
|
|
9 0x00000438 0x20 0x00400438 0x20 -r-- GNU_VERNEED .gnu.version_r
|
|
|
|
10 0x00000458 0x48 0x00400458 0x48 -r-- RELA .rela.dyn
|
|
|
|
11 0x000004a0 0x90 0x004004a0 0x90 -r-- RELA .rela.plt
|
|
|
|
12 0x00000530 0x18 0x00400530 0x18 -r-x PROGBITS .init
|
|
|
|
13 0x00000548 0x70 0x00400548 0x70 -r-x PROGBITS .plt
|
|
|
|
14 0x000005c0 0x248 0x004005c0 0x248 -r-x PROGBITS .text
|
|
|
|
15 0x00000808 0xe 0x00400808 0xe -r-x PROGBITS .fini
|
|
|
|
16 0x00000818 0x3a 0x00400818 0x3a -r-- PROGBITS .rodata
|
|
|
|
17 0x00000854 0x24 0x00400854 0x24 -r-- PROGBITS .eh_frame_hdr
|
|
|
|
18 0x00000878 0x7c 0x00400878 0x7c -r-- PROGBITS .eh_frame
|
|
|
|
19 0x000008f8 0x10 0x006008f8 0x10 -rw- PROGBITS .ctors
|
|
|
|
20 0x00000908 0x10 0x00600908 0x10 -rw- PROGBITS .dtors
|
|
|
|
21 0x00000918 0x8 0x00600918 0x8 -rw- PROGBITS .jcr
|
|
|
|
22 0x00000920 0x1a0 0x00600920 0x1a0 -rw- DYNAMIC .dynamic
|
|
|
|
23 0x00000ac0 0x8 0x00600ac0 0x8 -rw- PROGBITS .got
|
|
|
|
24 0x00000ac8 0x48 0x00600ac8 0x48 -rw- PROGBITS .got.plt
|
|
|
|
25 0x00000b10 0x10 0x00600b10 0x10 -rw- PROGBITS .data
|
|
|
|
26 0x00000b20 0x0 0x00600b20 0x28 -rw- NOBITS .bss
|
|
|
|
27 0x00000b20 0x1c 0x00000000 0x1c ---- PROGBITS .comment
|
|
|
|
28 0x00000b3c 0xfe 0x00000000 0xfe ---- STRTAB .shstrtab
|
|
|
|
29 0x00001400 0x6a8 0x00000000 0x6a8 ---- SYMTAB .symtab
|
|
|
|
30 0x00001aa8 0x269 0x00000000 0x269 ---- STRTAB .strtab
|
2022-07-30 23:50:50 +00:00
|
|
|
|
|
|
|
--
|
2022-11-11 15:12:59 +00:00
|
|
|
30 0x00001aa8 0x269 0x00000000 0x269 ---- STRTAB .strtab
|
|
|
|
29 0x00001400 0x6a8 0x00000000 0x6a8 ---- SYMTAB .symtab
|
|
|
|
28 0x00000b3c 0xfe 0x00000000 0xfe ---- STRTAB .shstrtab
|
|
|
|
27 0x00000b20 0x1c 0x00000000 0x1c ---- PROGBITS .comment
|
|
|
|
26 0x00000b20 0x0 0x00600b20 0x28 -rw- NOBITS .bss
|
|
|
|
25 0x00000b10 0x10 0x00600b10 0x10 -rw- PROGBITS .data
|
|
|
|
24 0x00000ac8 0x48 0x00600ac8 0x48 -rw- PROGBITS .got.plt
|
|
|
|
23 0x00000ac0 0x8 0x00600ac0 0x8 -rw- PROGBITS .got
|
|
|
|
22 0x00000920 0x1a0 0x00600920 0x1a0 -rw- DYNAMIC .dynamic
|
|
|
|
21 0x00000918 0x8 0x00600918 0x8 -rw- PROGBITS .jcr
|
|
|
|
20 0x00000908 0x10 0x00600908 0x10 -rw- PROGBITS .dtors
|
|
|
|
19 0x000008f8 0x10 0x006008f8 0x10 -rw- PROGBITS .ctors
|
|
|
|
18 0x00000878 0x7c 0x00400878 0x7c -r-- PROGBITS .eh_frame
|
|
|
|
17 0x00000854 0x24 0x00400854 0x24 -r-- PROGBITS .eh_frame_hdr
|
|
|
|
16 0x00000818 0x3a 0x00400818 0x3a -r-- PROGBITS .rodata
|
|
|
|
15 0x00000808 0xe 0x00400808 0xe -r-x PROGBITS .fini
|
|
|
|
14 0x000005c0 0x248 0x004005c0 0x248 -r-x PROGBITS .text
|
|
|
|
13 0x00000548 0x70 0x00400548 0x70 -r-x PROGBITS .plt
|
|
|
|
12 0x00000530 0x18 0x00400530 0x18 -r-x PROGBITS .init
|
|
|
|
11 0x000004a0 0x90 0x004004a0 0x90 -r-- RELA .rela.plt
|
|
|
|
10 0x00000458 0x48 0x00400458 0x48 -r-- RELA .rela.dyn
|
|
|
|
9 0x00000438 0x20 0x00400438 0x20 -r-- GNU_VERNEED .gnu.version_r
|
|
|
|
8 0x0000041e 0x14 0x0040041e 0x14 -r-- GNU_VERSYM .gnu.version
|
|
|
|
7 0x000003b8 0x65 0x004003b8 0x65 -r-- STRTAB .dynstr
|
|
|
|
6 0x000002c8 0xf0 0x004002c8 0xf0 -r-- DYNSYM .dynsym
|
|
|
|
5 0x000002a0 0x28 0x004002a0 0x28 -r-- GNU_HASH .gnu.hash
|
|
|
|
4 0x00000260 0x3c 0x00400260 0x3c -r-- HASH .hash
|
|
|
|
3 0x0000023c 0x24 0x0040023c 0x24 -r-- NOTE .note.gnu.build-id
|
|
|
|
2 0x0000021c 0x20 0x0040021c 0x20 -r-- NOTE .note.ABI-tag
|
|
|
|
1 0x00000200 0x1c 0x00400200 0x1c -r-- PROGBITS .interp
|
|
|
|
0 0x00000000 0x0 0x00000000 0x0 ---- NULL
|
|
|
|
-------------------------------------------------------------
|
|
|
|
nth paddr size vaddr vsize perm type name
|
2022-07-30 23:50:50 +00:00
|
|
|
[Sections]
|
|
|
|
EOF
|
|
|
|
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
|
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2021-08-14 00:20:25 +00:00
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
2021-05-30 08:29:33 +00:00
|
|
|
NAME=grep neg begin
|
2019-12-08 14:31:14 +00:00
|
|
|
FILE=malloc://1024
|
2022-04-12 23:38:45 +00:00
|
|
|
ARGS=-a x86 -b 64
|
2021-05-30 08:29:33 +00:00
|
|
|
CMDS=i~!^size
|
2020-01-17 13:58:18 +00:00
|
|
|
EXPECT=<<EOF
|
2021-05-30 08:29:33 +00:00
|
|
|
fd 3
|
|
|
|
file malloc://1024
|
|
|
|
humansz 1K
|
2021-07-01 08:58:58 +00:00
|
|
|
minopsz 1
|
|
|
|
maxopsz 16
|
2021-09-13 21:17:19 +00:00
|
|
|
invopsz 1
|
2021-05-30 08:29:33 +00:00
|
|
|
mode rwx
|
|
|
|
format any
|
|
|
|
iorw true
|
|
|
|
block 0x100
|
|
|
|
EOF
|
|
|
|
RUN
|
|
|
|
|
|
|
|
NAME=grep neg begin
|
|
|
|
FILE=malloc://1024
|
2022-04-12 23:38:45 +00:00
|
|
|
ARGS=-a x86 -b 64
|
2021-05-30 08:29:33 +00:00
|
|
|
CMDS=i~!^size
|
|
|
|
EXPECT=<<EOF
|
|
|
|
fd 3
|
|
|
|
file malloc://1024
|
|
|
|
humansz 1K
|
2021-07-01 08:58:58 +00:00
|
|
|
minopsz 1
|
|
|
|
maxopsz 16
|
2021-09-13 21:17:19 +00:00
|
|
|
invopsz 1
|
2021-05-30 08:29:33 +00:00
|
|
|
mode rwx
|
|
|
|
format any
|
|
|
|
iorw true
|
|
|
|
block 0x100
|
|
|
|
EOF
|
|
|
|
RUN
|
|
|
|
|
|
|
|
NAME=grep neg
|
|
|
|
FILE=malloc://1024
|
2022-04-12 23:38:45 +00:00
|
|
|
ARGS=-a x86 -b 64
|
2021-05-30 08:29:33 +00:00
|
|
|
CMDS=i~!fd
|
|
|
|
EXPECT=<<EOF
|
|
|
|
file malloc://1024
|
2019-12-08 14:31:14 +00:00
|
|
|
size 0x400
|
2021-05-30 08:29:33 +00:00
|
|
|
humansz 1K
|
2021-07-01 08:58:58 +00:00
|
|
|
minopsz 1
|
|
|
|
maxopsz 16
|
2021-09-13 21:17:19 +00:00
|
|
|
invopsz 1
|
2021-05-30 08:29:33 +00:00
|
|
|
mode rwx
|
|
|
|
format any
|
|
|
|
iorw true
|
|
|
|
block 0x100
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
2019-12-08 14:31:14 +00:00
|
|
|
RUN
|
|
|
|
|
2021-05-30 08:29:33 +00:00
|
|
|
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
|
2019-12-08 14:31:14 +00:00
|
|
|
|
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
|
2020-09-27 08:01:23 +00:00
|
|
|
iorw true
|
2019-12-08 14:31:14 +00:00
|
|
|
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]
|
2021-03-06 22:04:37 +00:00
|
|
|
i~or[1]~any
|
|
|
|
i~or[1]~:1
|
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
|
2021-03-06 22:04:37 +00:00
|
|
|
any
|
|
|
|
true
|
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
|
|
|
|
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
|
2022-07-30 23:50:50 +00:00
|
|
|
FILE=malloc://1024
|
2020-01-17 13:58:18 +00:00
|
|
|
CMDS=<<EOF
|
2022-07-30 23:50:50 +00:00
|
|
|
?e -- alphabetical sort --
|
2019-12-08 14:31:14 +00:00
|
|
|
?e 3\n2\n4\n1~$
|
2022-07-30 23:50:50 +00:00
|
|
|
?e -- inverted alphabetical sort --
|
2019-12-08 14:31:14 +00:00
|
|
|
?e 3\n2\n4\n1~$!
|
2022-07-30 23:50:50 +00:00
|
|
|
?e -- invert (like tac) --
|
|
|
|
?e 3\n2\n4\n1~$!!
|
2020-01-17 13:58:18 +00:00
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
2022-07-30 23:50:50 +00:00
|
|
|
-- alphabetical sort --
|
2019-12-08 14:31:14 +00:00
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
2022-07-30 23:50:50 +00:00
|
|
|
-- inverted alphabetical sort --
|
2019-12-08 14:31:14 +00:00
|
|
|
4
|
|
|
|
3
|
|
|
|
2
|
|
|
|
1
|
2022-07-30 23:50:50 +00:00
|
|
|
-- invert (like tac) --
|
|
|
|
1
|
|
|
|
4
|
|
|
|
2
|
|
|
|
3
|
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
|
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
|
2020-07-28 16:11:14 +00:00
|
|
|
|
|
|
|
NAME=multi-command single-line grep
|
|
|
|
CMDS=<<EOF
|
|
|
|
?e Hello World; ?e 4e2420~4e2420
|
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
|
|
|
Hello World
|
|
|
|
4e2420
|
|
|
|
EOF
|
2021-03-06 22:04:37 +00:00
|
|
|
RUN
|
2021-11-29 23:36:09 +00:00
|
|
|
|
|
|
|
NAME=highlight grep with empty string
|
|
|
|
ARGS=-escr.highlight.grep=true
|
|
|
|
TIMEOUT=2
|
|
|
|
CMDS=<<EOF
|
|
|
|
i~[0]:0
|
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
|
|
|
fd
|
|
|
|
EOF
|
|
|
|
RUN
|
2022-09-19 08:48:44 +00:00
|
|
|
|
|
|
|
NAME=ij.gron
|
|
|
|
FILE=bins/elf/crackme
|
|
|
|
CMDS=<<EOF
|
|
|
|
ij~{=}
|
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
|
|
|
json = {};
|
|
|
|
json.core = {};
|
|
|
|
json.core.type = "EXEC (Executable file)";
|
|
|
|
json.core.file = "bins/elf/crackme";
|
|
|
|
json.core.fd = 3;
|
|
|
|
json.core.size = 7441;
|
|
|
|
json.core.humansz = "7.3K";
|
|
|
|
json.core.iorw = false;
|
|
|
|
json.core.mode = "r-x";
|
|
|
|
json.core.minopsz = 1;
|
|
|
|
json.core.maxopsz = 16;
|
|
|
|
json.core.invopsz = 1;
|
|
|
|
json.core.block = 256;
|
|
|
|
json.core.format = "elf64";
|
|
|
|
json.bin = {};
|
|
|
|
json.bin.arch = "x86";
|
|
|
|
json.bin.baddr = 4194304;
|
|
|
|
json.bin.binsz = 7441;
|
|
|
|
json.bin.bintype = "elf";
|
|
|
|
json.bin.bits = 64;
|
|
|
|
json.bin.canary = false;
|
|
|
|
json.bin.class = "ELF64";
|
|
|
|
json.bin.compiled = "";
|
|
|
|
json.bin.compiler = "GCC: (Debian 4.4.5-8) 4.4.5";
|
|
|
|
json.bin.crypto = false;
|
|
|
|
json.bin.dbg_file = "";
|
|
|
|
json.bin.endian = "little";
|
|
|
|
json.bin.havecode = true;
|
|
|
|
json.bin.guid = "";
|
|
|
|
json.bin.intrp = "/lib64/ld-linux-x86-64.so.2";
|
|
|
|
json.bin.laddr = 0;
|
|
|
|
json.bin.lang = "c";
|
|
|
|
json.bin.linenum = true;
|
|
|
|
json.bin.lsyms = true;
|
|
|
|
json.bin.machine = "AMD x86-64 architecture";
|
|
|
|
json.bin.nx = true;
|
|
|
|
json.bin.os = "linux";
|
|
|
|
json.bin.cc = "";
|
|
|
|
json.bin.pic = false;
|
|
|
|
json.bin.relocs = true;
|
|
|
|
json.bin.relro = "no";
|
|
|
|
json.bin.rpath = "NONE";
|
|
|
|
json.bin.sanitize = false;
|
|
|
|
json.bin.static = false;
|
|
|
|
json.bin.stripped = false;
|
|
|
|
json.bin.subsys = "linux";
|
|
|
|
json.bin.va = true;
|
|
|
|
json.bin.checksums = {};
|
|
|
|
EOF
|
|
|
|
RUN
|
|
|
|
|
|
|
|
NAME=ij.gron.grep
|
|
|
|
FILE=bins/elf/crackme
|
|
|
|
CMDS=<<EOF
|
|
|
|
ij~{=}opsz
|
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
|
|
|
json.core.minopsz = 1;
|
|
|
|
json.core.maxopsz = 16;
|
|
|
|
json.core.invopsz = 1;
|
|
|
|
EOF
|
|
|
|
RUN
|
|
|
|
|
|
|
|
NAME=ij.gron.grep.two
|
|
|
|
FILE=bins/elf/crackme
|
|
|
|
CMDS=<<EOF
|
|
|
|
ij~{=}~opsz
|
|
|
|
EOF
|
|
|
|
EXPECT=<<EOF
|
|
|
|
json.core.minopsz = 1;
|
|
|
|
json.core.maxopsz = 16;
|
|
|
|
json.core.invopsz = 1;
|
|
|
|
EOF
|
|
|
|
RUN
|