From 10c86eddbf189aeda13147a0208ee0ab4c1468f9 Mon Sep 17 00:00:00 2001 From: Rot127 Date: Tue, 10 Dec 2024 15:00:36 -0500 Subject: [PATCH] Add RzShell handlers for all search commands. --- librz/core/cmd/cmd_search.c | 91 ++++++ librz/core/cmd_descs/cmd_descs.c | 411 ++++++++++++++++++++++++++- librz/core/cmd_descs/cmd_descs.h | 40 ++- librz/core/cmd_descs/cmd_descs.yaml | 6 +- librz/core/cmd_descs/cmd_search.yaml | 320 ++++++++++++++++++++- librz/core/cmd_descs/cmd_seek.yaml | 4 - 6 files changed, 846 insertions(+), 26 deletions(-) diff --git a/librz/core/cmd/cmd_search.c b/librz/core/cmd/cmd_search.c index 1755700602b..772b46ecb7b 100644 --- a/librz/core/cmd/cmd_search.c +++ b/librz/core/cmd/cmd_search.c @@ -2,6 +2,7 @@ // SPDX-License-Identifier: LGPL-3.0-only #include +#include #include #include #include @@ -1724,3 +1725,93 @@ static void __core_cmd_search_asm_byteswap(RzCore *core, int nth) { } RZ_IPI int rz_cmd_search(void *data, const char *input) { return RZ_CMD_STATUS_ERROR; } + +// "/a" +RZ_IPI RzCmdStatus rz_cmd_search_assemble_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/ca" +RZ_IPI RzCmdStatus rz_cmd_search_aes_key_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/cp" +RZ_IPI RzCmdStatus rz_cmd_search_private_key_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/e" +RZ_IPI RzCmdStatus rz_cmd_search_regex_raw_sensitive_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/ei" +RZ_IPI RzCmdStatus rz_cmd_search_regex_raw_insensitive_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/g" +RZ_IPI RzCmdStatus rz_cmd_search_graph_path_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/gg" +RZ_IPI RzCmdStatus rz_cmd_search_graph_path_follow_jumps_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/h" +RZ_IPI RzCmdStatus rz_cmd_search_hash_block_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/m" +RZ_IPI RzCmdStatus rz_cmd_search_magic_const_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/E" +RZ_IPI RzCmdStatus rz_cmd_search_entropy_section_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/r" +RZ_IPI RzCmdStatus rz_cmd_search_reference_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/v1" +RZ_IPI RzCmdStatus rz_cmd_search_value_8_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/v2" +RZ_IPI RzCmdStatus rz_cmd_search_value_16_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/v4" +RZ_IPI RzCmdStatus rz_cmd_search_value_32_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/v8" +RZ_IPI RzCmdStatus rz_cmd_search_value_64_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/x" +RZ_IPI RzCmdStatus rz_cmd_search_hex_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/z" +RZ_IPI RzCmdStatus rz_cmd_search_string_sensitive_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} + +// "/zi" +RZ_IPI RzCmdStatus rz_cmd_search_string_insensitive_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) { + return RZ_CMD_STATUS_NONEXISTINGCMD; +} diff --git a/librz/core/cmd_descs/cmd_descs.c b/librz/core/cmd_descs/cmd_descs.c index 4be80561e70..9ee2d2f8712 100644 --- a/librz/core/cmd_descs/cmd_descs.c +++ b/librz/core/cmd_descs/cmd_descs.c @@ -14,6 +14,9 @@ static const RzCmdDescDetail alias_details[2]; static const RzCmdDescDetail oparen__details[2]; static const RzCmdDescDetail pointer_details[2]; static const RzCmdDescDetail interpret_macro_multiple_details[2]; +static const RzCmdDescDetail cmd_search_hash_block_details[2]; +static const RzCmdDescDetail slash_v_details[2]; +static const RzCmdDescDetail cmd_search_hex_details[2]; static const RzCmdDescDetail base64_encode_details[2]; static const RzCmdDescDetail base64_decode_details[2]; static const RzCmdDescDetail print_boundaries_prot_details[2]; @@ -105,10 +108,25 @@ static const RzCmdDescArg interpret_output_args[2]; static const RzCmdDescArg interpret_pipe_args[2]; static const RzCmdDescArg interpret_macro_args[4]; static const RzCmdDescArg interpret_macro_multiple_args[4]; +static const RzCmdDescArg cmd_search_assemble_args[2]; +static const RzCmdDescArg cmd_search_regex_raw_sensitive_args[2]; +static const RzCmdDescArg cmd_search_regex_raw_insensitive_args[2]; +static const RzCmdDescArg cmd_search_graph_path_args[3]; +static const RzCmdDescArg cmd_search_graph_path_follow_jumps_args[3]; +static const RzCmdDescArg cmd_search_hash_block_args[3]; +static const RzCmdDescArg cmd_search_entropy_section_args[2]; +static const RzCmdDescArg cmd_search_reference_args[2]; static const RzCmdDescArg cmd_info_gadget_args[2]; static const RzCmdDescArg cmd_search_gadget_args[2]; static const RzCmdDescArg cmd_query_gadget_args[2]; static const RzCmdDescArg cmd_detail_gadget_args[2]; +static const RzCmdDescArg cmd_search_value_8_args[2]; +static const RzCmdDescArg cmd_search_value_16_args[2]; +static const RzCmdDescArg cmd_search_value_32_args[2]; +static const RzCmdDescArg cmd_search_value_64_args[2]; +static const RzCmdDescArg cmd_search_hex_args[2]; +static const RzCmdDescArg cmd_search_string_sensitive_args[3]; +static const RzCmdDescArg cmd_search_string_insensitive_args[3]; static const RzCmdDescArg remote_args[3]; static const RzCmdDescArg remote_send_args[3]; static const RzCmdDescArg remote_add_args[2]; @@ -1376,11 +1394,180 @@ static const RzCmdDescHelp interpret_macro_multiple_help = { .args = interpret_macro_multiple_args, }; -static const RzCmdDescHelp cmd_search_help = { +static const RzCmdDescHelp slash__help = { .summary = "Search for bytes, regexps, patterns, ..", }; +static const RzCmdDescArg cmd_search_assemble_args[] = { + { + .name = "opcodes", + .type = RZ_CMD_ARG_TYPE_STRING, + .flags = RZ_CMD_ARG_FLAG_LAST, + + }, + { 0 }, +}; +static const RzCmdDescHelp cmd_search_assemble_help = { + .summary = "Assemble the opcodes and search its bytes", + .args = cmd_search_assemble_args, +}; + +static const RzCmdDescHelp slash_c_help = { + .summary = "Cryptographic material search", +}; +static const RzCmdDescArg cmd_search_aes_key_args[] = { + { 0 }, +}; +static const RzCmdDescHelp cmd_search_aes_key_help = { + .summary = "Search for AES keys", + .args = cmd_search_aes_key_args, +}; + +static const RzCmdDescArg cmd_search_private_key_args[] = { + { 0 }, +}; +static const RzCmdDescHelp cmd_search_private_key_help = { + .summary = "Search for private RSA/ECC/EdDSA keys", + .args = cmd_search_private_key_args, +}; + +static const RzCmdDescHelp slash_e_help = { + .summary = "Raw regular expression search.", +}; +static const RzCmdDescArg cmd_search_regex_raw_sensitive_args[] = { + { + .name = "regex", + .type = RZ_CMD_ARG_TYPE_STRING, + .flags = RZ_CMD_ARG_FLAG_LAST, + + }, + { 0 }, +}; +static const RzCmdDescHelp cmd_search_regex_raw_sensitive_help = { + .summary = "Raw regular expression search (case-sensitive).", + .args = cmd_search_regex_raw_sensitive_args, +}; + +static const RzCmdDescArg cmd_search_regex_raw_insensitive_args[] = { + { + .name = "regex", + .type = RZ_CMD_ARG_TYPE_STRING, + .flags = RZ_CMD_ARG_FLAG_LAST, + + }, + { 0 }, +}; +static const RzCmdDescHelp cmd_search_regex_raw_insensitive_help = { + .summary = "Raw regular expression search (case-insensitive).", + .args = cmd_search_regex_raw_insensitive_args, +}; + +static const RzCmdDescHelp slash_g_help = { + .summary = "Search for all graph paths A to B (/gg follow jumps, see search.count and analysis.depth).", +}; +static const RzCmdDescArg cmd_search_graph_path_args[] = { + { + .name = "from", + .type = RZ_CMD_ARG_TYPE_RZNUM, + + }, + { + .name = "to", + .type = RZ_CMD_ARG_TYPE_RZNUM, + .flags = RZ_CMD_ARG_FLAG_LAST, + + }, + { 0 }, +}; +static const RzCmdDescHelp cmd_search_graph_path_help = { + .summary = "Search for all graph paths A to B (does not follow jumps).", + .args = cmd_search_graph_path_args, +}; + +static const RzCmdDescArg cmd_search_graph_path_follow_jumps_args[] = { + { + .name = "from", + .type = RZ_CMD_ARG_TYPE_RZNUM, + + }, + { + .name = "to", + .type = RZ_CMD_ARG_TYPE_RZNUM, + .flags = RZ_CMD_ARG_FLAG_LAST, + + }, + { 0 }, +}; +static const RzCmdDescHelp cmd_search_graph_path_follow_jumps_help = { + .summary = "Search for all graph paths A to B (follow jumps, see `search.count` and `analysis.depth`).", + .args = cmd_search_graph_path_follow_jumps_args, +}; + +static const RzCmdDescDetailEntry cmd_search_hash_block_Usage_space_example_detail_entries[] = { + { .text = "MD5 hash search within blocks of 512 bytes.", .arg_str = NULL, .comment = "/h md5 0bc8f8c426b74ffaedac8330a7464014 @! 512" }, + { 0 }, +}; +static const RzCmdDescDetail cmd_search_hash_block_details[] = { + { .name = "Usage example", .entries = cmd_search_hash_block_Usage_space_example_detail_entries }, + { 0 }, +}; +static const RzCmdDescArg cmd_search_hash_block_args[] = { + { + .name = "algo", + .type = RZ_CMD_ARG_TYPE_STRING, + + }, + { + .name = "hash", + .type = RZ_CMD_ARG_TYPE_STRING, + .flags = RZ_CMD_ARG_FLAG_LAST, + + }, + { 0 }, +}; +static const RzCmdDescHelp cmd_search_hash_block_help = { + .summary = "Search for blocks that have the same hash (see also command `ph`).", + .details = cmd_search_hash_block_details, + .args = cmd_search_hash_block_args, +}; + +static const RzCmdDescArg cmd_search_magic_const_args[] = { + { 0 }, +}; +static const RzCmdDescHelp cmd_search_magic_const_help = { + .summary = "Magic constants search.", + .args = cmd_search_magic_const_args, +}; + +static const RzCmdDescArg cmd_search_entropy_section_args[] = { + { + .name = "threshold", + .type = RZ_CMD_ARG_TYPE_STRING, + .flags = RZ_CMD_ARG_FLAG_LAST, + + }, + { 0 }, +}; +static const RzCmdDescHelp cmd_search_entropy_section_help = { + .summary = "Entropy search on sections by grouping in blocks.", + .args = cmd_search_entropy_section_args, +}; + +static const RzCmdDescArg cmd_search_reference_args[] = { + { + .name = "address", + .type = RZ_CMD_ARG_TYPE_RZNUM, + .flags = RZ_CMD_ARG_FLAG_LAST, + + }, + { 0 }, +}; +static const RzCmdDescHelp cmd_search_reference_help = { + .summary = "Reference search.", + .args = cmd_search_reference_args, +}; + static const RzCmdDescHelp slash_R_help = { - .summary = "List ROP Gadgets", + .summary = "Search, List, Query for ROP Gadgets", }; static const RzCmdDescArg cmd_info_gadget_args[] = { { @@ -1443,6 +1630,140 @@ static const RzCmdDescHelp cmd_detail_gadget_help = { .args = cmd_detail_gadget_args, }; +static const RzCmdDescDetailEntry slash_v_Usage_space_example_detail_entries[] = { + { .text = "512 value search of its 32-bit representation", .arg_str = NULL, .comment = "/v4 512" }, + { 0 }, +}; +static const RzCmdDescDetail slash_v_details[] = { + { .name = "Usage example", .entries = slash_v_Usage_space_example_detail_entries }, + { 0 }, +}; +static const RzCmdDescHelp slash_v_help = { + .summary = "Value search.", + .details = slash_v_details, +}; +static const RzCmdDescArg cmd_search_value_8_args[] = { + { + .name = "value8", + .type = RZ_CMD_ARG_TYPE_NUM, + + }, + { 0 }, +}; +static const RzCmdDescHelp cmd_search_value_8_help = { + .summary = "8-bit value search.", + .args = cmd_search_value_8_args, +}; + +static const RzCmdDescArg cmd_search_value_16_args[] = { + { + .name = "value16", + .type = RZ_CMD_ARG_TYPE_NUM, + + }, + { 0 }, +}; +static const RzCmdDescHelp cmd_search_value_16_help = { + .summary = "16-bit size value search.", + .args = cmd_search_value_16_args, +}; + +static const RzCmdDescArg cmd_search_value_32_args[] = { + { + .name = "value32", + .type = RZ_CMD_ARG_TYPE_NUM, + + }, + { 0 }, +}; +static const RzCmdDescHelp cmd_search_value_32_help = { + .summary = "32-bit size value search.", + .args = cmd_search_value_32_args, +}; + +static const RzCmdDescArg cmd_search_value_64_args[] = { + { + .name = "value64", + .type = RZ_CMD_ARG_TYPE_NUM, + + }, + { 0 }, +}; +static const RzCmdDescHelp cmd_search_value_64_help = { + .summary = "64-bit size value search.", + .args = cmd_search_value_64_args, +}; + +static const RzCmdDescDetailEntry cmd_search_hex_Usage_space_example_detail_entries[] = { + { .text = "Hexadecimal search of the exact bytes", .arg_str = NULL, .comment = "/x ffcc33" }, + { .text = "Hexadecimal search of the bytes with ignored nibbles", .arg_str = NULL, .comment = "/x ff..33" }, + { .text = "Hexadecimal search of the bytes with bytes mask", .arg_str = NULL, .comment = "/x ff43:ffd0" }, + { 0 }, +}; +static const RzCmdDescDetail cmd_search_hex_details[] = { + { .name = "Usage example", .entries = cmd_search_hex_Usage_space_example_detail_entries }, + { 0 }, +}; +static const RzCmdDescArg cmd_search_hex_args[] = { + { + .name = "bytes", + .type = RZ_CMD_ARG_TYPE_STRING, + .flags = RZ_CMD_ARG_FLAG_LAST, + + }, + { 0 }, +}; +static const RzCmdDescHelp cmd_search_hex_help = { + .summary = "Raw hexadecimal search.", + .details = cmd_search_hex_details, + .args = cmd_search_hex_args, +}; + +static const RzCmdDescHelp slash_z_help = { + .summary = "String search.", +}; +static const char *cmd_search_string_sensitive_encoding_choices[] = { "ascii", "8bit", "mutf8", "utf8", "utf16le", "utf32le", "utf16be", "utf32be", "ibm037", "ibm290", "ebcdices", "ebcdicuk", "ebcdicus", NULL }; +static const RzCmdDescArg cmd_search_string_sensitive_args[] = { + { + .name = "string", + .type = RZ_CMD_ARG_TYPE_STRING, + + }, + { + .name = "encoding", + .type = RZ_CMD_ARG_TYPE_CHOICES, + .optional = true, + .choices.choices = cmd_search_string_sensitive_encoding_choices, + + }, + { 0 }, +}; +static const RzCmdDescHelp cmd_search_string_sensitive_help = { + .summary = "String search (case-sensitive).", + .args = cmd_search_string_sensitive_args, +}; + +static const char *cmd_search_string_insensitive_encoding_choices[] = { "ascii", "8bit", "mutf8", "utf8", "utf16le", "utf32le", "utf16be", "utf32be", "ibm037", "ibm290", "ebcdices", "ebcdicuk", "ebcdicus", NULL }; +static const RzCmdDescArg cmd_search_string_insensitive_args[] = { + { + .name = "string", + .type = RZ_CMD_ARG_TYPE_STRING, + + }, + { + .name = "encoding", + .type = RZ_CMD_ARG_TYPE_CHOICES, + .optional = true, + .choices.choices = cmd_search_string_insensitive_encoding_choices, + + }, + { 0 }, +}; +static const RzCmdDescHelp cmd_search_string_insensitive_help = { + .summary = "String search (case-insensitive).", + .args = cmd_search_string_insensitive_args, +}; + static const RzCmdDescHelp R_help = { .summary = "Connect with other instances of rizin", }; @@ -16843,10 +17164,6 @@ static const RzCmdDescHelp seek_undo_reset_help = { .args = seek_undo_reset_args, }; -static const RzCmdDescHelp seek_search_help = { - .summary = "Seek to the first hit of a search", -}; - static const RzCmdDescArg seek_asz_args[] = { { .name = "align", @@ -19767,9 +20084,53 @@ RZ_IPI void rzshell_cmddescs_init(RzCore *core) { RzCmdDesc *interpret_macro_multiple_cd = rz_cmd_desc_argv_new(core->rcmd, dot__cd, "..(", rz_interpret_macro_multiple_handler, &interpret_macro_multiple_help); rz_warn_if_fail(interpret_macro_multiple_cd); - RzCmdDesc *cmd_search_cd = rz_cmd_desc_oldinput_new(core->rcmd, root_cd, "/", rz_cmd_search, &cmd_search_help); - rz_warn_if_fail(cmd_search_cd); - RzCmdDesc *slash_R_cd = rz_cmd_desc_group_state_new(core->rcmd, cmd_search_cd, "/R", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_info_gadget_handler, &cmd_info_gadget_help, &slash_R_help); + RzCmdDesc *slash__cd = rz_cmd_desc_group_new(core->rcmd, root_cd, "/", NULL, NULL, &slash__help); + rz_warn_if_fail(slash__cd); + RzCmdDesc *cmd_search_assemble_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash__cd, "/a", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_assemble_handler, &cmd_search_assemble_help); + rz_warn_if_fail(cmd_search_assemble_cd); + rz_cmd_desc_set_default_mode(cmd_search_assemble_cd, RZ_OUTPUT_MODE_STANDARD); + + RzCmdDesc *slash_c_cd = rz_cmd_desc_group_new(core->rcmd, slash__cd, "/c", NULL, NULL, &slash_c_help); + rz_warn_if_fail(slash_c_cd); + RzCmdDesc *cmd_search_aes_key_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash_c_cd, "/ca", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_aes_key_handler, &cmd_search_aes_key_help); + rz_warn_if_fail(cmd_search_aes_key_cd); + rz_cmd_desc_set_default_mode(cmd_search_aes_key_cd, RZ_OUTPUT_MODE_STANDARD); + + RzCmdDesc *cmd_search_private_key_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash_c_cd, "/cp", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_private_key_handler, &cmd_search_private_key_help); + rz_warn_if_fail(cmd_search_private_key_cd); + rz_cmd_desc_set_default_mode(cmd_search_private_key_cd, RZ_OUTPUT_MODE_STANDARD); + + RzCmdDesc *slash_e_cd = rz_cmd_desc_group_state_new(core->rcmd, slash__cd, "/e", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_regex_raw_sensitive_handler, &cmd_search_regex_raw_sensitive_help, &slash_e_help); + rz_warn_if_fail(slash_e_cd); + rz_cmd_desc_set_default_mode(slash_e_cd, RZ_OUTPUT_MODE_STANDARD); + RzCmdDesc *cmd_search_regex_raw_insensitive_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash_e_cd, "/ei", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_regex_raw_insensitive_handler, &cmd_search_regex_raw_insensitive_help); + rz_warn_if_fail(cmd_search_regex_raw_insensitive_cd); + rz_cmd_desc_set_default_mode(cmd_search_regex_raw_insensitive_cd, RZ_OUTPUT_MODE_STANDARD); + + RzCmdDesc *slash_g_cd = rz_cmd_desc_group_state_new(core->rcmd, slash__cd, "/g", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_graph_path_handler, &cmd_search_graph_path_help, &slash_g_help); + rz_warn_if_fail(slash_g_cd); + rz_cmd_desc_set_default_mode(slash_g_cd, RZ_OUTPUT_MODE_STANDARD); + RzCmdDesc *cmd_search_graph_path_follow_jumps_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash_g_cd, "/gg", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_graph_path_follow_jumps_handler, &cmd_search_graph_path_follow_jumps_help); + rz_warn_if_fail(cmd_search_graph_path_follow_jumps_cd); + rz_cmd_desc_set_default_mode(cmd_search_graph_path_follow_jumps_cd, RZ_OUTPUT_MODE_STANDARD); + + RzCmdDesc *cmd_search_hash_block_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash__cd, "/h", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_hash_block_handler, &cmd_search_hash_block_help); + rz_warn_if_fail(cmd_search_hash_block_cd); + rz_cmd_desc_set_default_mode(cmd_search_hash_block_cd, RZ_OUTPUT_MODE_STANDARD); + + RzCmdDesc *cmd_search_magic_const_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash__cd, "/m", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_magic_const_handler, &cmd_search_magic_const_help); + rz_warn_if_fail(cmd_search_magic_const_cd); + rz_cmd_desc_set_default_mode(cmd_search_magic_const_cd, RZ_OUTPUT_MODE_STANDARD); + + RzCmdDesc *cmd_search_entropy_section_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash__cd, "/E", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_entropy_section_handler, &cmd_search_entropy_section_help); + rz_warn_if_fail(cmd_search_entropy_section_cd); + rz_cmd_desc_set_default_mode(cmd_search_entropy_section_cd, RZ_OUTPUT_MODE_STANDARD); + + RzCmdDesc *cmd_search_reference_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash__cd, "/r", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_reference_handler, &cmd_search_reference_help); + rz_warn_if_fail(cmd_search_reference_cd); + rz_cmd_desc_set_default_mode(cmd_search_reference_cd, RZ_OUTPUT_MODE_STANDARD); + + RzCmdDesc *slash_R_cd = rz_cmd_desc_group_state_new(core->rcmd, slash__cd, "/R", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_info_gadget_handler, &cmd_info_gadget_help, &slash_R_help); rz_warn_if_fail(slash_R_cd); rz_cmd_desc_set_default_mode(slash_R_cd, RZ_OUTPUT_MODE_STANDARD); RzCmdDesc *cmd_search_gadget_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash_R_cd, "/R/", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_gadget_handler, &cmd_search_gadget_help); @@ -19784,6 +20145,35 @@ RZ_IPI void rzshell_cmddescs_init(RzCore *core) { rz_warn_if_fail(cmd_detail_gadget_cd); rz_cmd_desc_set_default_mode(cmd_detail_gadget_cd, RZ_OUTPUT_MODE_STANDARD); + RzCmdDesc *slash_v_cd = rz_cmd_desc_group_new(core->rcmd, slash__cd, "/v", NULL, NULL, &slash_v_help); + rz_warn_if_fail(slash_v_cd); + RzCmdDesc *cmd_search_value_8_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash_v_cd, "/v1", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_value_8_handler, &cmd_search_value_8_help); + rz_warn_if_fail(cmd_search_value_8_cd); + rz_cmd_desc_set_default_mode(cmd_search_value_8_cd, RZ_OUTPUT_MODE_STANDARD); + + RzCmdDesc *cmd_search_value_16_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash_v_cd, "/v2", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_value_16_handler, &cmd_search_value_16_help); + rz_warn_if_fail(cmd_search_value_16_cd); + rz_cmd_desc_set_default_mode(cmd_search_value_16_cd, RZ_OUTPUT_MODE_STANDARD); + + RzCmdDesc *cmd_search_value_32_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash_v_cd, "/v4", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_value_32_handler, &cmd_search_value_32_help); + rz_warn_if_fail(cmd_search_value_32_cd); + rz_cmd_desc_set_default_mode(cmd_search_value_32_cd, RZ_OUTPUT_MODE_STANDARD); + + RzCmdDesc *cmd_search_value_64_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash_v_cd, "/v8", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_value_64_handler, &cmd_search_value_64_help); + rz_warn_if_fail(cmd_search_value_64_cd); + rz_cmd_desc_set_default_mode(cmd_search_value_64_cd, RZ_OUTPUT_MODE_STANDARD); + + RzCmdDesc *cmd_search_hex_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash__cd, "/x", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_hex_handler, &cmd_search_hex_help); + rz_warn_if_fail(cmd_search_hex_cd); + rz_cmd_desc_set_default_mode(cmd_search_hex_cd, RZ_OUTPUT_MODE_STANDARD); + + RzCmdDesc *slash_z_cd = rz_cmd_desc_group_state_new(core->rcmd, slash__cd, "/z", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_string_sensitive_handler, &cmd_search_string_sensitive_help, &slash_z_help); + rz_warn_if_fail(slash_z_cd); + rz_cmd_desc_set_default_mode(slash_z_cd, RZ_OUTPUT_MODE_STANDARD); + RzCmdDesc *cmd_search_string_insensitive_cd = rz_cmd_desc_argv_state_new(core->rcmd, slash_z_cd, "/zi", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_TABLE, rz_cmd_search_string_insensitive_handler, &cmd_search_string_insensitive_help); + rz_warn_if_fail(cmd_search_string_insensitive_cd); + rz_cmd_desc_set_default_mode(cmd_search_string_insensitive_cd, RZ_OUTPUT_MODE_STANDARD); + RzCmdDesc *R_cd = rz_cmd_desc_group_new(core->rcmd, root_cd, "R", rz_remote_handler, &remote_help, &R_help); rz_warn_if_fail(R_cd); RzCmdDesc *remote_send_cd = rz_cmd_desc_argv_new(core->rcmd, R_cd, "R<", rz_remote_send_handler, &remote_send_help); @@ -23037,9 +23427,6 @@ RZ_IPI void rzshell_cmddescs_init(RzCore *core) { RzCmdDesc *seek_undo_reset_cd = rz_cmd_desc_argv_new(core->rcmd, sh_cd, "sh-", rz_seek_undo_reset_handler, &seek_undo_reset_help); rz_warn_if_fail(seek_undo_reset_cd); - RzCmdDesc *seek_search_cd = rz_cmd_desc_oldinput_new(core->rcmd, s_cd, "s/", rz_seek_search, &seek_search_help); - rz_warn_if_fail(seek_search_cd); - RzCmdDesc *seek_asz_cd = rz_cmd_desc_argv_new(core->rcmd, s_cd, "sa", rz_seek_asz_handler, &seek_asz_help); rz_warn_if_fail(seek_asz_cd); diff --git a/librz/core/cmd_descs/cmd_descs.h b/librz/core/cmd_descs/cmd_descs.h index 90a0449dc30..7f67ea669f3 100644 --- a/librz/core/cmd_descs/cmd_descs.h +++ b/librz/core/cmd_descs/cmd_descs.h @@ -61,6 +61,28 @@ RZ_IPI RzCmdStatus rz_interpret_pipe_handler(RzCore *core, int argc, const char RZ_IPI RzCmdStatus rz_interpret_macro_handler(RzCore *core, int argc, const char **argv); // "..(" RZ_IPI RzCmdStatus rz_interpret_macro_multiple_handler(RzCore *core, int argc, const char **argv); +// "/a" +RZ_IPI RzCmdStatus rz_cmd_search_assemble_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/ca" +RZ_IPI RzCmdStatus rz_cmd_search_aes_key_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/cp" +RZ_IPI RzCmdStatus rz_cmd_search_private_key_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/e" +RZ_IPI RzCmdStatus rz_cmd_search_regex_raw_sensitive_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/ei" +RZ_IPI RzCmdStatus rz_cmd_search_regex_raw_insensitive_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/g" +RZ_IPI RzCmdStatus rz_cmd_search_graph_path_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/gg" +RZ_IPI RzCmdStatus rz_cmd_search_graph_path_follow_jumps_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/h" +RZ_IPI RzCmdStatus rz_cmd_search_hash_block_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/m" +RZ_IPI RzCmdStatus rz_cmd_search_magic_const_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/E" +RZ_IPI RzCmdStatus rz_cmd_search_entropy_section_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/r" +RZ_IPI RzCmdStatus rz_cmd_search_reference_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); // "/R" RZ_IPI RzCmdStatus rz_cmd_info_gadget_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); // "/R/" @@ -69,8 +91,20 @@ RZ_IPI RzCmdStatus rz_cmd_search_gadget_handler(RzCore *core, int argc, const ch RZ_IPI RzCmdStatus rz_cmd_query_gadget_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); // "/Rg" RZ_IPI RzCmdStatus rz_cmd_detail_gadget_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); -// "/" -RZ_IPI int rz_cmd_search(void *data, const char *input); +// "/v1" +RZ_IPI RzCmdStatus rz_cmd_search_value_8_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/v2" +RZ_IPI RzCmdStatus rz_cmd_search_value_16_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/v4" +RZ_IPI RzCmdStatus rz_cmd_search_value_32_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/v8" +RZ_IPI RzCmdStatus rz_cmd_search_value_64_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/x" +RZ_IPI RzCmdStatus rz_cmd_search_hex_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/z" +RZ_IPI RzCmdStatus rz_cmd_search_string_sensitive_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); +// "/zi" +RZ_IPI RzCmdStatus rz_cmd_search_string_insensitive_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state); // "R" RZ_IPI RzCmdStatus rz_remote_handler(RzCore *core, int argc, const char **argv); // "R<" @@ -2278,8 +2312,6 @@ RZ_IPI RzCmdStatus rz_seek_redo_handler(RzCore *core, int argc, const char **arg RZ_IPI RzCmdStatus rz_seek_undo_handler(RzCore *core, int argc, const char **argv); // "sh-" RZ_IPI RzCmdStatus rz_seek_undo_reset_handler(RzCore *core, int argc, const char **argv); -// "s/" -RZ_IPI int rz_seek_search(void *data, const char *input); // "sa" RZ_IPI RzCmdStatus rz_seek_asz_handler(RzCore *core, int argc, const char **argv); // "sb" diff --git a/librz/core/cmd_descs/cmd_descs.yaml b/librz/core/cmd_descs/cmd_descs.yaml index 5a0c71bc2d2..4de2592f363 100644 --- a/librz/core/cmd_descs/cmd_descs.yaml +++ b/librz/core/cmd_descs/cmd_descs.yaml @@ -148,12 +148,10 @@ commands: - text: "*" arg_str: "entry0" comment: read the value contained at the entrypoint - - name: . + - name: "." summary: Interpret commands subcommands: cmd_interpret - - name: / - cname: cmd_search - type: RZ_CMD_DESC_TYPE_OLDINPUT + - name: "/" summary: Search for bytes, regexps, patterns, .. subcommands: cmd_search - name: "R" diff --git a/librz/core/cmd_descs/cmd_search.yaml b/librz/core/cmd_descs/cmd_search.yaml index 4cb3f3777eb..42e5c90c368 100644 --- a/librz/core/cmd_descs/cmd_search.yaml +++ b/librz/core/cmd_descs/cmd_search.yaml @@ -3,8 +3,173 @@ --- name: cmd_search commands: + - name: "/a" + summary: Assemble the opcodes and search its bytes + cname: cmd_search_assemble + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: + - name: opcodes + type: RZ_CMD_ARG_TYPE_STRING + + - name: "/c" + summary: Cryptographic material search + subcommands: + - name: "/ca" + summary: Search for AES keys + cname: cmd_search_aes_key + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: [] + - name: "/cp" + summary: Search for private RSA/ECC/EdDSA keys + cname: cmd_search_private_key + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: [] + + - name: "/e" + summary: Raw regular expression search. + subcommands: + - name: "/e" + summary: Raw regular expression search (case-sensitive). + cname: cmd_search_regex_raw_sensitive + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: + - name: regex + type: RZ_CMD_ARG_TYPE_STRING + - name: "/ei" + summary: Raw regular expression search (case-insensitive). + cname: cmd_search_regex_raw_insensitive + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: + - name: regex + type: RZ_CMD_ARG_TYPE_STRING + + - name: "/g" + summary: Search for all graph paths A to B (/gg follow jumps, see search.count and analysis.depth). + subcommands: + - name: "/g" + summary: Search for all graph paths A to B (does not follow jumps). + cname: cmd_search_graph_path + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: + - name: from + type: RZ_CMD_ARG_TYPE_RZNUM + - name: to + type: RZ_CMD_ARG_TYPE_RZNUM + - name: "/gg" + summary: Search for all graph paths A to B (follow jumps, see `search.count` and `analysis.depth`). + cname: cmd_search_graph_path_follow_jumps + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: + - name: from + type: RZ_CMD_ARG_TYPE_RZNUM + - name: to + type: RZ_CMD_ARG_TYPE_RZNUM + + - name: "/h" + summary: Search for blocks that have the same hash (see also command `ph`). + cname: cmd_search_hash_block + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: + - name: algo + type: RZ_CMD_ARG_TYPE_STRING + - name: hash + type: RZ_CMD_ARG_TYPE_STRING + details: + - name: Usage example + entries: + - text: "MD5 hash search within blocks of 512 bytes." + comment: "/h md5 0bc8f8c426b74ffaedac8330a7464014 @! 512" + + - name: "/m" + summary: Magic constants search. + cname: cmd_search_magic_const + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: [] + + - name: "/E" + summary: Entropy search on sections by grouping in blocks. + cname: cmd_search_entropy_section + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: + - name: threshold + type: RZ_CMD_ARG_TYPE_STRING + + - name: "/r" + summary: Reference search. + cname: cmd_search_reference + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: + - name: address + type: RZ_CMD_ARG_TYPE_RZNUM + - name: "/R" - summary: List ROP Gadgets + summary: Search, List, Query for ROP Gadgets subcommands: - name: "/R" cname: cmd_info_gadget @@ -60,4 +225,155 @@ commands: args: - name: Gadget address type: RZ_CMD_ARG_TYPE_STRING - optional: true \ No newline at end of file + optional: true + - name: "/v" + summary: Value search. + subcommands: + - name: "/v1" + summary: 8-bit value search. + cname: cmd_search_value_8 + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: + - name: value8 + type: RZ_CMD_ARG_TYPE_NUM + + - name: "/v2" + summary: 16-bit size value search. + cname: cmd_search_value_16 + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: + - name: value16 + type: RZ_CMD_ARG_TYPE_NUM + + - name: "/v4" + summary: 32-bit size value search. + cname: cmd_search_value_32 + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: + - name: value32 + type: RZ_CMD_ARG_TYPE_NUM + + - name: "/v8" + summary: 64-bit size value search. + cname: cmd_search_value_64 + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: + - name: value64 + type: RZ_CMD_ARG_TYPE_NUM + details: + - name: Usage example + entries: + - text: "512 value search of its 32-bit representation" + comment: "/v4 512" + + - name: "/x" + summary: Raw hexadecimal search. + cname: cmd_search_hex + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: + - name: bytes + type: RZ_CMD_ARG_TYPE_STRING + details: + - name: Usage example + entries: + - text: "Hexadecimal search of the exact bytes" + comment: "/x ffcc33" + - text: "Hexadecimal search of the bytes with ignored nibbles" + comment: "/x ff..33" + - text: "Hexadecimal search of the bytes with bytes mask" + comment: "/x ff43:ffd0" + + - name: "/z" + summary: String search. + subcommands: + - name: "/z" + summary: String search (case-sensitive). + cname: cmd_search_string_sensitive + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: + - name: string + type: RZ_CMD_ARG_TYPE_STRING + - name: encoding + type: RZ_CMD_ARG_TYPE_CHOICES + optional: true + choices: + - "ascii" + - "8bit" + - "mutf8" + - "utf8" + - "utf16le" + - "utf32le" + - "utf16be" + - "utf32be" + - "ibm037" + - "ibm290" + - "ebcdices" + - "ebcdicuk" + - "ebcdicus" + + - name: "/zi" + summary: String search (case-insensitive). + cname: cmd_search_string_insensitive + type: RZ_CMD_DESC_TYPE_ARGV_STATE + default_mode: RZ_OUTPUT_MODE_STANDARD + modes: + - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_JSON + - RZ_OUTPUT_MODE_QUIET + - RZ_OUTPUT_MODE_TABLE + args: + - name: string + type: RZ_CMD_ARG_TYPE_STRING + - name: encoding + type: RZ_CMD_ARG_TYPE_CHOICES + optional: true + choices: + - "ascii" + - "8bit" + - "mutf8" + - "utf8" + - "utf16le" + - "utf32le" + - "utf16be" + - "utf32be" + - "ibm037" + - "ibm290" + - "ebcdices" + - "ebcdicuk" + - "ebcdicus" diff --git a/librz/core/cmd_descs/cmd_seek.yaml b/librz/core/cmd_descs/cmd_seek.yaml index 475e17c27f6..c9efff1a261 100644 --- a/librz/core/cmd_descs/cmd_seek.yaml +++ b/librz/core/cmd_descs/cmd_seek.yaml @@ -67,10 +67,6 @@ commands: cname: seek_undo_reset summary: Clear seek history args: [] - - name: s/ - cname: seek_search - summary: Seek to the first hit of a search - type: RZ_CMD_DESC_TYPE_OLDINPUT - name: sa cname: seek_asz summary: Seek to current offset (or ) aligned to