rizin/test/db/cmd/basic
Rot127 d79ff51157
librz/bin: define string search parameters in plugins (#5406)
* Clarify docs of raw_alignment

* Set Go and Rust string encoding for binary string search.

* Add detailed doxygen about string search in bin plugins.

* Add the number string code points as detail to string search hits.

* Add helper to check if string encoding needs scanning.

* Add helper to generate a string wildcard pattern.

The pattern is supposed to match any human readable string.
Before the string search refactor there was no explicit definition
what characters mark the end of a string and which ones don't.

This pattern should match strings of the old interpretation.

* Enable the RzBin plugin to search strings with direct matching instead of scanning.

This significantly speeds up the string search when a binary is opened.
The prerequisite is that the plugin specifies the string encoding.

* Enforce UTF-8 for initial string search.

* Add custom string search for PE files.

* Clean up and document rz_utf8_encode

* Don't demote explicit UTF-8 encoding to ASCII.

* Increase min JIT stack size due to not reproducable search results.

* Simplify wildcard regex pattern.
2025-10-08 10:02:32 +08:00

70 lines
916 B
Text

NAME=t/basic
FILE=malloc://1024
CMDS=<<EOF
w test
w test @ 333
w test @ 666
echo
e search.in=block
b 777
/z test
EOF
EXPECT=<<EOF
0x00000000 4 hit.string.ascii.0 4
0x0000014d 4 hit.string.ascii.1 4
0x0000029a 4 hit.string.ascii.2 4
EOF
RUN
NAME=t/basic
FILE=bins/elf/analysis/x86-helloworld-gcc
CMDS=<<EOF
b 0x100
e search.from=0x08048301
e search.to=0x8048390
/x b4960408ffd0c9c3
EOF
EXPECT=<<EOF
0x08048362 8 hit.bytes.0
EOF
RUN
NAME=t/basic
FILE=bins/elf/analysis/x86-helloworld-gcc
CMDS=<<EOF
b 100
e search.from=0x08048301
e search.to=0x8048390
/x b4960408ffd0c9c3
EOF
EXPECT=<<EOF
0x08048362 8 hit.bytes.0
EOF
RUN
NAME=overlap0
FILE==
CMDS=<<EOF
w AAAA
/x 4141
EOF
EXPECT=<<EOF
0x00000000 2 hit.bytes.0
0x00000002 2 hit.bytes.1
EOF
RUN
NAME=overlap1
FILE==
CMDS=<<EOF
e search.overlap=true
w AAAA
/x 4141
EOF
EXPECT=<<EOF
0x00000000 2 hit.bytes.0
0x00000001 2 hit.bytes.1
0x00000002 2 hit.bytes.2
EOF
RUN