参考网址:
进入目录/root/.local/share/radare2/r2pm/git/r2ghidra查看configure文件,查找报错位置
执行指令 :
# pkg-config --cflags r_core
Package libxxhash was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxxhash.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libxxhash', required by 'r_hash', not found
Package 'libxxhash', required by 'r_hash', not found
Package 'libxxhash', required by 'r_hash', not found
Package 'libxxhash', required by 'r_hash', not found
Package 'libxxhash', required by 'r_hash', not found
Package 'libxxhash', required by 'r_hash', not found
Package 'libxxhash', required by 'r_hash', not found
安装 libxxhash
apt-get install libxxhash-dev
最后进行:r2pm -ci r2ghidra 进行安装时还是报错:
anal_ghidra_plugin.c:28:10: error: ‘RAnalPlugin’ {aka ‘struct r_anal_plugin_t’} has no member named ‘cpus’
28 | .cpus = "6502,6805,8051,arm,avr,cr16,dalvik,hppa,java,m68k,m8c,mips,mcs96,msp430,pic24,ppc,sh,sparc,stm8,tricore,toy,v850,wasm,x86,z80",
| ^~~~
anal_ghidra_plugin.c:28:17: error: initializer element is not computable at load time
28 | .cpus = "6502,6805,8051,arm,avr,cr16,dalvik,hppa,java,m68k,m8c,mips,mcs96,msp430,pic24,ppc,sh,sparc,stm8,tricore,toy,v850,wasm,x86,z80",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
anal_ghidra_plugin.c:28:17: note: (near initialization for ‘r_anal_plugin_ghidra.bits’)
gmake: *** [<builtin>: anal_ghidra_plugin.o] Error 1
gmake: Leaving directory '/root/.local/share/radare2/r2pm/git/r2ghidra/src'
ERROR make
pdg反编译指令暂时搞不定。
安装r2dec插件,使用pdd反编译
r2pm install r2dec
[0x08048430]> pdd @main
/* r2dec pseudo code output */
/* /root/test/ret2win32 @ 0x8048546 */
#include <stdint.h>
int32_t main (char ** argv) {
int32_t var_4h;
ecx = &argv;
eax = stdout;
setvbuf (eax, 0, 2, 0);
puts ("ret2win by ROP Emporium");
puts ("x86\n");
pwnme ();
puts ("\nExiting");
eax = 0;
ecx = var_4h;
esp = ecx - 4;
return eax;
}
终于有时间了接着安装r2ghidra插件,接着上面报错:
找到r2ghidra的默认的路径:~/.local/share/radare2/r2pm/git/r2ghidra
在./src路径下找到anal_ghidra_plugin.c文件,按照“has no member named”报错,找到一篇文档:C语言,C++编译遇到问题:has no member named ''XXX‘_ZDF19的博客-CSDN博客
文档中找到的两个方法都没有用,还要自己进行解决,估计是“cpus”没有定义,查看源文件
27 #if R2_VERSION_NUMBER >= 50609
28 .endian = R_SYS_ENDIAN_LITTLE | R_SYS_ENDIAN_BIG,
29 #endif
30 .cpus = "6502,6805,8051,arm,avr,cr16,dalvik,hppa,java,m68k,m8c,mips,mcs96,msp430,pic24,ppc,sh,sparc,stm8,tricore,toy,v850,wasm,x86,z80",
31
查看当前系统的r2版本
r2 -V
5.5.0 r2
5.5.0 r_anal
5.5.0 r_lib
5.5.0 r_egg
5.5.0 r_asm
5.5.0 r_bin
5.5.0 r_cons
5.5.0 r_flag
5.5.0 r_core
应该是大于50609
把29行的#endif下移如下,搞定
27 #if R2_VERSION_NUMBER >= 50609
28 .endian = R_SYS_ENDIAN_LITTLE | R_SYS_ENDIAN_BIG,
29
30 .cpus = "6502,6805,8051,arm,avr,cr16,dalvik,hppa,java,m68k,m8c,mips,mcs96,msp430,pic24,ppc,sh,sparc,stm8,tricore,toy,v850,wasm,x86,z80",
31 #endif