Rizin
unix-like reverse engineering framework and cli tools
rz-find.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2009-2020 pancake <pancake@nopcode.org>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <stdio.h>
5 #include <stdlib.h>
6 
7 #include <rz_core.h>
8 #include <rz_main.h>
9 #include <rz_types.h>
10 #include <rz_search.h>
11 #include <rz_util.h>
12 #include <rz_util/rz_print.h>
13 #include <rz_cons.h>
14 #include <rz_lib.h>
15 #include <rz_io.h>
16 #include <rz_bin.h>
17 
18 typedef struct {
19  bool showstr;
20  bool rad;
21  bool identify;
22  bool import; /* search within import table */
23  bool symbol; /* search within symbol table */
24  bool quiet;
25  bool hexstr;
26  bool widestr;
27  bool nonstop;
28  bool json;
29  int mode;
30  int align;
31  ut8 *buf;
38  const char *mask;
39  const char *curfile;
40  const char *comma;
42 
44  free(ro->buf);
45  ro->cur = 0;
46 }
47 
49  memset(ro, 0, sizeof(RzfindOptions));
50  ro->mode = RZ_SEARCH_STRING;
51  ro->bsize = 4096;
52  ro->to = UT64_MAX;
53  ro->keywords = rz_list_newf(NULL);
54 }
55 
56 static int rzfind_open(RzfindOptions *ro, const char *file);
57 
58 static int hit(RzSearchKeyword *kw, void *user, ut64 addr) {
59  RzfindOptions *ro = (RzfindOptions *)user;
60  int delta = addr - ro->cur;
61  if (ro->cur > addr && (ro->cur - addr == kw->keyword_length - 1)) {
62  // This case occurs when there is hit in search left over
63  delta = ro->cur - addr;
64  }
65  if (delta < 0 || delta >= ro->bsize) {
66  eprintf("Invalid delta\n");
67  return 0;
68  }
69  char _str[128];
70  char *str = _str;
71  *_str = 0;
72  if (ro->showstr) {
73  if (ro->widestr) {
74  str = _str;
75  int i, j = 0;
76  for (i = delta; ro->buf[i] && i < sizeof(_str); i++) {
77  char ch = ro->buf[i];
78  if (ch == '"' || ch == '\\') {
79  ch = '\'';
80  }
81  if (!IS_PRINTABLE(ch)) {
82  break;
83  }
84  str[j++] = ch;
85  i++;
86  if (j > 80) {
87  strcpy(str + j, "...");
88  j += 3;
89  break;
90  }
91  if (ro->buf[i]) {
92  break;
93  }
94  }
95  str[j] = 0;
96  } else {
97  size_t i;
98  for (i = 0; i < sizeof(_str) - 1; i++) {
99  char ch = ro->buf[delta + i];
100  if (ch == '"' || ch == '\\') {
101  ch = '\'';
102  }
103  if (!ch || !IS_PRINTABLE(ch)) {
104  break;
105  }
106  str[i] = ch;
107  }
108  str[i] = 0;
109  }
110  } else {
111  size_t i;
112  for (i = 0; i < sizeof(_str) - 1; i++) {
113  char ch = ro->buf[delta + i];
114  if (ch == '"' || ch == '\\') {
115  ch = '\'';
116  }
117  if (!ch || !IS_PRINTABLE(ch)) {
118  break;
119  }
120  str[i] = ch;
121  }
122  str[i] = 0;
123  }
124  if (ro->json) {
125  const char *type = "string";
126  printf("%s{\"offset\":%" PFMT64d ",\"type\":\"%s\",\"data\":\"%s\"}",
127  ro->comma, addr, type, str);
128  ro->comma = ",";
129  } else if (ro->rad) {
130  printf("f hit%d_%d @ 0x%08" PFMT64x " ; %s\n", 0, kw->count, addr, ro->curfile);
131  } else {
132  if (ro->showstr) {
133  printf("0x%" PFMT64x " %s\n", addr, str);
134  } else {
135  printf("0x%" PFMT64x "\n", addr);
136  if (ro->pr) {
137  char *dump = rz_print_hexdump_str(ro->pr, addr, (ut8 *)ro->buf + delta, 78, 16, 1, 1);
138  printf("%s", dump);
139  free(dump);
140  }
141  }
142  }
143  return 1;
144 }
145 
146 static void print_bin_string(RzBinFile *bf, RzBinString *string, PJ *pj) {
147  rz_return_if_fail(bf && string);
148 
149  RzBinSection *s = rz_bin_get_section_at(bf->o, string->paddr, false);
150  if (s) {
151  string->vaddr = s->vaddr + (string->paddr - s->paddr);
152  }
153  string->vaddr = bf->o ? rz_bin_object_get_vaddr(bf->o, string->paddr, string->vaddr) : UT64_MAX;
154 
155  if (pj) {
156  const char *section_name = s ? s->name : "";
157  const char *type_string = rz_str_enc_as_string(string->type);
158  pj_o(pj);
159  pj_kn(pj, "vaddr", string->vaddr);
160  pj_kn(pj, "paddr", string->paddr);
161  pj_kn(pj, "ordinal", string->ordinal);
162  pj_kn(pj, "size", string->size);
163  pj_kn(pj, "length", string->length);
164  pj_ks(pj, "section", section_name);
165  pj_ks(pj, "type", type_string);
166  pj_ks(pj, "string", string->string);
167  pj_end(pj);
168  } else {
169  printf("%s\n", string->string);
170  }
171 }
172 
173 static int show_help(const char *argv0, int line) {
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);
175  if (line) {
176  return 0;
177  }
178  printf(
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");
202  return 0;
203 }
204 
205 static int rzfind_open_file(RzfindOptions *ro, const char *file, const ut8 *data, int datalen) {
206  RzListIter *iter;
207  RzSearch *rs = NULL;
208  const char *kw;
209  bool last = false;
210  int ret, result = 0;
211 
212  ro->buf = NULL;
213  if (!ro->quiet) {
214  printf("File: %s\n", file);
215  }
216 
217  char *efile = rz_str_escape_sh(file);
218 
219  if (ro->identify) {
220  char *cmd = rz_str_newf("rizin -e search.show=false -e search.maxhits=1 -nqcpm \"%s\"", efile);
222  free(cmd);
223  free(efile);
224  return 0;
225  }
226 
227  if (ro->import || ro->symbol) {
228  RzBinFile *bf;
229  const RzList *symbols, *imports;
230  RzListIter *iter, *it;
231  RzBinSymbol *symbol;
232  RzBinImport *import;
233  RzBin *bin = rz_bin_new();
234  RzIO *rio = rz_io_new();
235  RzBinOptions opt = { 0 };
236 
237  if (!bin || !rio) {
238  result = 1;
239  goto sym_end;
240  }
241 
242  rz_io_bind(rio, &bin->iob);
243  rz_bin_options_init(&opt, 0, 0, 0, false);
244 
245  bf = rz_bin_open(bin, file, &opt);
246  if (!bf) {
247  result = 1;
248  goto sym_end;
249  }
250 
251  if (ro->import) {
253  rz_list_foreach (ro->keywords, iter, kw) {
254  rz_list_foreach (imports, it, import) {
255  if (!strcmp(import->name, kw)) {
256  printf("ordinal: %d %s\n", import->ordinal, kw);
257  }
258  }
259  }
260  }
261 
262  if (ro->symbol) {
264  rz_list_foreach (ro->keywords, iter, kw) {
265  rz_list_foreach (symbols, it, symbol) {
266  if (!symbol->name) {
267  continue;
268  }
269 
270  if (!strcmp(symbol->name, kw)) {
271  printf("paddr: 0x%08" PFMT64x " vaddr: 0x%08" PFMT64x " type: %s %s\n", symbol->paddr, symbol->vaddr, symbol->type, symbol->name);
272  }
273  }
274  }
275  }
276 
277  result = 0;
278 
279  sym_end:
280  rz_bin_free(bin);
281  rz_io_free(rio);
282  free(efile);
283  return result;
284  }
285 
286  RzIO *io = rz_io_new();
287  if (!io) {
288  free(efile);
289  return 1;
290  }
291 
292  if (!rz_io_open_nomap(io, file, RZ_PERM_R, 0)) {
293  eprintf("Cannot open file '%s'\n", file);
294  result = 1;
295  goto err;
296  }
297 
298  if (data) {
299  rz_io_write_at(io, 0, data, datalen);
300  }
301 
302  rs = rz_search_new(ro->mode);
303  if (!rs) {
304  result = 1;
305  goto err;
306  }
307 
308  ro->buf = calloc(1, ro->bsize);
309  if (!ro->buf) {
310  eprintf("Cannot allocate %" PFMT64d " bytes\n", ro->bsize);
311  result = 1;
312  goto err;
313  }
314  rs->align = ro->align;
316  ut64 to = ro->to;
317  if (to == -1) {
318  to = rz_io_size(io);
319  }
320 
321  if (!rz_cons_new()) {
322  result = 1;
323  goto err;
324  }
325 
326  RzBinOptions opt;
327  rz_bin_options_init(&opt, 0, 0, 0, false);
328  RzBin *bin = rz_bin_new();
329  rz_io_bind(io, &bin->iob);
330  io->cb_printf = printf;
331  RzBinFile *bf = rz_bin_open(bin, file, &opt);
332 
333  if (ro->mode == RZ_SEARCH_STRING) {
334  PJ *pj = NULL;
335  if (ro->json) {
336  pj = pj_new();
337  if (!pj) {
338  eprintf("rz-bin: Cannot allocate buffer for json array\n");
339  result = 1;
340  goto err;
341  }
342  pj_a(pj);
343  }
344  RzList *list = rz_bin_file_strings(bf, bin->minstrlen, true);
345  RzListIter *it;
346  RzBinString *string;
347  rz_list_foreach (list, it, string) {
348  print_bin_string(bf, string, pj);
349  }
351  if (pj) {
352  pj_end(pj);
353  printf("%s", pj_string(pj));
354  pj_free(pj);
355  }
356  goto done;
357  }
358 
359  if (ro->mode == RZ_SEARCH_MAGIC) {
360  /* TODO: implement using api */
361  char *tostr = (to && to != UT64_MAX) ? rz_str_newf("-e search.to=%" PFMT64d, to) : strdup("");
362  rz_sys_cmdf("rizin"
363  " -e search.in=range"
364  " -e search.align=%d"
365  " -e search.from=%" PFMT64d
366  " %s -qnc/m%s \"%s\"",
367  ro->align, ro->from, tostr, ro->json ? "j" : "", efile);
368  free(tostr);
369  goto done;
370  }
371  if (ro->mode == RZ_SEARCH_ESIL) {
372  /* TODO: implement using api */
373  rz_list_foreach (ro->keywords, iter, kw) {
374  rz_sys_cmdf("rizin -qc \"/E %s\" \"%s\"", kw, efile);
375  }
376  goto done;
377  }
378  if (ro->mode == RZ_SEARCH_KEYWORD) {
379  rz_list_foreach (ro->keywords, iter, kw) {
380  if (ro->hexstr) {
381  if (ro->mask) {
383  } else {
385  }
386  } else if (ro->widestr) {
388  } else {
390  }
391  }
392  } else if (ro->mode == RZ_SEARCH_STRING) {
394  }
395 
396  ro->curfile = file;
398  (void)rz_io_seek(io, ro->from, RZ_IO_SEEK_SET);
399  result = 0;
400  ut64 bsize = ro->bsize;
401  for (ro->cur = ro->from; !last && ro->cur < to; ro->cur += bsize) {
402  if ((ro->cur + bsize) > to) {
403  bsize = to - ro->cur;
404  last = true;
405  }
406  ret = rz_io_pread_at(io, ro->cur, ro->buf, bsize);
407  if (ret == 0) {
408  if (ro->nonstop) {
409  continue;
410  }
411  result = 1;
412  break;
413  }
414  if (ret != bsize && ret > 0) {
415  bsize = ret;
416  }
417 
418  if (rz_search_update(rs, ro->cur, ro->buf, ret) == -1) {
419  eprintf("search: update read error at 0x%08" PFMT64x "\n", ro->cur);
420  break;
421  }
422  }
423 done:
424  rz_cons_free();
425  rz_bin_free(bin);
426 err:
427  free(efile);
429  rz_io_free(io);
431  return result;
432 }
433 
434 static int rzfind_open_dir(RzfindOptions *ro, const char *dir) {
435  RzListIter *iter;
436  char *fullpath;
437  char *fname = NULL;
438 
439  RzList *files = rz_sys_dir(dir);
440 
441  if (files) {
442  rz_list_foreach (files, iter, fname) {
443  /* Filter-out unwanted entries */
444  if (*fname == '.') {
445  continue;
446  }
447  fullpath = rz_file_path_join(dir, fname);
448  (void)rzfind_open(ro, fullpath);
449  free(fullpath);
450  }
452  }
453  return 0;
454 }
455 
456 static int rzfind_open(RzfindOptions *ro, const char *file) {
457  if (!strcmp(file, "-")) {
458  int sz = 0;
459  ut8 *buf = (ut8 *)rz_stdin_slurp(&sz);
460  if (!buf) {
461  return 0;
462  }
463  char *ff = rz_str_newf("malloc://%d", sz);
464  int res = rzfind_open_file(ro, ff, buf, sz);
465  free(ff);
466  free(buf);
467  return res;
468  }
469  return rz_file_is_directory(file)
470  ? rzfind_open_dir(ro, file)
471  : rzfind_open_file(ro, file, NULL, -1);
472 }
473 
474 RZ_API int rz_main_rz_find(int argc, const char **argv) {
475  RzfindOptions ro;
476  rzfind_options_init(&ro);
477 
478  int c;
479  const char *file = NULL;
480 
481  RzGetopt opt;
482  rz_getopt_init(&opt, argc, argv, "a:ie:b:jmM:s:w:S:I:x:Xzf:F:t:E:rqnhvZ");
483  while ((c = rz_getopt_next(&opt)) != -1) {
484  switch (c) {
485  case 'a':
486  ro.align = rz_num_math(NULL, opt.arg);
487  break;
488  case 'r':
489  ro.rad = true;
490  break;
491  case 'i':
492  ro.identify = true;
493  break;
494  case 'j':
495  ro.json = true;
496  break;
497  case 'n':
498  ro.nonstop = 1;
499  break;
500  case 'm':
501  ro.mode = RZ_SEARCH_MAGIC;
502  break;
503  case 'e':
504  ro.mode = RZ_SEARCH_REGEXP;
505  ro.hexstr = 0;
506  rz_list_append(ro.keywords, (void *)opt.arg);
507  break;
508  case 'E':
509  ro.mode = RZ_SEARCH_ESIL;
510  rz_list_append(ro.keywords, (void *)opt.arg);
511  break;
512  case 's':
513  ro.mode = RZ_SEARCH_KEYWORD;
514  ro.hexstr = false;
515  ro.widestr = false;
516  rz_list_append(ro.keywords, (void *)opt.arg);
517  break;
518  case 'w':
519  ro.mode = RZ_SEARCH_KEYWORD;
520  ro.hexstr = false;
521  ro.widestr = true;
522  rz_list_append(ro.keywords, (void *)opt.arg);
523  break;
524  case 'I':
525  ro.import = true;
526  rz_list_append(ro.keywords, (void *)opt.arg);
527  break;
528  case 'S':
529  ro.symbol = true;
530  rz_list_append(ro.keywords, (void *)opt.arg);
531  break;
532  case 'b':
533  ro.bsize = rz_num_math(NULL, opt.arg);
534  break;
535  case 'M':
536  // XXX should be from hexbin
537  ro.mask = opt.arg;
538  break;
539  case 'f':
540  ro.from = rz_num_math(NULL, opt.arg);
541  break;
542  case 'F': {
543  size_t data_size;
544  char *data = rz_file_slurp(opt.arg, &data_size);
545  if (!data) {
546  eprintf("Cannot slurp '%s'\n", opt.arg);
547  return 1;
548  }
549  char *hexdata = rz_hex_bin2strdup((ut8 *)data, data_size);
550  if (hexdata) {
551  ro.mode = RZ_SEARCH_KEYWORD;
552  ro.hexstr = true;
553  ro.widestr = false;
554  rz_list_append(ro.keywords, (void *)hexdata);
555  }
556  free(data);
557  } break;
558  case 't':
559  ro.to = rz_num_math(NULL, opt.arg);
560  break;
561  case 'x':
562  ro.mode = RZ_SEARCH_KEYWORD;
563  ro.hexstr = 1;
564  ro.widestr = 0;
565  rz_list_append(ro.keywords, (void *)opt.arg);
566  break;
567  case 'X':
568  ro.pr = rz_print_new();
569  break;
570  case 'q':
571  ro.quiet = true;
572  break;
573  case 'v':
574  return rz_main_version_print("rz-find");
575  case 'h':
576  return show_help(argv[0], 0);
577  case 'z':
578  ro.mode = RZ_SEARCH_STRING;
579  break;
580  case 'Z':
581  ro.showstr = true;
582  break;
583  default:
584  return show_help(argv[0], 1);
585  }
586  }
587  if (opt.ind == argc) {
588  return show_help(argv[0], 1);
589  }
590  /* Enable quiet mode if searching just a single file */
591  if (opt.ind + 1 == argc && RZ_STR_ISNOTEMPTY(argv[opt.ind]) && !rz_file_is_directory(argv[opt.ind])) {
592  ro.quiet = true;
593  }
594  if (ro.json) {
595  printf("[");
596  }
597  for (; opt.ind < argc; opt.ind++) {
598  file = argv[opt.ind];
599 
600  if (RZ_STR_ISEMPTY(file)) {
601  eprintf("Cannot open empty path\n");
603  return 1;
604  }
605  rzfind_open(&ro, file);
606  }
608  if (ro.json) {
609  printf("]\n");
610  }
611  return 0;
612 }
#define rs()
lzma_index ** i
Definition: index.h:629
static bool err
Definition: armass.c:435
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.
Definition: bfile_string.c:325
RZ_API RzBin * rz_bin_new(void)
Definition: bin.c:716
RZ_API RZ_BORROW RzBinSection * rz_bin_get_section_at(RzBinObject *o, ut64 off, int va)
Find the binary section at offset off.
Definition: bin.c:611
RZ_API void rz_bin_options_init(RzBinOptions *opt, int fd, ut64 baseaddr, ut64 loadaddr, bool patch_relocs)
Definition: bin.c:75
RZ_API RzBinFile * rz_bin_open(RzBin *bin, const char *file, RzBinOptions *opt)
Definition: bin.c:200
RZ_API void rz_bin_free(RzBin *bin)
Definition: bin.c:440
RzList * symbols(RzBinFile *bf)
Definition: bin_ne.c:102
RzList * imports(RzBinFile *bf)
Definition: bin_ne.c:106
RZ_API const RzList * rz_bin_object_get_imports(RZ_NONNULL RzBinObject *obj)
Get list of RzBinImport representing the imports of the binary object.
Definition: bobj.c:726
RZ_API ut64 rz_bin_object_get_vaddr(RzBinObject *o, ut64 paddr, ut64 vaddr)
Definition: bobj.c:669
RZ_API const RzList * rz_bin_object_get_symbols(RZ_NONNULL RzBinObject *obj)
Get list of RzBinSymbol representing the symbols in the binary object.
Definition: bobj.c:817
RZ_API RzCons * rz_cons_new(void)
Definition: cons.c:589
RZ_API RzCons * rz_cons_free(void)
Definition: cons.c:658
#define RZ_API
#define NULL
Definition: cris-opc.c:27
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
Definition: cs_driver.c:93
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
Definition: sflib.h:79
struct tab * done
Definition: enough.c:233
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
Definition: file_opts.h:46
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
voidpf void * buf
Definition: ioapi.h:138
RZ_API RzSearchKeyword * rz_search_keyword_new_str(const char *kwbuf, const char *bmstr, const char *data, int ignore_case)
Definition: keyword.c:58
RZ_API RzSearchKeyword * rz_search_keyword_new_wide(const char *kwbuf, const char *bmstr, const char *data, int ignore_case)
Definition: keyword.c:82
RZ_API RzSearchKeyword * rz_search_keyword_new_hex(const char *kwstr, const char *bmstr, const char *data)
Definition: keyword.c:132
RZ_API RzSearchKeyword * rz_search_keyword_new_hexmask(const char *kwstr, const char *data)
Definition: keyword.c:173
uint8_t ut8
Definition: lh5801.h:11
return memset(p, 0, total)
static int show_help(const char *argv0, int line)
Definition: rz-find.c:173
static int rzfind_open(RzfindOptions *ro, const char *file)
Definition: rz-find.c:456
static void print_bin_string(RzBinFile *bf, RzBinString *string, PJ *pj)
Definition: rz-find.c:146
RZ_API int rz_main_rz_find(int argc, const char **argv)
Definition: rz-find.c:474
static int rzfind_open_file(RzfindOptions *ro, const char *file, const ut8 *data, int datalen)
Definition: rz-find.c:205
static void rzfind_options_init(RzfindOptions *ro)
Definition: rz-find.c:48
static int rzfind_open_dir(RzfindOptions *ro, const char *dir)
Definition: rz-find.c:434
static int hit(RzSearchKeyword *kw, void *user, ut64 addr)
Definition: rz-find.c:58
static void rzfind_options_fini(RzfindOptions *ro)
Definition: rz-find.c:43
static void list(RzEgg *egg)
Definition: rz-gg.c:52
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
Definition: list.c:248
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
Definition: list.c:288
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
Definition: list.c:137
void * calloc(size_t number, size_t size)
Definition: malloc.c:102
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40
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")
int type
Definition: mipsasm.c:17
line
Definition: setup.py:34
RZ_API RzPrint * rz_print_new(void)
Definition: print.c:56
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.
Definition: print.c:573
#define eprintf(x, y...)
Definition: rlcc.c:7
static RzSocket * s
Definition: rtr.c:28
#define rz_return_if_fail(expr)
Definition: rz_assert.h:100
RZ_API bool rz_file_is_directory(const char *str)
Definition: file.c:167
RZ_API char * rz_stdin_slurp(int *sz)
Definition: file.c:408
RZ_API RZ_OWN char * rz_file_slurp(const char *str, RZ_NULLABLE size_t *usz)
Definition: file.c:454
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.
Definition: file.c:1312
RZ_API void rz_getopt_init(RzGetopt *go, int argc, const char **argv, const char *ostr)
Definition: getopt.c:17
RZ_API int rz_getopt_next(RzGetopt *opt)
Definition: getopt.c:29
RZ_API char * rz_hex_bin2strdup(const ut8 *in, int len)
Definition: hex.c:415
RZ_API ut64 rz_io_seek(RzIO *io, ut64 offset, int whence)
Definition: io.c:632
RZ_API void rz_io_free(RzIO *io)
Definition: io.c:126
RZ_API ut64 rz_io_size(RzIO *io)
Definition: io.c:399
RZ_API void rz_io_bind(RzIO *io, RzIOBind *bnd)
Definition: io.c:550
#define RZ_IO_SEEK_SET
Definition: rz_io.h:15
RZ_API bool rz_io_write_at(RzIO *io, ut64 addr, const ut8 *buf, int len)
Definition: io.c:358
RZ_API RzIODesc * rz_io_open_nomap(RzIO *io, const char *uri, int flags, int mode)
Definition: io.c:145
RZ_API int rz_io_pread_at(RzIO *io, ut64 paddr, ut8 *buf, int len)
Definition: io.c:269
RZ_API RzIO * rz_io_new(void)
Definition: io.c:110
RZ_API int rz_main_version_print(const char *program)
Definition: main.c:49
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
Definition: unum.c:456
RZ_API PJ * pj_new(void)
Definition: pj.c:25
RZ_API PJ * pj_end(PJ *j)
Definition: pj.c:87
RZ_API const char * pj_string(PJ *pj)
Definition: pj.c:57
RZ_API void pj_free(PJ *j)
Definition: pj.c:34
RZ_API PJ * pj_o(PJ *j)
Definition: pj.c:75
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
Definition: pj.c:170
RZ_API PJ * pj_kn(PJ *j, const char *k, ut64 n)
Definition: pj.c:121
RZ_API PJ * pj_a(PJ *j)
Definition: pj.c:81
@ RZ_SEARCH_REGEXP
Definition: rz_search.h:18
@ RZ_SEARCH_STRING
Definition: rz_search.h:20
@ RZ_SEARCH_ESIL
Definition: rz_search.h:16
@ RZ_SEARCH_MAGIC
Definition: rz_search.h:25
@ RZ_SEARCH_KEYWORD
Definition: rz_search.h:17
#define RZ_STR_ISNOTEMPTY(x)
Definition: rz_str.h:68
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API const char * rz_str_enc_as_string(RzStrEnc enc)
Definition: str.c:44
#define RZ_STR_ISEMPTY(x)
Definition: rz_str.h:67
RZ_API char * rz_str_escape_sh(const char *buf)
Definition: str.c:1560
#define IS_PRINTABLE(x)
Definition: rz_str_util.h:10
RZ_API int rz_sys_cmdf(const char *fmt,...) RZ_PRINTF_CHECK(1
#define rz_sys_xsystem(cmd)
Definition: rz_sys.h:83
RZ_API RzList * rz_sys_dir(const char *path)
Definition: sys.c:216
#define PFMT64d
Definition: rz_types.h:394
#define RZ_PERM_R
Definition: rz_types.h:93
#define PFMT64x
Definition: rz_types.h:393
#define UT64_MAX
Definition: rz_types_base.h:86
RZ_API int rz_search_update(RzSearch *s, ut64 from, const ut8 *buf, long len)
Definition: search.c:470
RZ_API void rz_search_set_callback(RzSearch *s, RzSearchCallback(callback), void *user)
Definition: search.c:463
RZ_API int rz_search_begin(RzSearch *s)
Definition: search.c:96
RZ_API RzSearch * rz_search_new(int mode)
Definition: search.c:19
RZ_API RzSearch * rz_search_free(RzSearch *s)
Definition: search.c:52
RZ_API int rz_search_kw_add(RzSearch *s, RzSearchKeyword *kw)
Definition: search.c:506
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr socklen_t static fromlen const void const struct sockaddr to
Definition: sfsocketcall.h:125
#define c(i)
Definition: sha256.c:43
bool import
Definition: rz-find.c:22
bool showstr
Definition: rz-find.c:19
bool symbol
Definition: rz-find.c:23
bool hexstr
Definition: rz-find.c:25
ut8 * buf
Definition: rz-find.c:31
bool rad
Definition: rz-find.c:20
const char * mask
Definition: rz-find.c:38
RzList * keywords
Definition: rz-find.c:37
ut64 bsize
Definition: rz-find.c:32
bool widestr
Definition: rz-find.c:26
bool nonstop
Definition: rz-find.c:27
RzPrint * pr
Definition: rz-find.c:36
bool quiet
Definition: rz-find.c:24
const char * comma
Definition: rz-find.c:40
ut64 from
Definition: rz-find.c:33
bool identify
Definition: rz-find.c:21
const char * curfile
Definition: rz-find.c:39
ut64 cur
Definition: rz-find.c:35
bool json
Definition: rz-find.c:28
Definition: malloc.c:26
Definition: gzappend.c:170
Definition: rz_pj.h:12
XX curplugin == o->plugin.
Definition: rz_bin.h:298
RzBinObject * o
Definition: rz_bin.h:305
ut32 ordinal
Definition: rz_bin.h:755
char * string
Definition: rz_bin.h:752
const char * type
Definition: rz_bin.h:682
char * name
Definition: rz_bin.h:675
const char * arg
Definition: rz_getopt.h:15
Definition: rz_io.h:59
PrintfCallback cb_printf
Definition: rz_io.h:91
static st64 delta
Definition: vmenus.c:2425
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int file
Definition: z80asm.c:58
static int addr
Definition: z80asm.c:58