Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Macros | |
#define | pat_dbg(...) |
#define | PAT_LINE_BUFFER_SIZE 1024 |
FLIRT uncompressed file format.
An example of uncompressed format is shown below:
The '—' is the pat file terminator Some files may contain comments using hashtag (#) as prefix but it is not the standard format.
4154554889FD534889F3C60700E8........C6441DFF004189C485C07515BE2E `--— Each line starts with a pattern mask (usually 32 bytes long)
07 FAEE | ---- CRC16 value
------— CRC16 length
003B ^----— Function size (min 2 bytes, but can be bigger)
:0000@ Curl_gethostname | || -------------- Symbol name | |
-----------------— If set, then is local symbol | --------------------- Symbol offset and type (: -> public)
----------------------— Symbol type (: -> public, ^ -> reference)
This symbol, is a list and can be repeated N-times
........4885C07403C600004489E05B5D415CC3 `--— The line can end with another pattern mask
Definition in file pat.c.
|
inlinestatic |
int flirt_compare_node | ( | const RzFlirtNode * | a, |
const RzFlirtNode * | b | ||
) |
Definition at line 225 of file create.c.
Referenced by flirt_node_optimize(), flirt_node_shorten_and_insert(), rz_sign_flirt_node_new(), and rz_sign_flirt_parse_string_pattern_from_buffer().
bool flirt_node_optimize | ( | RzFlirtNode * | root | ) |
Definition at line 316 of file create.c.
References rz_list_iter_t::data, fail, flirt_compare_node(), flirt_node_shorten_and_insert(), NULL, root, rz_list_free(), rz_list_length(), rz_list_newf(), rz_list_sort(), RZ_LOG_ERROR, and rz_sign_flirt_node_free().
Referenced by rz_sign_flirt_node_new(), and rz_sign_flirt_parse_string_pattern_from_buffer().
|
static |
Definition at line 443 of file pat.c.
References i, rz_strbuf_append(), and rz_strbuf_appendf().
Referenced by flirt_pat_write_line().
|
static |
Expects one of these line formats and lines may end with '\r'
4154554889FD534889F3C60700E8........C6441DFF004189C485C07515BE2E 07 FAEE 003B :0000@ Curl_gethostname ^000E gethostname ^0027 strchr ........4885C07403C600004489E05B5D415CC3 31C04885D2741F488D4417FF4839C77610EB1D0F1F4400004883E8014839C777 13 9867 0033 :0000 Curl_memrchr
The '—' are the pat file terminator Some files may contain comments using hashtag (#) as prefix
Definition at line 140 of file pat.c.
References err, flirt_pat_parse_pattern_mask(), free(), i, IS_HEXCHAR, setup::line, module_free(), rz_flirt_node_t::module_list, NULL, rz_flirt_tail_byte_t::offset, parse_byte(), pat_dbg, root, RZ_FLIRT_NAME_MAX, rz_list_append(), rz_list_free(), rz_list_length(), rz_list_newf(), rz_list_pop_head(), RZ_LOG_ERROR, RZ_LOG_WARN, RZ_MIN, RZ_NEW0, rz_sign_flirt_node_free(), RZ_STR_ISEMPTY, RZ_STR_ISNOTEMPTY, rz_str_split_list(), rz_strbuf_get(), rz_strbuf_length(), sb, and rz_flirt_tail_byte_t::value.
Referenced by rz_sign_flirt_parse_string_pattern_from_buffer().
|
static |
Definition at line 72 of file pat.c.
References bytes, err, free(), i, IS_HEXCHAR, rz_flirt_node_t::length, length, mask, NULL, p, parse_byte(), rz_flirt_node_t::pattern_bytes, rz_flirt_node_t::pattern_mask, RZ_LOG_ERROR, RZ_NEWS, RZ_STR_ISEMPTY, and rz_flirt_node_t::variant_mask.
Referenced by flirt_pat_parse_line().
|
static |
Definition at line 453 of file pat.c.
References flirt_pat_append_prelude(), pad(), rz_buf_append_string(), RZ_FLIRT_MAX_PRELUDE_SIZE, rz_list_length(), rz_str_pad(), rz_strbuf_append(), rz_strbuf_get(), rz_strbuf_length(), rz_strbuf_slice(), rz_strf, autogen_x86imm::tmp, and rz_flirt_tail_byte_t::value.
Referenced by rz_sign_flirt_write_string_pattern_to_buffer().
void module_free | ( | RzFlirtModule * | module | ) |
|
inlinestatic |
Definition at line 67 of file pat.c.
References decode_byte(), and value.
Referenced by flirt_pat_parse_line(), and flirt_pat_parse_pattern_mask().
RZ_API RZ_OWN RzFlirtNode* rz_sign_flirt_parse_string_pattern_from_buffer | ( | RZ_NONNULL RzBuffer * | flirt_buf, |
ut32 | optimization, | ||
RZ_NULLABLE RzFlirtInfo * | info | ||
) |
Parses the RzBuffer containing a FLIRT signature in string format and returns an RzFlirtNode.
flirt_buf | The buffer to read |
optimization | Optimization to apply after creation of the flatten nodes. |
info | Pointer to a RzFlirtInfo that can be used to get info about the pat file |
Definition at line 356 of file pat.c.
References flirt_compare_node(), flirt_node_optimize(), flirt_pat_parse_line(), free(), info(), setup::line, memset(), NULL, p, pat_dbg, PAT_LINE_BUFFER_SIZE, read(), root, rz_buf_read(), RZ_FLIRT_FILE_TYPE_PAT, RZ_FLIRT_NODE_OPTIMIZE_MAX, RZ_FLIRT_NODE_OPTIMIZE_NONE, rz_list_newf(), rz_list_sort(), RZ_LOG_ERROR, RZ_NEW0, rz_return_val_if_fail, rz_sign_flirt_node_count_nodes(), rz_sign_flirt_node_free(), rz_strbuf_append(), rz_strbuf_fini(), rz_strbuf_free(), rz_strbuf_get(), rz_strbuf_init(), rz_strbuf_length(), rz_strbuf_new(), st64, and rz_bin_info_t::type.
Referenced by rz_core_flirt_convert_file(), rz_core_flirt_dump_file(), rz_sign_flirt_apply(), and sigdb_signature_resolve_details().
RZ_API bool rz_sign_flirt_write_string_pattern_to_buffer | ( | RZ_NONNULL const RzFlirtNode * | root, |
RZ_NONNULL RzBuffer * | buffer | ||
) |
Writes in the the RzBuffer the FLIRT signatures in string format.
root | The FLIRT root node to use as input |
buffer | The buffer to write to |
Definition at line 529 of file pat.c.
References flirt_pat_write_line(), root, rz_buf_append_string(), rz_return_val_if_fail, rz_strbuf_fini(), rz_strbuf_init(), and sb.
Referenced by rz_core_flirt_convert_file(), and rz_core_flirt_create_file().