mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-11 23:16:05 +00:00
List multidex as dependency libs ##bin
This commit is contained in:
parent
baa91ca899
commit
4232ac1763
@ -2114,6 +2114,32 @@ static RList *dex_fields(RBinFile *bf) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
static RList* libs(RBinFile *bf) {
|
||||
r_return_val_if_fail (bf && bf->o && bf->o->bin_obj, NULL);
|
||||
char *path = r_file_dirname (bf->file);
|
||||
RList *files = r_sys_dir (path);
|
||||
RList *ret = r_list_newf (free);
|
||||
if (!ret) {
|
||||
return NULL;
|
||||
}
|
||||
RListIter *iter;
|
||||
char *file;
|
||||
r_list_foreach (files, iter, file) {
|
||||
if (!r_str_startswith (file, "classes")) {
|
||||
continue;
|
||||
}
|
||||
if (r_str_endswith (file, ".dex")) {
|
||||
char *n = r_str_newf ("%s%s%s", path, R_SYS_DIR, file);
|
||||
if (strcmp (n, bf->file)) {
|
||||
r_list_append (ret, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
r_list_free (files);
|
||||
free (path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
RBinPlugin r_bin_plugin_dex = {
|
||||
.name = "dex",
|
||||
.desc = "dex format bin plugin",
|
||||
@ -2132,6 +2158,7 @@ RBinPlugin r_bin_plugin_dex = {
|
||||
.info = &info,
|
||||
.header = dex_header,
|
||||
.fields = dex_fields,
|
||||
.libs = &libs,
|
||||
.size = &size,
|
||||
.get_offset = &getoffset,
|
||||
.get_name = &getname,
|
||||
|
@ -538,25 +538,21 @@ static RList* imports(RBinFile *bf) {
|
||||
}
|
||||
|
||||
static RList* libs(RBinFile *bf) {
|
||||
struct r_bin_elf_lib_t *libs = NULL;
|
||||
RList *ret = NULL;
|
||||
char *ptr = NULL;
|
||||
int i;
|
||||
r_return_val_if_fail (bf && bf->o && bf->o->bin_obj, NULL);
|
||||
|
||||
if (!bf || !bf->o || !bf->o->bin_obj) {
|
||||
RList *ret = r_list_newf (free);
|
||||
if (!ret) {
|
||||
return NULL;
|
||||
}
|
||||
if (!(ret = r_list_newf (free))) {
|
||||
return NULL;
|
||||
struct r_bin_elf_lib_t *libs = Elf_(r_bin_elf_get_libs) (bf->o->bin_obj);
|
||||
if (libs) {
|
||||
int i;
|
||||
for (i = 0; !libs[i].last; i++) {
|
||||
char *ptr = strdup (libs[i].name);
|
||||
r_list_append (ret, ptr);
|
||||
}
|
||||
free (libs);
|
||||
}
|
||||
if (!(libs = Elf_(r_bin_elf_get_libs) (bf->o->bin_obj))) {
|
||||
return ret;
|
||||
}
|
||||
for (i = 0; !libs[i].last; i++) {
|
||||
ptr = strdup (libs[i].name);
|
||||
r_list_append (ret, ptr);
|
||||
}
|
||||
free (libs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user