25 return strcmp(
a->short_path,
b->short_path);
30 char *arch_end =
NULL;
31 char *bits_end =
NULL;
32 char copy_path[1024] = { 0 };
41 strncpy(copy_path,
entry->file_path + path_len,
sizeof(copy_path) - 1);
43 entry->short_path =
entry->file_path + path_len;
45 if (!(bin_end = strstr(copy_path,
RZ_SYS_DIR))) {
46 RZ_LOG_WARN(
"sigdb: folder structure is invalid (missing bin name).\n");
49 RZ_LOG_WARN(
"sigdb: folder structure is invalid (missing arch name).\n");
52 RZ_LOG_WARN(
"sigdb: folder structure is invalid (missing arch bits).\n");
109 RZ_LOG_ERROR(
"sigdb path is unknown or invalid (path: %s)\n", sigdb_path);
112 size_t path_len = strlen(sigdb_path) + 1;
160 return ht_pu_insert(db->entries,
entry, 1);
219 #define field_cmp(fname, cmpfunction) \
221 int r = cmpfunction(sa->fname, sb->fname); \
265 HtPUOptions opt = { 0 };
269 db->
entries = ht_pu_new_opt(&opt);
RzBinInfo * info(RzBinFile *bf)
checking print the parsed form of the magic use in n conjunction with m to debug a new magic file n before installing it n output MIME type special files
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API RZ_OWN RzList * rz_list_new(void)
Returns a new initialized RzList pointer (free method is not initialized)
RZ_API void rz_list_sort(RZ_NONNULL RzList *list, RZ_NONNULL RzListComparator cmp)
Sorts via merge sort or via insertion sort a list.
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
#define rz_return_val_if_fail(expr, val)
RZ_API void rz_buf_free(RzBuffer *b)
Free all internal data hold by the buffer and the buffer.
RZ_API RZ_OWN RzBuffer * rz_buf_new_file(const char *file, int perm, int mode)
Creates a new buffer from a file.
RZ_API const char * rz_file_basename(const char *path)
RZ_API bool rz_file_is_directory(const char *str)
RZ_API RzList * rz_file_globsearch(const char *globbed_path, int maxdepth)
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.
RZ_API void rz_sign_flirt_node_free(RZ_NULLABLE RzFlirtNode *node)
Frees an RzFlirtNode struct.
RZ_API RZ_OWN bool rz_sign_flirt_parse_header_compressed_pattern_from_buffer(RZ_NONNULL RzBuffer *flirt_buf, RZ_NONNULL RzFlirtInfo *info)
Parses the RzBuffer containing a FLIRT structure and returns an RzFlirtInfo.
RZ_API void rz_sign_flirt_info_fini(RZ_NULLABLE RzFlirtInfo *info)
Frees an RzFlirtInfo struct elements without freeing the pointer.
@ RZ_FLIRT_NODE_OPTIMIZE_NONE
keeps the structure flattened (keep the tail bytes)
int(* RzListComparator)(const void *value, const void *list_data)
#define RZ_LOG_WARN(fmtstr,...)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API ut64 rz_get_input_num_value(RzNum *num, const char *input_value)
#define RZ_STR_ISNOTEMPTY(x)
RZ_API int rz_str_replace_char(char *s, int a, int b)
RZ_API bool rz_str_endswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string ends with a specifc sequence of characters (case sensitive)
#define rz_strf(buf,...)
Convenience macro for local temporary strings.
#define RZ_JOIN_2_PATHS(p1, p2)
RZ_API ut32 sdb_hash(const char *key)
static int ut32cmp(int a, int b)
static int sigdb_signature_cmp(const RzSigDBEntry *a, const RzSigDBEntry *b)
RZ_API bool rz_sign_sigdb_merge(RZ_NONNULL RzSigDb *db, RZ_NONNULL RzSigDb *db2)
Merge the signatures from db2 into db.
static int strcmp_null(const char *a, const char *b)
static void ht_pu_sigdb_freekv(HtPUKv *kv)
RZ_API RZ_OWN RzSigDb * rz_sign_sigdb_new(void)
Create a new empty RzSigDb instance.
#define field_cmp(fname, cmpfunction)
RZ_API void rz_sign_sigdb_free(RzSigDb *db)
static bool sigdb_move_entry(void *user, const void *k, const ut64 v)
RZ_API RZ_OWN RzList * rz_sign_sigdb_list(RZ_NONNULL const RzSigDb *db)
Return the signature database as a list of entries.
static bool sigdb_signature_resolve_details(RzSigDBEntry *entry, size_t path_len, bool with_details)
RZ_API RZ_OWN RzSigDb * rz_sign_sigdb_load_database(RZ_NONNULL const char *sigdb_path, bool with_details)
Returns a database of signatures loaded from the signature database path.
static int sigdb_entry_cmp(const void *a, const void *b)
static bool sigdb_to_list(void *user, const void *k, const ut64 v)
RZ_API bool rz_sign_sigdb_add_entry(RZ_NONNULL RzSigDb *db, RZ_NONNULL const RzSigDBEntry *entry)
Add a new signature entry to a database.
static ut32 sigdb_entry_hash(const void *k)
RZ_API void rz_sign_sigdb_signature_free(RZ_NULLABLE RzSigDBEntry *entry)
Frees a RzSigDBEntry structure.
char * file_path
full path to the signature file
ut64(WINAPI *w32_GetEnabledXStateFeatures)()