about summary refs log tree commit diff
path: root/r2pipe.go
blob: 977759d3a51169d07cfc4f72abfcc7e34c8dc4be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main

import (
	"fmt"

	"github.com/radare/r2pipe-go"
)

func main() {
	// open a file
	// $ r2 ...
	r2p, err := r2pipe.NewPipe("/nix/store/xhwhakb1zcf5wl2a8575gcrnmbbqihm2-busybox-1.30.1/bin/ls")
	if err != nil {
		panic(err)
	}
	defer r2p.Close()

	// send a command
	// [0x004087e0]> ...
	buf1, err := r2p.Cmd("?E Hello World")
	if err != nil {
		panic(err)
	}

	// print the result of the first command
	fmt.Println(buf1)
}