如何正确安装和调用"r2snow" radare2反编译器? [英] How can I properly install and invoke 'r2snow' radare2 decompiler?

查看:82
本文介绍了如何正确安装和调用"r2snow" radare2反编译器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了过去几个小时尝试安装反编译器,但没有成功.由于我最近一直在使用 radare2 作为反汇编程序,因此我认为使用相关的反编译程序包会很好用.找出 radeco r2snow 〜/.local/share/radare2/prefix/bin 中的BASH脚本.

I have spent the past several hours attempting to install a decompiler with no success. Since I've recently been using radare2 as a disassembler, I figured using the associated decompiler package would work well. After finding out that radeco and radeco-lib aren't currently stable enough to build, I used their package manager r2pm to finally install the r2snow BASH script in ~/.local/share/radare2/prefix/bin.

但是现在我不知道如何运行它来反编译二进制文件!我收到的错误消息是:用法:r2 -i'.!r2snow'" .我知道 r2 radare2 的简写,并且 -i 标志用于传递脚本文件来运行,但是我尝试传递它以多种方式无法成功执行r2snow BASH脚本.

But now I cannot figure out how to run it to decompile a binary! The error message I receive is: "Usage: r2 -i '.!r2snow'". I know that r2 is shorthand for radare2, and the -i flag is to pass a script file to run, but I've tried passing it the r2snow BASH script in multiple ways with no success.

任何有使用此特定反编译器经验的人都知道如何正确调用它吗?通常我可以自己弄清楚这一点,但是事实证明,缺少适当的文档太困难了.

Does anyone with experience using this particular decompiler know how to properly invoke it? Normally I could figure this out myself, but the lack of proper documentation has proved too difficult.

我不骗你,每当你不正确地调用程序时,它就会嘲笑你.最近:用法:r2 -i'.!r2snow'" –应该记录在案,因为它并不那么明显.也许我应该完全尝试使用另一个反编译器.有没有更容易设置的免费反编译器?

I kid you not, every time you invoke the program improperly, it taunts you. Most recently: "Usage: r2 -i '.!r2snow'" -- This should be documented, since it's not that obvious. Maybe I should try a different decompiler altogether. Are there any free decompilers out there which are easier to set up?

推荐答案

要安装radare2插件,您应该从以下内容开始:

To install radare2 plugins you should start with:

$ r2pm init
$ r2pm update

然后使用 r2pm 安装所需的插件:

Then install your desired plugin using r2pm:

$ r2pm -i r2snow

您可能会收到此错误:

错误:构建失败.您可能需要简单安装cartr/qt4/qt",然后'brew install boost'或'sudo apt-get install libboost-dev libqt4-dev'

ERROR: Build failed. You probably need 'brew install cartr/qt4/qt' and 'brew install boost' or 'sudo apt-get install libboost-dev libqt4-dev'

因此只需安装缺少的库:

So simply install the missing libraries:

$ sudo apt-get install libboost-dev libqt4-dev'

然后,您可以通过!r2snow 从wihtin r2 shell或像 r2 -i'.!r2snow'/bin/ls

Then, you can call r2snow from wihtin r2 shell via !r2snow or from outside like r2 -i '.!r2snow' /bin/ls

我建议使用 r2dec r2retdec 代替r2snow.

Instead of r2snow, I'd suggest using r2dec or r2retdec.

要安装 r2dec :

$ r2pm -i r2dec

然后只需使用 pdd :

$ r2 -A my_file
...
[0x00000540]> s main
[0x000006a4]> pdd
int32_t main () {
    /* arg1 */
    *(local_14h) = edi;
    /* arg2 */
    *(local_20h) = rsi;
    esi = 7;
    edi = 0x61;
    print_it (*(local_20h), *(local_14h));
    esi = 0x11;
    edi = 0x6b;
    print_it (edi, esi);
    *(local_4h) = 5;
    edx = *(local_4h);
    eax = edx;
    eax += eax;
    eax += edx;
    *(local_4h) = eax;
    eax = *(local_4h);
    edi = eax;
    dumb_function (edi);
    esi = 9;
    edi = 0x62;
    print_it (edi, esi);
    eax = 0;
    return eax;
}

要安装 r2retdec :

$ r2pm -i r2retdec

确保已安装 npm 并按照存储库中的说明进行操作>.安装后,请在r2 shell中使用 $ dec .

Make sure to have npm installed and follow the instructions in the repository. After you installed it, use $dec from within r2 shell.

这篇关于如何正确安装和调用"r2snow" radare2反编译器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆