about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2020-02-22 13:18:02 +0100
committerEmile <hanemile@protonmail.com>2020-02-22 13:18:02 +0100
commit3cf8c1d8f9f18ab0b3fcd4992d064610946e2879 (patch)
treead13f8f4001d402469aff7a1b0b5c7269d672f19
parentdcd8111a6558e4f236631fec58d4d6397f261d23 (diff)
basic setup
-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)
+}