bash - 如何正确安装和调用 'r2snow' radare2 反编译器?

标签 bash decompiler radare2

我花了几个小时尝试安装反编译器,但没有成功。因为我最近一直在使用 radare2作为反汇编程序,我认为使用相关的反编译程序包会很好。在发现radeco之后和 radeco-lib目前还不够稳定,无法构建,我使用了他们的包管理器 r2pm最后安装 r2snow ~/.local/share/radare2/prefix/bin 中的 BASH 脚本。

但现在我不知道如何运行它来反编译二进制文件!我收到的错误消息是:"Usage: r2 -i '.!r2snow'"。我知道 r2radare2 的简写,而 -i 标志是传递一个脚本文件来运行,但我试过传递它以多种方式使用 r2snow BASH 脚本,但均未成功。

有使用过这个特殊反编译器经验的人知道如何正确调用它吗?通常我可以自己解决这个问题,但事实证明缺乏适当的文档太困难了。

我没骗你,每次你不正确地调用程序时,它都会 mock 你。最近:"Usage: r2 -i '.!r2snow'"-- 这应该记录在案,因为它不是那么明显。 也许我应该尝试完全不同的反编译器。有没有更容易设置的免费反编译器?

最佳答案

要安装 radare2 插件,您应该从:

$ r2pm init
$ r2pm update

然后使用r2pm安装你想要的插件:

$ r2pm -i r2snow

您可能会遇到此错误:

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

所以只需安装缺少的库:

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

然后,您可以通过 !r2snow 从 r2 shell 或从外部调用 r2snow,如 r2 -i '.!r2snow'/bin/ls


我建议使用 r2decr2retdec 而不是 r2snow。

安装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 并按照 repository 中的说明进行操作. 安装后,在 r2 shell 中使用 $dec

关于bash - 如何正确安装和调用 'r2snow' radare2 反编译器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51465420/

相关文章:

reverse-engineering - 如何将radare2用于PIC32 MX534F064H

Dockerfile 构建错误 : Unable to locate

bash - exec.Command 卡在包含 nohup 的 Bash 脚本上

python - Bash 命令 tail 无法在 python 中生成输出

intellij-idea - Java源代码被Intellij中的反编译文件取代

android - 丢失了我的数据...能够以某种方式从我的 APK 获取我的应用程序源吗?

java - 来自 APK 的源代码

python - 使用 r2pipe 进行多处理

linux - bash - 只有当相应的文本文件存在时才打开图像

python - rails : Calling virtualenv for Python from within a Rails app