Implement LDj command to list decompilers installed in json ##shell

This commit is contained in:
pancake 2022-05-30 20:23:47 +02:00 committed by pancake
parent 11b90ea6fd
commit 2e48978a8f

View File

@ -24,7 +24,7 @@ static const char *help_msg_L[] = {
"La", "[qj]", "list asm/anal plugins (see: aL, e asm.arch=" "??" ")",
"Lc", "", "list core plugins (see",
"Ld", "", "list debug plugins (dL)",
"LD", "", "list supported decompilers (e cmd.pdc=?)",
"LD", "[j]", "list supported decompilers (e cmd.pdc=?)",
"Le", "", "list esil plugins",
"Lg", "", "list egg plugins",
"Lh", "", "list hash plugins (ph)",
@ -369,6 +369,26 @@ static int cmd_plugins(void *data, const char *input) {
case 'D': // "LD"
if (input[1] == ' ') {
r_core_cmdf (core, "e cmd.pdc=%s", r_str_trim_head_ro (input + 2));
} else if (input[1] == 'j') {
char *deco;
RListIter *iter;
char *decos = r_core_cmd_str (core, "e cmd.pdc=?");
RList *list = r_str_split_list (decos, "\n", 0);
PJ *pj = r_core_pj_new (core);
pj_o (pj);
pj_ka (pj, "decompilers");
r_list_foreach (list, iter, deco) {
if (*deco) {
pj_s (pj, deco);
}
}
pj_end (pj);
pj_end (pj);
char *s = pj_drain (pj);
r_cons_printf ("%s\n", s);
free (s);
r_list_free (list);
free (decos);
} else {
r_core_cmd0 (core, "e cmd.pdc=?");
}