Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_core.h>
Go to the source code of this file.
Classes | |
struct | rz_basefind_t |
struct | rz_basefind_info_t |
struct | rz_basefind_options_t |
Macros | |
#define | RZ_BASEFIND_STRING_MIN_LENGTH (10) |
#define | RZ_BASEFIND_BASE_MIN_ADDRESS (0ull) |
#define | RZ_BASEFIND_BASE_MAX_ADDRESS (0xf0000000ull) |
#define | RZ_BASEFIND_BASE_ALIGNMENT (0x1000) |
#define | RZ_BASEFIND_SCORE_MIN_VALUE (1) |
Typedefs | |
typedef struct rz_basefind_t | RzBaseFindScore |
typedef struct rz_basefind_info_t | RzBaseFindThreadInfo |
typedef bool(* | RzBaseFindThreadInfoCb) (const RzBaseFindThreadInfo *th_info, void *user) |
typedef struct rz_basefind_options_t | RzBaseFindOpt |
Functions | |
RZ_API RZ_OWN RzList * | rz_basefind (RZ_NONNULL RzCore *core, RZ_NONNULL RzBaseFindOpt *options) |
Calculates a list of possible base addresses candidates using the strings position. More... | |
#define RZ_BASEFIND_BASE_ALIGNMENT (0x1000) |
Definition at line 16 of file rz_basefind.h.
#define RZ_BASEFIND_BASE_MAX_ADDRESS (0xf0000000ull) |
Definition at line 15 of file rz_basefind.h.
#define RZ_BASEFIND_BASE_MIN_ADDRESS (0ull) |
Definition at line 14 of file rz_basefind.h.
#define RZ_BASEFIND_SCORE_MIN_VALUE (1) |
Definition at line 17 of file rz_basefind.h.
#define RZ_BASEFIND_STRING_MIN_LENGTH (10) |
Definition at line 13 of file rz_basefind.h.
typedef struct rz_basefind_options_t RzBaseFindOpt |
typedef struct rz_basefind_t RzBaseFindScore |
typedef struct rz_basefind_info_t RzBaseFindThreadInfo |
typedef bool(* RzBaseFindThreadInfoCb) (const RzBaseFindThreadInfo *th_info, void *user) |
Definition at line 34 of file rz_basefind.h.
RZ_API RZ_OWN RzList* rz_basefind | ( | RZ_NONNULL RzCore * | core, |
RZ_NONNULL RzBaseFindOpt * | options | ||
) |
Calculates a list of possible base addresses candidates using the strings position.
The code finds all the strings in memory with a minimum acceptable size (via opt.min_string_len) and calculates all possible words 32 or 64 bit large sizes (endianness via cfg.bigendian) in the given binary. These addresses are then compared with the strings and a variable base address which is increased over time by opt.alignment.
The scores are added to the result list with the associated base address if their score are higher than opt.min_score, otherwise they are ignored.
It is possible via opt.callback to set a callback function that can stop the search (when returning false) or display the thread statuses (the callback will be called N-times for N spawned threads.
core | RzCore struct to use. |
options | Pointer to the RzBaseFindOpt structure. |
Definition at line 336 of file basefind.c.
References basefind_thread_data_t::alignment, basefind_thread_data_t::array, basefind_thread_data_t::base_end, basefind_thread_data_t::base_start, basefind_array_free(), basefind_create_array_of_addresses(), basefind_create_pointer_map(), basefind_score_compare(), basefind_set_thread_info(), basefind_stop_all_search_threads(), basefind_thread_ui(), basefind_ui_info_t::callback, create_thread_interval(), basefind_thread_data_t::current, free(), i, basefind_thread_data_t::io_size, basefind_thread_data_t::lock, lock(), basefind_thread_data_t::loop, basefind_ui_info_t::loop, rz_basefind_info_t::n_threads, NULL, options, basefind_thread_data_t::pointers, basefind_ui_info_t::pool, rz_atomic_bool_free(), rz_atomic_bool_new(), rz_atomic_bool_set(), RZ_BASEFIND_BASE_ALIGNMENT, rz_io_size(), rz_list_newf(), rz_list_sort(), RZ_LOG_ERROR, RZ_LOG_VERBOSE, RZ_LOG_WARN, RZ_NEW, rz_return_val_if_fail, rz_th_free(), rz_th_get_user(), rz_th_lock_free(), rz_th_lock_new(), rz_th_new(), rz_th_pool_free(), rz_th_pool_get_thread(), rz_th_pool_new(), rz_th_pool_size(), rz_th_pool_wait(), rz_th_wait(), basefind_thread_data_t::score_min, basefind_thread_data_t::scores, basefind_ui_info_t::user, and ut64().
Referenced by rz_core_bin_basefind_print().