Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r2pipe cannot open when it is being called from radare2 (using pipe) #87

Closed
a1ext opened this issue Dec 15, 2018 · 3 comments
Closed

r2pipe cannot open when it is being called from radare2 (using pipe) #87

a1ext opened this issue Dec 15, 2018 · 3 comments
Labels

Comments

@a1ext
Copy link
Contributor

a1ext commented Dec 15, 2018

I have the following python code (test_r2lang_pipe.py) to check is pipe connection with radare2 works:

from __future__ import print_function

import sys
# sys.path.append(r't:\radare2-r2pipe\python')
print('python ver:', sys.version)
import r2pipe
r = r2pipe.open()
r.cmd('aa')
print(r.cmd('pd 10'))

When I run it on Windows with Python 2 it works well:

# radare2 -i t:\radare2-r2pipe\python\examples\test_r2lang_pipe.py rabin2.exe
python ver: 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
[x] Analyze all flags starting with sym. and entry0 (aa)
/ (fcn) entry0 373
|   entry0 (int arg5, int arg2);
|       :   ; var int local_8h @ rsp+0x8
|       :   ; var int local_10h @ rsp+0x10
|       :   ; var int local_20h @ rsp+0x20
|       :   ; var int local_40h @ rsp+0x40
|       :   ; var int local_48h @ rsp+0x48
|       :   ; arg int arg5 @ r8
|       :   ; arg int arg2 @ rsi
|       :   0x14001a6f4      4883ec28       sub rsp, 0x28              ; '('
|       :   0x14001a6f8      e85b050000     call 0x14001ac58
|       :   0x14001a6fd      4883c428       add rsp, 0x28              ; '('
\       `=< 0x14001a701      e972feffff     jmp 0x14001a578
            0x14001a706      cc             int3
            0x14001a707      cc             int3
            0x14001a708      4053           push rbx
            0x14001a70a      4883ec20       sub rsp, 0x20
            0x14001a70e      488bd9         mov rbx, rcx
            0x14001a711      33c9           xor ecx, ecx
 -- Initial frame selected; you cannot go up.
[0x14001a6f4]> q

But when I run it with Python 3 it fails:

# set PATH=c:\Python36x64;%PATH%
# radare2 -i t:\radare2-r2pipe\python\examples\test_r2lang_pipe.py rabin2.exe
python ver: 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)]
Invalid Handle Value
Could not open pipe
Traceback (most recent call last):
  File "t:\radare2-r2pipe\python\examples\test_r2lang_pipe.py", line 10, in <module>
    print('`aa` returned:', r.cmd('aa'))
  File "c:\Python36x64\lib\site-packages\r2pipe\open_base.py", line 197, in cmd
    res = self._cmd(cmd, **kwargs)
AttributeError: 'open' object has no attribute '_cmd'
@a1ext a1ext added the windows label Dec 15, 2018
a1ext added a commit to a1ext/radare2-r2pipe that referenced this issue Dec 15, 2018
@radare
Copy link
Collaborator

radare commented Dec 15, 2018 via email

@a1ext
Copy link
Contributor Author

a1ext commented Dec 16, 2018

This is fixed in git already. Will do a new release when i get my hands on a keyboard today

On 15 Dec 2018, at 18:05, a1ext @.***> wrote: I have the following python code (test_r2lang_pipe.py) to check is pipe connection with radare2 works: from future import print_function import sys # sys.path.append(r't:\radare2-r2pipe\python') print('python ver:', sys.version) import r2pipe r = r2pipe.open() r.cmd('aa') print(r.cmd('pd 10')) When I run it on Windows with Python 2 it works well: # radare2 -i t:\radare2-r2pipe\python\examples\test_r2lang_pipe.py rabin2.exe python ver: 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] [x] Analyze all flags starting with sym. and entry0 (aa) / (fcn) entry0 373 | entry0 (int arg5, int arg2); | : ; var int local_8h @ rsp+0x8 | : ; var int local_10h @ rsp+0x10 | : ; var int local_20h @ rsp+0x20 | : ; var int local_40h @ rsp+0x40 | : ; var int local_48h @ rsp+0x48 | : ; arg int arg5 @ r8 | : ; arg int arg2 @ rsi | : 0x14001a6f4 4883ec28 sub rsp, 0x28 ; '(' | : 0x14001a6f8 e85b050000 call 0x14001ac58 | : 0x14001a6fd 4883c428 add rsp, 0x28 ; '(' \ =< 0x14001a701 e972feffff jmp 0x14001a578 0x14001a706 cc int3 0x14001a707 cc int3 0x14001a708 4053 push rbx 0x14001a70a 4883ec20 sub rsp, 0x20 0x14001a70e 488bd9 mov rbx, rcx 0x14001a711 33c9 xor ecx, ecx -- Initial frame selected; you cannot go up. [0x14001a6f4]> q But when I run it with Python 3 it fails: # set PATH=c:\Python36x64;%PATH% # radare2 -i t:\radare2-r2pipe\python\examples\test_r2lang_pipe.py rabin2.exe python ver: 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] Invalid Handle Value Could not open pipe Traceback (most recent call last): File "t:\radare2-r2pipe\python\examples\test_r2lang_pipe.py", line 10, in <module> print('aa` returned:', r.cmd('aa')) File "c:\Python36x64\lib\site-packages\r2pipe\open_base.py", line 197, in cmd res = self._cmd(cmd, **kwargs) AttributeError: 'open' object has no attribute '_cmd' — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

which one?

@a1ext
Copy link
Contributor Author

a1ext commented Dec 16, 2018

Fixes #64 as well

@trufae trufae closed this as completed Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants