Q:

r2pipe won't prompt for user input like the binary does in r2 debugger mode

Have a functioning r2pipe script, but there's a need for hitting crtl-c to continue near the breakpoint(not a major issue,) however the script does not pause for input when the crackme asks for user input like it does in regular r2 command line. Whats the best way of sending input to the binary?
This tree of inputs is required near the end of the executable.
Can't manage it to prompt even for the first.
No problems with script except for the input issue.
import r2pipe
r = r2pipe.open('crackme, flags=['-d'])
r.cmd('e dbg.profile=robot.rr2')
r.cmd('db 0x080486d8;') 
print(r.cmd('dc'))
print(r.cmd('dc'))
sep=' '

value1=int(r.cmd('? [ebp+0xc];').split(sep, 1)[0])
value2=int(r.cmd('? [ebp+0x10];').split(sep, 1)[0])
hex_operator=r.cmd('dr eax')
operator=r.cmd('? '+(hex_operator))

if '+' in operator:
    answer=value1+value2

elif '-' in operator:
    answer=value1-value2

print(r.cmd('dc'))

Should prompt for input down here, but the execution just ends after the "what's the password"
OR if I enter the r2 commands without r2pipe starting with: 
 r2 -d crackme -c "e dbg.profile=robot.rr2"
it does prompt me for input but rr2 still does not input whats in input.txt
in my .rr2:
#!/usr/bin/rarun2

have tried
input=input.txt 

and
stdin=input.txt

input.txt is just a string
is it possible rarun's input or stdin directives are not compatible or something?

A:

I think you're using some of the old version of r2, so my answer will not address that and show you how to do it with the latest one.
The problem is with your first line, or wrong assumption that starting the debug session and applying rarun2 file will automatically get applied. It's not.
So instead of connecting to r2 engine like this r = r2pipe.open('crackme', flags=['-d']) do this instead
r = r2pipe.open('crackme') #no debugging flag
r.cmd('e dbg.profile=robot.rr2')
r.cmd('ood') #reopen the file in debug mode - this will apply the dbg.profile settings
...

With this approach, it will correctly map the settings in rr2 to the debugging session and in case you put input.txt it will inform that the file doesn't exist (it treats this as a file).
But even with that approach, this crackme does some strange modifications to streams that are hard to follow. But at least with this change, you would be able to continue the investigation.

