65 if (delta < 0 || delta >= ro->
bsize) {
78 if (ch ==
'"' || ch ==
'\\') {
87 strcpy(
str + j,
"...");
98 for (
i = 0;
i <
sizeof(_str) - 1;
i++) {
100 if (ch ==
'"' || ch ==
'\\') {
112 for (
i = 0;
i <
sizeof(_str) - 1;
i++) {
114 if (ch ==
'"' || ch ==
'\\') {
125 const char *
type =
"string";
126 printf(
"%s{\"offset\":%" PFMT64d ",\"type\":\"%s\",\"data\":\"%s\"}",
129 }
else if (ro->
rad) {
151 string->vaddr =
s->vaddr + (
string->paddr -
s->paddr);
156 const char *section_name =
s ?
s->name :
"";
164 pj_ks(pj,
"section", section_name);
165 pj_ks(pj,
"type", type_string);
174 printf(
"Usage: %s [-mXnzZhqv] [-a align] [-b sz] [-f/t from/to] [-[e|s|w|S|I] str] [-x hex] -|file|dir ..\n", argv0);
179 " -a [align] only accept aligned hits\n"
180 " -b [size] set block size\n"
181 " -e [regex] search for regex matches (can be used multiple times)\n"
182 " -f [from] start searching from address 'from'\n"
183 " -F [file] read the contents of the file and use it as keyword\n"
184 " -h show this help\n"
185 " -i identify filetype (rizin -nqcpm file)\n"
186 " -j output in JSON\n"
187 " -m magic search, file-type carver\n"
188 " -M [str] set a binary mask to be applied on keywords\n"
189 " -n do not stop on read errors\n"
190 " -r print using rizin commands\n"
191 " -s [str] search for a specific string (can be used multiple times)\n"
192 " -w [str] search for a specific wide string (can be used multiple times). Assumes str is UTF-8.\n"
193 " -I [str] search for an entry in import table.\n"
194 " -S [str] search for a symbol in symbol table.\n"
195 " -t [to] stop search at address 'to'\n"
196 " -q quiet - do not show headings (filenames) above matching contents (default for searching a single file)\n"
197 " -v print version and exit\n"
198 " -x [hex] search for hexpair string (909090) (can be used multiple times)\n"
199 " -X show hexdump of search results\n"
200 " -z search for zero-terminated strings\n"
201 " -Z show string found on each search hit\n");
220 char *
cmd =
rz_str_newf(
"rizin -e search.show=false -e search.maxhits=1 -nqcpm \"%s\"", efile);
235 RzBinOptions opt = { 0 };
254 rz_list_foreach (
imports, it,
import) {
255 if (!strcmp(import->name, kw)) {
256 printf(
"ordinal: %d %s\n", import->ordinal, kw);
265 rz_list_foreach (
symbols, it, symbol) {
270 if (!strcmp(symbol->
name, kw)) {
338 eprintf(
"rz-bin: Cannot allocate buffer for json array\n");
347 rz_list_foreach (
list, it,
string) {
363 " -e search.in=range"
364 " -e search.align=%d"
366 " %s -qnc/m%s \"%s\"",
374 rz_sys_cmdf(
"rizin -qc \"/E %s\" \"%s\"", kw, efile);
402 if ((ro->
cur + bsize) >
to) {
403 bsize =
to - ro->
cur;
414 if (ret != bsize && ret > 0) {
457 if (!strcmp(
file,
"-")) {
587 if (opt.
ind == argc) {
597 for (; opt.
ind < argc; opt.
ind++) {
601 eprintf(
"Cannot open empty path\n");
RZ_API RZ_OWN RzList * rz_bin_file_strings(RZ_NONNULL RzBinFile *bf, size_t min_length, bool raw_strings)
Generates a RzList struct containing RzBinString from a given RzBinFile.
RZ_API RzBin * rz_bin_new(void)
RZ_API RZ_BORROW RzBinSection * rz_bin_get_section_at(RzBinObject *o, ut64 off, int va)
Find the binary section at offset off.
RZ_API void rz_bin_options_init(RzBinOptions *opt, int fd, ut64 baseaddr, ut64 loadaddr, bool patch_relocs)
RZ_API RzBinFile * rz_bin_open(RzBin *bin, const char *file, RzBinOptions *opt)
RZ_API void rz_bin_free(RzBin *bin)
RzList * symbols(RzBinFile *bf)
RzList * imports(RzBinFile *bf)
RZ_API const RzList * rz_bin_object_get_imports(RZ_NONNULL RzBinObject *obj)
Get list of RzBinImport representing the imports of the binary object.
RZ_API ut64 rz_bin_object_get_vaddr(RzBinObject *o, ut64 paddr, ut64 vaddr)
RZ_API const RzList * rz_bin_object_get_symbols(RZ_NONNULL RzBinObject *obj)
Get list of RzBinSymbol representing the symbols in the binary object.
RZ_API RzCons * rz_cons_new(void)
RZ_API RzCons * rz_cons_free(void)
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
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 RzSearchKeyword * rz_search_keyword_new_str(const char *kwbuf, const char *bmstr, const char *data, int ignore_case)
RZ_API RzSearchKeyword * rz_search_keyword_new_wide(const char *kwbuf, const char *bmstr, const char *data, int ignore_case)
RZ_API RzSearchKeyword * rz_search_keyword_new_hex(const char *kwstr, const char *bmstr, const char *data)
RZ_API RzSearchKeyword * rz_search_keyword_new_hexmask(const char *kwstr, const char *data)
return memset(p, 0, total)
static int show_help(const char *argv0, int line)
static int rzfind_open(RzfindOptions *ro, const char *file)
static void print_bin_string(RzBinFile *bf, RzBinString *string, PJ *pj)
RZ_API int rz_main_rz_find(int argc, const char **argv)
static int rzfind_open_file(RzfindOptions *ro, const char *file, const ut8 *data, int datalen)
static void rzfind_options_init(RzfindOptions *ro)
static int rzfind_open_dir(RzfindOptions *ro, const char *dir)
static int hit(RzSearchKeyword *kw, void *user, ut64 addr)
static void rzfind_options_fini(RzfindOptions *ro)
static void list(RzEgg *egg)
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
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.
void * calloc(size_t number, size_t size)
static static fork const void static count static fd const char const char static newpath char char argv
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")
RZ_API RzPrint * rz_print_new(void)
RZ_API RZ_OWN char * rz_print_hexdump_str(RZ_NONNULL RzPrint *p, ut64 addr, RZ_NONNULL const ut8 *buf, int len, int base, int step, size_t zoomsz)
Prints a hexdump of buf at addr.
#define rz_return_if_fail(expr)
RZ_API bool rz_file_is_directory(const char *str)
RZ_API char * rz_stdin_slurp(int *sz)
RZ_API RZ_OWN char * rz_file_slurp(const char *str, RZ_NULLABLE size_t *usz)
RZ_API RZ_OWN char * rz_file_path_join(RZ_NONNULL const char *s1, RZ_NULLABLE const char *s2)
Concatenate two paths to create a new one with s1+s2 with the correct path separator.
RZ_API void rz_getopt_init(RzGetopt *go, int argc, const char **argv, const char *ostr)
RZ_API int rz_getopt_next(RzGetopt *opt)
RZ_API char * rz_hex_bin2strdup(const ut8 *in, int len)
RZ_API ut64 rz_io_seek(RzIO *io, ut64 offset, int whence)
RZ_API void rz_io_free(RzIO *io)
RZ_API ut64 rz_io_size(RzIO *io)
RZ_API void rz_io_bind(RzIO *io, RzIOBind *bnd)
RZ_API bool rz_io_write_at(RzIO *io, ut64 addr, const ut8 *buf, int len)
RZ_API RzIODesc * rz_io_open_nomap(RzIO *io, const char *uri, int flags, int mode)
RZ_API int rz_io_pread_at(RzIO *io, ut64 paddr, ut8 *buf, int len)
RZ_API RzIO * rz_io_new(void)
RZ_API int rz_main_version_print(const char *program)
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
RZ_API PJ * pj_end(PJ *j)
RZ_API const char * pj_string(PJ *pj)
RZ_API void pj_free(PJ *j)
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
RZ_API PJ * pj_kn(PJ *j, const char *k, ut64 n)
#define RZ_STR_ISNOTEMPTY(x)
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API const char * rz_str_enc_as_string(RzStrEnc enc)
#define RZ_STR_ISEMPTY(x)
RZ_API char * rz_str_escape_sh(const char *buf)
RZ_API int rz_sys_cmdf(const char *fmt,...) RZ_PRINTF_CHECK(1
#define rz_sys_xsystem(cmd)
RZ_API RzList * rz_sys_dir(const char *path)
RZ_API int rz_search_update(RzSearch *s, ut64 from, const ut8 *buf, long len)
RZ_API void rz_search_set_callback(RzSearch *s, RzSearchCallback(callback), void *user)
RZ_API int rz_search_begin(RzSearch *s)
RZ_API RzSearch * rz_search_new(int mode)
RZ_API RzSearch * rz_search_free(RzSearch *s)
RZ_API int rz_search_kw_add(RzSearch *s, RzSearchKeyword *kw)
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr socklen_t static fromlen const void const struct sockaddr to
XX curplugin == o->plugin.
ut64(WINAPI *w32_GetEnabledXStateFeatures)()