From bf4e2f85e1b27a641568dc114d6990452ad8582d Mon Sep 17 00:00:00 2001 From: Emile Date: Sat, 22 Feb 2020 13:41:06 +0100 Subject: wrapper for executing r2 commands --- src/cmd.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/cmd.go diff --git a/src/cmd.go b/src/cmd.go new file mode 100644 index 0000000..3a488e7 --- /dev/null +++ b/src/cmd.go @@ -0,0 +1,22 @@ +package main + +import ( + "log" + + "github.com/radare/r2pipe-go" +) + +func r2cmd(r2p *r2pipe.Pipe, input string) string { + + // print the command for debugging purposes + log.Printf("> %s", input) + + // send a command + buf1, err := r2p.Cmd(input) + if err != nil { + panic(err) + } + + // return the result of the command as a string + return buf1 +} -- cgit 1.4.1