From 241a9f1321031ef7dd13835f68201a3b3547dfd9 Mon Sep 17 00:00:00 2001 From: Khairul Azhar Kasmiran Date: Sun, 26 Apr 2026 16:25:56 +0800 Subject: [PATCH] tools/rz: Revert weird-looking test (#6288) * tools/rz: Revert weird-looking test * Do `dos2unix` on whole file --- test/db/tools/rz | 1268 +++++++++++++++++++++++----------------------- 1 file changed, 639 insertions(+), 629 deletions(-) diff --git a/test/db/tools/rz b/test/db/tools/rz index c82645ef24..f14d0cbedd 100644 --- a/test/db/tools/rz +++ b/test/db/tools/rz @@ -1,166 +1,176 @@ -NAME=rz = -FILE== -CMDS=< [0x00000000]>  [0x00000000]>  [0x00000000]> [0x00000000]>   [0x00000000]> q [0x00000000]> q [0x00000000]> q EOF -RUN - -NAME=rizin load arm elf with thumb entry -FILE== -CMDS=!rizin -qq bins/arm/elf/hello_world-linaro-201902 -EXPECT= -EXPECT_ERR= -RUN - -NAME=prompt settings -TOOL=rizin -FILE=bins/elf/hello_world -CMDS=< \ne scr.prompt.file=true\ne scr.prompt.flag=true\nsd 1\ne scr.prompt.flag.only=true\ne scr.prompt.sect=true\nq\n -ARGS=-e cfg.fortunes=0 -e scr.color=0 +RUN + +NAME=rizin load arm elf with thumb entry +FILE== +CMDS=!rizin -qq bins/arm/elf/hello_world-linaro-201902 +EXPECT= +EXPECT_ERR= +RUN + +NAME=prompt settings +TOOL=rizin +FILE=bins/elf/hello_world +CMDS=< \ne scr.prompt.file=true\ne scr.prompt.flag=true\nsd 1\ne scr.prompt.flag.only=true\ne scr.prompt.sect=true\nq\n +ARGS=-e cfg.fortunes=0 -e scr.color=0 EXPECT=< [0x000006a0]>  [0x000006a0]>  [0x000006a0]> [0x000006a0]>   [0x000006a0]> e [0x000006a0]> e  [0x000006a0]> e [0x000006a0]> e   [0x000006a0]> e s [0x000006a0]> e s  [0x000006a0]> e sc [0x000006a0]> e sc  [0x000006a0]> e scr [0x000006a0]> e scr  [0x000006a0]> e scr. [0x000006a0]> e scr.  [0x000006a0]> e scr.p [0x000006a0]> e scr.p  [0x000006a0]> e scr.pr [0x000006a0]> e scr.pr  [0x000006a0]> e scr.pro [0x000006a0]> e scr.pro  [0x000006a0]> e scr.prom [0x000006a0]> e scr.prom  [0x000006a0]> e scr.promp [0x000006a0]> e scr.promp  [0x000006a0]> e scr.prompt [0x000006a0]> e scr.prompt  [0x000006a0]> e scr.prompt. [0x000006a0]> e scr.prompt.  [0x000006a0]> e scr.prompt.f [0x000006a0]> e scr.prompt.f  [0x000006a0]> e scr.prompt.fi [0x000006a0]> e scr.prompt.fi  [0x000006a0]> e scr.prompt.fil [0x000006a0]> e scr.prompt.fil  [0x000006a0]> e scr.prompt.file [0x000006a0]> e scr.prompt.file  [0x000006a0]> e scr.prompt.file= [0x000006a0]> e scr.prompt.file=  [0x000006a0]> e scr.prompt.file=t [0x000006a0]> e scr.prompt.file=t  [0x000006a0]> e scr.prompt.file=tr [0x000006a0]> e scr.prompt.file=tr  [0x000006a0]> e scr.prompt.file=tru [0x000006a0]> e scr.prompt.file=tru  [0x000006a0]> e scr.prompt.file=true [0x000006a0]> e scr.prompt.file=true [0x000006a0]> e scr.prompt.file=true @@ -170,477 +180,477 @@ EXPECT=< [hello_world:entry0 + 1]>   [hello_world:entry0 + 1]> e [hello_world:entry0 + 1]> e  [hello_world:entry0 + 1]> e [hello_world:entry0 + 1]> e   [hello_world:entry0 + 1]> e s [hello_world:entry0 + 1]> e s  [hello_world:entry0 + 1]> e sc [hello_world:entry0 + 1]> e sc  [hello_world:entry0 + 1]> e scr [hello_world:entry0 + 1]> e scr  [hello_world:entry0 + 1]> e scr. [hello_world:entry0 + 1]> e scr.  [hello_world:entry0 + 1]> e scr.p [hello_world:entry0 + 1]> e scr.p  [hello_world:entry0 + 1]> e scr.pr [hello_world:entry0 + 1]> e scr.pr  [hello_world:entry0 + 1]> e scr.pro [hello_world:entry0 + 1]> e scr.pro  [hello_world:entry0 + 1]> e scr.prom [hello_world:entry0 + 1]> e scr.prom  [hello_world:entry0 + 1]> e scr.promp [hello_world:entry0 + 1]> e scr.promp  [hello_world:entry0 + 1]> e scr.prompt [hello_world:entry0 + 1]> e scr.prompt  [hello_world:entry0 + 1]> e scr.prompt. [hello_world:entry0 + 1]> e scr.prompt.  [hello_world:entry0 + 1]> e scr.prompt.s [hello_world:entry0 + 1]> e scr.prompt.s  [hello_world:entry0 + 1]> e scr.prompt.se [hello_world:entry0 + 1]> e scr.prompt.se  [hello_world:entry0 + 1]> e scr.prompt.sec [hello_world:entry0 + 1]> e scr.prompt.sec  [hello_world:entry0 + 1]> e scr.prompt.sect [hello_world:entry0 + 1]> e scr.prompt.sect  [hello_world:entry0 + 1]> e scr.prompt.sect= [hello_world:entry0 + 1]> e scr.prompt.sect=  [hello_world:entry0 + 1]> e scr.prompt.sect=t [hello_world:entry0 + 1]> e scr.prompt.sect=t  [hello_world:entry0 + 1]> e scr.prompt.sect=tr [hello_world:entry0 + 1]> e scr.prompt.sect=tr  [hello_world:entry0 + 1]> e scr.prompt.sect=tru [hello_world:entry0 + 1]> e scr.prompt.sect=tru  [hello_world:entry0 + 1]> e scr.prompt.sect=true [hello_world:entry0 + 1]> e scr.prompt.sect=true [hello_world:entry0 + 1]> e scr.prompt.sect=true  [hello_world:.text:entry0 + 1]> [hello_world:.text:entry0 + 1]>   [hello_world:.text:entry0 + 1]> q [hello_world:.text:entry0 + 1]> q [hello_world:.text:entry0 + 1]> q EOF -RUN - -NAME=color prompt -FILE== -CMDS=!rizin -e cfg.fortunes=0 -e scr.color=1 -N -c "< \nq\n" = +RUN + +NAME=color prompt +FILE== +CMDS=!rizin -e cfg.fortunes=0 -e scr.color=1 -N -c "< \nq\n" = EXPECT=< [0x00000000]>  [0x00000000]>  [0x00000000]> [0x00000000]>   [0x00000000]> q [0x00000000]> q [0x00000000]> q EOF -RUN - -NAME=read from stdin -FILE=-- -CMDS=echo \r\n | rizin -N -e scr.color=0 -qc "px 16" - -EXPECT=< hex ; rz-ax 10 - hex -> int ; rz-ax 0xa - -int -> hex ; rz-ax -77 - -hex -> int ; rz-ax 0xffffffb3 - int -> bin ; rz-ax b30 - int -> ternary ; rz-ax t42 - bin -> int ; rz-ax 1010d - ternary -> int ; rz-ax 1010dt - float -> hex ; rz-ax 3.33f - hex -> float ; rz-ax Fx40551ed8 - oct -> hex ; rz-ax 35o - hex -> oct ; rz-ax Ox12 (O is a letter) - bin -> hex ; rz-ax 1100011b - hex -> bin ; rz-ax Bx63 - ternary -> hex ; rz-ax 212t - hex -> ternary ; rz-ax Tx23 - raw -> hex ; rz-ax -S < /binfile - hex -> raw ; rz-ax -s 414141 - = base   ; rz-ax =10 0x46 -> output in base 10 - -l  ; append newline to output (for -E/-D/-r/.. - -a show ascii table ; rz-ax -a - -b bin -> str ; rz-ax -b 01000101 01110110 - -B str -> bin ; rz-ax -B hello - -d force integer ; rz-ax -d 3 -> 3 instead of 0x3 - -e swap endianness ; rz-ax -e 0x33 - -D base64 decode - -E base64 encode - -f floating point ; rz-ax -f 6.3+2.1 - -F stdin slurp code hex ; rz-ax -F < shellcode.[c/py/js] - -h show this help ; rz-ax -h - -i dump as C byte array ; rz-ax -i < bytes - -I IP address <-> LONG ; rz-ax -I 3530468537 - -k keep base ; rz-ax -k 33+3 -> 36 - -L bin -> hex(bignum) ; rz-ax -L 111111111 # 0x1ff - -n int value -> hexpairs ; rz-ax -n 0x1234 # 34120000 - -o octalstr -> raw ; rz-ax -o \162 \172 # rz - -N binary number ; rz-ax -N 0x1234 # \x34\x12\x00\x00 - -r rz style output ; rz-ax -r 0x1234 - -s hexstr -> raw ; rz-ax -s 43 4a 50 - -S raw -> hexstr ; rz-ax -S < /bin/ls > ls.hex - -t Unix tstamp -> str ; rz-ax -t 1234567890 - -m MS-DOS tstamp -> str ; rz-ax -m 1234567890 - -W Win32 tstamp -> str ; rz-ax -W 1234567890 - -x hash string ; rz-ax -x linux osx - -u units ; rz-ax -u 389289238 # 317.0M - -w signed word ; rz-ax -w 16 0xffff - -v version ; rz-ax -v - -p position of set bits ; rz-ax -p 0xb3 -EOF -RUN - -NAME=rz-bin -h -TOOL=rz-bin -ARGS=-h -EXIT_STATUS=1 -EXPECT=<_) - -b bits  Set bits (32, 64 ...) - -B addr  Override base address (pie bins) - -c List classes - -cc List classes in header format - -C fmt:C:D  Create [elf,mach0,pe] with Code and Data hexpairs (see -a) - -d Show debug/dwarf information - -dd Load debug/dwarf information from debuginfod server - -D lang name Demangle symbol name (-D all for bin.demangle=true) - -e Entrypoint - -ee Constructor/destructor entrypoints - -E Globally exportable symbols - -f mach  Select sub-binary for the machine [mach]. - -F binfmt  Force to use that bin plugin (ignore header check) - -g Same as -SMZIHVResizcld -SS -SSS -ee (show all info) - -G addr  Load address . offset to header - -h Show this help - -H Header fields - -i Import (symbols imported from libraries) - -I Binary info - -j Output in JSON - -k sdb-query Run sdb query. for example: '*' - -K algo  Calculate checksums (md5, sha1, ..) - -l Linked libraries - -L [plugin]  List supported bin plugins or plugin details - -m addr  Show source line at addr - -M Main (show address of main symbol) - -n str  Show section, symbol or import named str - -N min:max  Force min:max number of chars per string (see -z and -zz) - -o str  Output file/folder for write operations (out by default) - -O str  Write/extract operations (-O help) - -p Show physical addresses - -P Show debug/pdb information - -PP Download pdb file for binary - -q Quiet mode, just show fewer data - -qq Show less info (no offset/size for -z for ex.) - -Q Show load address used by dlopen (non-aslr libs) - -r Show output in rizin format - -R Show relocations - -s Symbols - -S Sections - -SS Segments - -SSS Sections mapping to segments - -T Display file signature - -u Unfiltered (no rename duplicated symbols/sections) - -U Resources - -v Show version information - -V Show binary version information - -w Display try/catch blocks - -x Extract bins contained in file - -Y Calculate all the possibles base address candidates of a firmware bin - -z Show strings (from data section) - -zz Show strings (from raw strings from bin) - -zzz Dump raw strings to stdout (for huge files) - -Z Guess size of binary program -Environment: - RZ_BIN_CODESIGN_VERBOSE: # make code signatures verbose - RZ_BIN_DEBUGINFOD_URLS: e bin.dbginfo.debuginfod_urls # use alternative debuginfod server - RZ_BIN_DEMANGLE=0: e bin.demangle # do not demangle symbols - RZ_BIN_LANG: e bin.lang # assume lang for demangling - RZ_BIN_MAXSTRBUF: e search.str.max_length # specify maximum buffer size - RZ_BIN_PDBSERVER: e pdb.server # use alternative PDB server - RZ_BIN_PREFIX: e bin.prefix # prefix symbols/sections/relocs with a specific string - RZ_BIN_STRFILTER: e bin.str.filter # rizin -qc 'e bin.str.filter=??' - - RZ_BIN_STRPURGE: e bin.str.purge # try to purge false positives - RZ_BIN_SYMSTORE: e pdb.symstore # path to downstream PDB symbol store - RZ_CONFIG: # config file - RZ_COLOR: # enables/disables colors support - RZ_UTF8: # enables/disables utf8 support - RZ_NOPLUGINS: # do not load plugins -EOF -RUN - -NAME=rz-diff -h -TOOL=rz-diff -ARGS=-h -EXPECT=< - -a arch  Specify architecture plugin to use (x86, arm, ..) - -b bits  Specify register size for arch (16 (thumb), 32, 64, ..) - -d myers  Compute edit distance using Eugene W. Myers' O(ND) algorithm (no substitution) - -d leven  Compute edit distance using Levenshtein O(N^2) algorithm (with substitution) - -d ssdeep  Compute edit distance using Context triggered piecewise hashing comparison - -i Use command line arguments instead of files (only for -d) - -H Hexadecimal visual mode - -h Show this help - -j JSON output - -q Quiet output - -v Show version information - -V Be more verbose (stderr output) - -K theme  Set a give color theme (see rizin 'eco' command) - -e k=v  Set an evaluable config variable - -A Compare virtual and physical addresses - -B Run 'aaa' when loading the bin - -C Disable colors - -T Show timestamp information - -S WxH  Set the width and height of the terminal for visual mode - -0 cmd  Input for file0 when option -t 'commands' is given. -  The same value will be set for file1, if -1 is not set. - -1 cmd  Input for file1 when option -t 'commands' is given. - -t bytes  Compare raw bytes in the files (only for small files) - -t lines  Compare text files - -t functions Compare functions found in the files -  optional -0 to compare only one function - -t classes  Compare classes found in the files - -t command  Compare command output returned when executed in both files -  requires -0 and -1 is optional - -t entries  Compare entries found in the files - -t fields  Compare fields found in the files - -t graphs  Compare 2 functions and outputs in graphviz/dot format -  requires -0 and -1 is optional - -t imports  Compare imports found in the files - -t libraries Compare libraries found in the files - -t sections  Compare sections found in the files - -t strings  Compare strings found in the files - -t symbols  Compare symbols found in the files -Palette colors can be changed by adding the following lines inside the $HOME/.rizinrc file - ec diff.unknown blue | offset color - ec diff.match green | match color - ec diff.unmatch red | mismatch color -Environment variables - RZ_COLOR | enables/disables colors support -EOF -RUN - -NAME=rz-find -h -TOOL=rz-find -ARGS=-h -EXPECT=< hex ; rz-ax 10 + hex -> int ; rz-ax 0xa + -int -> hex ; rz-ax -77 + -hex -> int ; rz-ax 0xffffffb3 + int -> bin ; rz-ax b30 + int -> ternary ; rz-ax t42 + bin -> int ; rz-ax 1010d + ternary -> int ; rz-ax 1010dt + float -> hex ; rz-ax 3.33f + hex -> float ; rz-ax Fx40551ed8 + oct -> hex ; rz-ax 35o + hex -> oct ; rz-ax Ox12 (O is a letter) + bin -> hex ; rz-ax 1100011b + hex -> bin ; rz-ax Bx63 + ternary -> hex ; rz-ax 212t + hex -> ternary ; rz-ax Tx23 + raw -> hex ; rz-ax -S < /binfile + hex -> raw ; rz-ax -s 414141 + = base   ; rz-ax =10 0x46 -> output in base 10 + -l  ; append newline to output (for -E/-D/-r/.. + -a show ascii table ; rz-ax -a + -b bin -> str ; rz-ax -b 01000101 01110110 + -B str -> bin ; rz-ax -B hello + -d force integer ; rz-ax -d 3 -> 3 instead of 0x3 + -e swap endianness ; rz-ax -e 0x33 + -D base64 decode + -E base64 encode + -f floating point ; rz-ax -f 6.3+2.1 + -F stdin slurp code hex ; rz-ax -F < shellcode.[c/py/js] + -h show this help ; rz-ax -h + -i dump as C byte array ; rz-ax -i < bytes + -I IP address <-> LONG ; rz-ax -I 3530468537 + -k keep base ; rz-ax -k 33+3 -> 36 + -L bin -> hex(bignum) ; rz-ax -L 111111111 # 0x1ff + -n int value -> hexpairs ; rz-ax -n 0x1234 # 34120000 + -o octalstr -> raw ; rz-ax -o \162 \172 # rz + -N binary number ; rz-ax -N 0x1234 # \x34\x12\x00\x00 + -r rz style output ; rz-ax -r 0x1234 + -s hexstr -> raw ; rz-ax -s 43 4a 50 + -S raw -> hexstr ; rz-ax -S < /bin/ls > ls.hex + -t Unix tstamp -> str ; rz-ax -t 1234567890 + -m MS-DOS tstamp -> str ; rz-ax -m 1234567890 + -W Win32 tstamp -> str ; rz-ax -W 1234567890 + -x hash string ; rz-ax -x linux osx + -u units ; rz-ax -u 389289238 # 317.0M + -w signed word ; rz-ax -w 16 0xffff + -v version ; rz-ax -v + -p position of set bits ; rz-ax -p 0xb3 +EOF +RUN + +NAME=rz-bin -h +TOOL=rz-bin +ARGS=-h +EXIT_STATUS=1 +EXPECT=<_) + -b bits  Set bits (32, 64 ...) + -B addr  Override base address (pie bins) + -c List classes + -cc List classes in header format + -C fmt:C:D  Create [elf,mach0,pe] with Code and Data hexpairs (see -a) + -d Show debug/dwarf information + -dd Load debug/dwarf information from debuginfod server + -D lang name Demangle symbol name (-D all for bin.demangle=true) + -e Entrypoint + -ee Constructor/destructor entrypoints + -E Globally exportable symbols + -f mach  Select sub-binary for the machine [mach]. + -F binfmt  Force to use that bin plugin (ignore header check) + -g Same as -SMZIHVResizcld -SS -SSS -ee (show all info) + -G addr  Load address . offset to header + -h Show this help + -H Header fields + -i Import (symbols imported from libraries) + -I Binary info + -j Output in JSON + -k sdb-query Run sdb query. for example: '*' + -K algo  Calculate checksums (md5, sha1, ..) + -l Linked libraries + -L [plugin]  List supported bin plugins or plugin details + -m addr  Show source line at addr + -M Main (show address of main symbol) + -n str  Show section, symbol or import named str + -N min:max  Force min:max number of chars per string (see -z and -zz) + -o str  Output file/folder for write operations (out by default) + -O str  Write/extract operations (-O help) + -p Show physical addresses + -P Show debug/pdb information + -PP Download pdb file for binary + -q Quiet mode, just show fewer data + -qq Show less info (no offset/size for -z for ex.) + -Q Show load address used by dlopen (non-aslr libs) + -r Show output in rizin format + -R Show relocations + -s Symbols + -S Sections + -SS Segments + -SSS Sections mapping to segments + -T Display file signature + -u Unfiltered (no rename duplicated symbols/sections) + -U Resources + -v Show version information + -V Show binary version information + -w Display try/catch blocks + -x Extract bins contained in file + -Y Calculate all the possibles base address candidates of a firmware bin + -z Show strings (from data section) + -zz Show strings (from raw strings from bin) + -zzz Dump raw strings to stdout (for huge files) + -Z Guess size of binary program +Environment: + RZ_BIN_CODESIGN_VERBOSE: # make code signatures verbose + RZ_BIN_DEBUGINFOD_URLS: e bin.dbginfo.debuginfod_urls # use alternative debuginfod server + RZ_BIN_DEMANGLE=0: e bin.demangle # do not demangle symbols + RZ_BIN_LANG: e bin.lang # assume lang for demangling + RZ_BIN_MAXSTRBUF: e search.str.max_length # specify maximum buffer size + RZ_BIN_PDBSERVER: e pdb.server # use alternative PDB server + RZ_BIN_PREFIX: e bin.prefix # prefix symbols/sections/relocs with a specific string + RZ_BIN_STRFILTER: e bin.str.filter # rizin -qc 'e bin.str.filter=??' - + RZ_BIN_STRPURGE: e bin.str.purge # try to purge false positives + RZ_BIN_SYMSTORE: e pdb.symstore # path to downstream PDB symbol store + RZ_CONFIG: # config file + RZ_COLOR: # enables/disables colors support + RZ_UTF8: # enables/disables utf8 support + RZ_NOPLUGINS: # do not load plugins +EOF +RUN + +NAME=rz-diff -h +TOOL=rz-diff +ARGS=-h +EXPECT=< + -a arch  Specify architecture plugin to use (x86, arm, ..) + -b bits  Specify register size for arch (16 (thumb), 32, 64, ..) + -d myers  Compute edit distance using Eugene W. Myers' O(ND) algorithm (no substitution) + -d leven  Compute edit distance using Levenshtein O(N^2) algorithm (with substitution) + -d ssdeep  Compute edit distance using Context triggered piecewise hashing comparison + -i Use command line arguments instead of files (only for -d) + -H Hexadecimal visual mode + -h Show this help + -j JSON output + -q Quiet output + -v Show version information + -V Be more verbose (stderr output) + -K theme  Set a give color theme (see rizin 'eco' command) + -e k=v  Set an evaluable config variable + -A Compare virtual and physical addresses + -B Run 'aaa' when loading the bin + -C Disable colors + -T Show timestamp information + -S WxH  Set the width and height of the terminal for visual mode + -0 cmd  Input for file0 when option -t 'commands' is given. +  The same value will be set for file1, if -1 is not set. + -1 cmd  Input for file1 when option -t 'commands' is given. + -t bytes  Compare raw bytes in the files (only for small files) + -t lines  Compare text files + -t functions Compare functions found in the files +  optional -0 to compare only one function + -t classes  Compare classes found in the files + -t command  Compare command output returned when executed in both files +  requires -0 and -1 is optional + -t entries  Compare entries found in the files + -t fields  Compare fields found in the files + -t graphs  Compare 2 functions and outputs in graphviz/dot format +  requires -0 and -1 is optional + -t imports  Compare imports found in the files + -t libraries Compare libraries found in the files + -t sections  Compare sections found in the files + -t strings  Compare strings found in the files + -t symbols  Compare symbols found in the files +Palette colors can be changed by adding the following lines inside the $HOME/.rizinrc file + ec diff.unknown blue | offset color + ec diff.match green | match color + ec diff.unmatch red | mismatch color +Environment variables + RZ_COLOR | enables/disables colors support +EOF +RUN + +NAME=rz-find -h +TOOL=rz-find +ARGS=-h +EXPECT=<