Remove bin.debase64 option. (#5405)

This commit is contained in:
Rot127 2025-09-22 16:59:12 +00:00 committed by GitHub
parent 3c9dd73f61
commit e7c0714b9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 3118 additions and 21 deletions

View file

@ -146,8 +146,6 @@ Guess size of binary program
.Pp
RZ_BIN_CODESIGN_VERBOSE: make code signatures verbose
.Pp
RZ_BIN_DEBASE64: e bin.debase64 - try to debase64 all strings
.Pp
RZ_BIN_DEBUGINFOD_URLS: e bin.dbginfo.debuginfod_urls - use alternative debuginfod server
.Pp
RZ_BIN_DEMANGLE: e bin.demangle - do not demangle symbols

View file

@ -32,10 +32,6 @@ RZ_IPI void rz_bin_set_and_process_strings(RzBinFile *bf, RzBinObject *o) {
string = *it;
// rebase physical address
string->paddr += o->opts.loadaddr;
if (bin->debase64) {
rz_bin_string_decode_base64(string);
}
}
o->strings = rz_bin_string_database_new(strings);

View file

@ -2596,13 +2596,6 @@ static bool cb_binhashesdefault(void *user, void *data) {
return true;
}
static bool cb_debase64(void *user, void *data) {
RzCore *core = (RzCore *)user;
RzConfigNode *node = (RzConfigNode *)data;
core->bin->debase64 = node->i_value;
return true;
}
static bool cb_binstrings(void *user, void *data) {
const ut32 req = RZ_BIN_REQ_STRINGS;
RzCore *core = (RzCore *)user;
@ -3407,7 +3400,6 @@ RZ_API int rz_core_config_init(RzCore *core) {
SETBPREF("bin.relocs", "true", "Load relocs information at startup if available");
SETCB("bin.prefix", "", &cb_binprefix, "Prefix all symbols/sections/relocs with a specific string");
SETCB("bin.strings", "true", &cb_binstrings, "Load strings from rbin on startup");
SETCB("bin.debase64", "false", &cb_debase64, "Try to debase64 all strings");
SETBPREF("bin.classes", "true", "Load classes from rbin on startup");
SETCB("bin.verbose", "false", &cb_binverbose, "Show RzBin warnings when loading binaries");
SETCB("bin.hashes.default", "md5,sha1,sha256,crc32,entropy,temperature", &cb_binhashesdefault, "Select hash algorithms");

View file

@ -718,6 +718,21 @@ RZ_API bool rz_project_migrate_v19_v20(RzProject *prj, RzSerializeResultInfo *re
return true;
}
// --
// Migration 20 -> 21
//
// Removal of bin.debase64 option.
RZ_API bool rz_project_migrate_v20_v21(RzProject *prj, RzSerializeResultInfo *res) {
Sdb *core_db;
RZ_SERIALIZE_SUB(prj, core_db, res, "core", return false;);
Sdb *config_db;
RZ_SERIALIZE_SUB(core_db, config_db, res, "config", return false;);
sdb_remove(config_db, "bin.debase64");
return true;
}
static bool (*const migrations[])(RzProject *prj, RzSerializeResultInfo *res) = {
rz_project_migrate_v1_v2,
rz_project_migrate_v2_v3,
@ -738,6 +753,7 @@ static bool (*const migrations[])(RzProject *prj, RzSerializeResultInfo *res) =
rz_project_migrate_v17_v18,
rz_project_migrate_v18_v19,
rz_project_migrate_v19_v20,
rz_project_migrate_v20_v21,
};
/// Migrate the given project to the current version in-place

View file

@ -387,7 +387,6 @@ struct rz_bin_t {
void *user;
RzEvent *event;
/* preconfigured values */
int debase64;
ut64 maxstrbuf;
int rawstr;
RZ_DEPRECATE Sdb *sdb;

View file

@ -12,7 +12,7 @@
extern "C" {
#endif
#define RZ_PROJECT_VERSION 20
#define RZ_PROJECT_VERSION 21
typedef Sdb RzProject;
@ -64,6 +64,8 @@ RZ_API bool rz_project_migrate_v15_v16(RzProject *prj, RzSerializeResultInfo *re
RZ_API bool rz_project_migrate_v16_v17(RzProject *prj, RzSerializeResultInfo *res);
RZ_API bool rz_project_migrate_v17_v18(RzProject *prj, RzSerializeResultInfo *res);
RZ_API bool rz_project_migrate_v18_v19(RzProject *prj, RzSerializeResultInfo *res);
RZ_API bool rz_project_migrate_v19_v20(RzProject *prj, RzSerializeResultInfo *res);
RZ_API bool rz_project_migrate_v20_v21(RzProject *prj, RzSerializeResultInfo *res);
RZ_API bool rz_project_migrate(RzProject *prj, unsigned long version, RzSerializeResultInfo *res);
#ifdef __cplusplus

View file

@ -236,7 +236,6 @@ static int rzbin_show_help(int v) {
if (v) {
printf("Environment:\n"
" RZ_BIN_CODESIGN_VERBOSE: # make code signatures verbose\n"
" RZ_BIN_DEBASE64: e bin.debase64 # try to debase64 all strings\n"
" RZ_BIN_DEBUGINFOD_URLS: e bin.dbginfo.debuginfod_urls # use alternative debuginfod server\n"
" RZ_BIN_DEMANGLE=0: e bin.demangle # do not demangle symbols\n"
" RZ_BIN_LANG: e bin.lang # assume lang for demangling\n"
@ -795,10 +794,6 @@ RZ_API int rz_main_rz_bin(int argc, const char **argv) {
rz_config_set(core.config, "bin.str.purge", tmp);
free(tmp);
}
if ((tmp = rz_sys_getenv("RZ_BIN_DEBASE64"))) {
rz_config_set(core.config, "bin.debase64", tmp);
free(tmp);
}
if ((tmp = rz_sys_getenv("RZ_BIN_PDBSERVER"))) {
rz_config_set(core.config, "pdb.server", tmp);
free(tmp);

View file

@ -378,6 +378,7 @@ Detailed project load info:
project migrated from version 17 to 18.
project migrated from version 18 to 19.
project migrated from version 19 to 20.
project migrated from version 20 to 21.
EOF
RUN

View file

@ -604,6 +604,24 @@ static bool test_migrate_v18_v19_str_config() {
mu_end;
}
static bool test_migrate_v20_v21_debase64() {
RzProject *prj = rz_project_load_file_raw("prj/v20-debase64.rzdb");
mu_assert_notnull(prj, "load raw project");
RzSerializeResultInfo *res = rz_serialize_result_info_new();
bool s = rz_project_migrate_v20_v21(prj, res);
mu_assert_true(s, "migrate success");
Sdb *core_db = sdb_ns(prj, "core", false);
mu_assert_notnull(core_db, "core ns");
Sdb *config_db = sdb_ns(core_db, "config", false);
mu_assert_notnull(config_db, "config ns");
mu_assert_null(sdb_get(config_db, "bin.debase64"), "bin.debase64 still there.");
rz_serialize_result_info_free(res);
rz_project_free(prj);
mu_end;
}
static bool test_migrate_v16_v17_flags_base() {
RzProject *prj = rz_project_load_file_raw("prj/v16-flags-base.rzdb");
mu_assert_notnull(prj, "load raw project");
@ -1056,6 +1074,7 @@ int all_tests() {
mu_run_test(test_migrate_v16_v17_flags_base);
mu_run_test(test_migrate_v17_v18_rop_config);
mu_run_test(test_migrate_v18_v19_str_config);
mu_run_test(test_migrate_v20_v21_debase64);
mu_run_test(test_load_v1_noreturn);
mu_run_test(test_load_v1_noreturn_empty);
mu_run_test(test_load_v1_unknown_type);

3079
test/prj/v20-debase64.rzdb Normal file

File diff suppressed because it is too large Load diff