about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--r2pipe.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/r2pipe.go b/r2pipe.go
new file mode 100644
index 0000000..977759d
--- /dev/null
+++ b/r2pipe.go
@@ -0,0 +1,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)
+}