Documentation ¶
Overview ¶
Package r2pipe allows to call r2 commands from Go. A simple hello world would look like the following snippet:
package main import ( "fmt" "github.com/radare/r2pipe-go" ) func main() { r2p, err := r2pipe.NewPipe("malloc://256") if err != nil { panic(err) } defer r2p.Close() _, err = r2p.Cmd("w Hello World") if err != nil { panic(err) } buf, err := r2p.Cmd("ps") if err != nil { panic(err) } fmt.Println(buf) }
Index ¶
- func NativeLoad() error
- type CloseDelegate
- type CmdDelegate
- type DL
- type EventDelegate
- type Pipe
- func (r2p *Pipe) ApiClose() error
- func (r2p *Pipe) ApiCmd(cmd string) (string, error)
- func (r2p *Pipe) Close() error
- func (r2p *Pipe) Cmd(cmd string) (string, error)
- func (r2p *Pipe) Cmdf(f string, args ...interface{}) (string, error)
- func (r2p *Pipe) Cmdj(cmd string) (out interface{}, err error)
- func (r2p *Pipe) Cmdjf(f string, args ...interface{}) (interface{}, error)
- func (r2p *Pipe) ForceClose() error
- func (r2p *Pipe) NativeClose() error
- func (r2p *Pipe) NativeCmd(cmd string) (string, error)
- func (r2p *Pipe) On(evname string, p interface{}, cb EventDelegate) error
- func (r2p *Pipe) Read(p []byte) (n int, err error)
- func (r2p *Pipe) ReadErr(p []byte) (n int, err error)
- func (r2p *Pipe) Write(p []byte) (n int, err error)
- type Ptr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NativeLoad ¶
func NativeLoad() error
Types ¶
type CloseDelegate ¶
type Pipe ¶
A Pipe represents a communication interface with r2 that will be used to execute commands and obtain their results.
func NewApiPipe ¶
func NewNativePipe ¶
func NewPipe ¶
NewPipe returns a new r2 pipe and initializes an r2 core that will try to load the provided file or URI. If file is an empty string, the env vars R2PIPE_{IN,OUT} will be used as file descriptors for input and output, this is the case when r2pipe is called within r2.
func (*Pipe) Cmdj ¶
Cmdj acts like Cmd but interprets the output of the command as json. It returns the parsed json keys and values.
func (*Pipe) ForceClose ¶
Forcing shutdown of r2, closing the created pipe.