0

我安装了 r2pipe,但它没有运行。我不明白。

 Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
   [GCC 4.8.2] on linux2
   Type "help", "copyright", "credits" or "license" for more information.  
   >>> import r2pipe
   >>> r2 = r2pipe.open("/bin/ls")
   Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/local/lib/python2.7/dist-packages/r2pipe/__init__.py", line      132, in __init__
   self.process = Popen(cmd, shell=False, stdin=PIPE, stdout=PIPE)
   File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
   errread, errwrite)
   File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
   raise child_exception
   OSError: [Errno 2] No such file or directory
4

1 回答 1

0

环境

  • Python: Python 2.7.15+(默认,2019 年 10 月 7 日,17:39:04)
  • 系统: Ubuntu 18.04 LTS

解决方案

例子

未安装 r2pipe 和radare2 的示例。

user@host:~$ python
Python 2.7.15+ (default, Oct  7 2019, 17:39:04) 
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import r2pipe
>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named r2pipe
>>> exit()
user@host:~$

安装 r2pipe 但未安装radare2 的示例。

user@host:~$ pip install r2pipe
Collection r2pipe
...
Successfully installed r2pipe-1.4.2
user@host:~$ python
Python 2.7.15+ (default, Oct  7 2019, 17:39:04) 
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import r2pipe
>>> r2 = r2pipe.open("/bin/ls")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.local/lib/python2.7/site-packages/r2pipe/open_sync.py", line 62, in __init__
    raise Exception("ERROR: Cannot find radare2 in PATH")
Exception: ERROR: Cannot find radare2 in PATH
>>> exit()
user@host:~$

安装 r2pipe 和radare2 的示例。

user@host:~$ git clone https://github.com/radareorg/radare2.git
cloning into 'radare2'...
...
user@host:~$ ./radare2/sys/install.sh
...
user@host:~$ r2
Usage: r2 [-ACdfLMnNqStuvwzX] [-P patch] [-p prj] [-a arch] [-b bits] [-i file]
          [-s addr] [-B baddr] [-m maddr] [-c cmd] [-e k=v] file|pid|-|--|=
user@host:~$ python
Python 2.7.15+ (default, Oct  7 2019, 17:39:04) 
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import r2pipe
>>> r2 = r2pipe.open("/bin/ls")
>>> r2.cmd('aaaa')
...
>>> print r2.cmd('afl')
0x00005850    1 42           entry0
0x0001636c    1 9            sym._fini
0x00003758    3 23           sym._init
0x00015690    5 42   -> 38   sym._obstack_memory_used
...
0x00005950    5 154  -> 67   entry.init0
0x00005910    5 58   -> 51   entry.fini0
0x00005880    4 50   -> 40   fcn.00005880
>>> exit()
user@host:~$



于 2020-01-09T16:04:27.773 回答