From d74775cb6d2528d05f45e662187671f7246357c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20S=C3=A1nchez?= Date: Fri, 14 Jul 2017 11:12:53 +0000 Subject: [PATCH] Added resources extraction to rabin2 (#7912) --- binr/rabin2/rabin2.c | 7 +++++-- libr/include/r_bin.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/binr/rabin2/rabin2.c b/binr/rabin2/rabin2.c index 18c19dbded..11e7231980 100644 --- a/binr/rabin2/rabin2.c +++ b/binr/rabin2/rabin2.c @@ -25,7 +25,7 @@ static ut64 at = 0LL; static RLib *l; static int rabin_show_help(int v) { - printf ("Usage: rabin2 [-AcdeEghHiIjlLMqrRsSvVxzZ] [-@ at] [-a arch] [-b bits] [-B addr]\n" + printf ("Usage: rabin2 [-AcdeEghHiIjlLMqrRsSUvVxzZ] [-@ at] [-a arch] [-b bits] [-B addr]\n" " [-C F:C:D] [-f str] [-m addr] [-n str] [-N m:M] [-P[-P] pdb]\n" " [-o str] [-O str] [-k query] [-D lang symname] | file\n"); if (v) { @@ -71,6 +71,7 @@ static int rabin_show_help(int v) { " -s symbols\n" " -S sections\n" " -u unfiltered (no rename duplicated symbols/sections)\n" + " -U resoUrces\n" " -v display version and quit\n" " -V Show binary version information\n" " -x extract bins contained in file\n" @@ -608,7 +609,7 @@ int main(int argc, char **argv) { #define is_active(x) (action & x) #define set_action(x) actions++; action |= x #define unset_action(x) action &= ~x - while ((c = getopt (argc, argv, "DjgAf:F:a:B:G:b:cC:k:K:dD:Mm:n:N:@:isSVIHeElRwO:o:pPqQrvLhuxXzZ")) != -1) { + while ((c = getopt (argc, argv, "DjgAf:F:a:B:G:b:cC:k:K:dD:Mm:n:N:@:isSVIHeEUlRwO:o:pPqQrvLhuxXzZ")) != -1) { switch (c) { case 'g': set_action (R_BIN_REQ_CLASSES); @@ -690,6 +691,7 @@ int main(int argc, char **argv) { break; case 'e': set_action (R_BIN_REQ_ENTRIES); break; case 'E': set_action (R_BIN_REQ_EXPORTS); break; + case 'U': set_action (R_BIN_REQ_RESOURCES); break; case 'Q': set_action (R_BIN_REQ_DLOPEN); break; case 'M': set_action (R_BIN_REQ_MAIN); break; case 'l': set_action (R_BIN_REQ_LIBS); break; @@ -1021,6 +1023,7 @@ int main(int argc, char **argv) { run_action ("classes", R_BIN_REQ_CLASSES, R_CORE_BIN_ACC_CLASSES); run_action ("symbols", R_BIN_REQ_SYMBOLS, R_CORE_BIN_ACC_SYMBOLS); run_action ("exports", R_BIN_REQ_EXPORTS, R_CORE_BIN_ACC_EXPORTS); + run_action ("resources", R_BIN_REQ_RESOURCES, R_CORE_BIN_ACC_RESOURCES); run_action ("strings", R_BIN_REQ_STRINGS, R_CORE_BIN_ACC_STRINGS); run_action ("info", R_BIN_REQ_INFO, R_CORE_BIN_ACC_INFO); run_action ("fields", R_BIN_REQ_FIELDS, R_CORE_BIN_ACC_FIELDS); diff --git a/libr/include/r_bin.h b/libr/include/r_bin.h index 89a65bdae1..692ce4ec4e 100644 --- a/libr/include/r_bin.h +++ b/libr/include/r_bin.h @@ -64,6 +64,7 @@ R_LIB_VERSION_HEADER (r_bin); #define R_BIN_REQ_PACKAGE 0x1000000 #define R_BIN_REQ_HEADER 0x2000000 #define R_BIN_REQ_LISTPLUGINS 0x4000000 +#define R_BIN_REQ_RESOURCES 0x8000000 /* RBinSymbol->method_flags : */ #define R_BIN_METH_CLASS 0x0000000000000001L