From 3cf8c1d8f9f18ab0b3fcd4992d064610946e2879 Mon Sep 17 00:00:00 2001 From: Emile Date: Sat, 22 Feb 2020 13:18:02 +0100 Subject: basic setup --- r2pipe.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 r2pipe.go (limited to 'r2pipe.go') 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) +} -- cgit 1.4.1