Radare2/r2pipe Binary writng mode

292 Views Asked by At

I want to write some data to the ELF binary. I have tried to use this r2pipe function r = r2pipe.open('binary', flags=['-w'] How can I add some strings to ELF binary by using r2pipe binary write mode function? Sorry for this stupid question. Any advice and simple example is appreciated.

r2 = r2pipe.open("ncc1", flags=['-w'])
r2.write("HELLO world")
r2.close()```

Result: AttributeError: 'open' object has no attribute 'write'


1

There are 1 best solutions below

0
On

As many examples of using r2pipe show, you don't write to the pipe.

Instead you use r2.cmd(...) to communicate with the underlying radare2.