diff options
author | Emile <hanemile@protonmail.com> | 2020-02-22 13:41:06 +0100 |
---|---|---|
committer | Emile <hanemile@protonmail.com> | 2020-02-22 13:41:06 +0100 |
commit | bf4e2f85e1b27a641568dc114d6990452ad8582d (patch) | |
tree | 57cbac337952e8adcf989b25f0caafd77a8917f8 /src/cmd.go | |
parent | 8a91b269a2abc96d80f2ebe013033ec964e0511e (diff) |
wrapper for executing r2 commands
Diffstat (limited to 'src/cmd.go')
-rw-r--r-- | src/cmd.go | 22 |
1 files changed, 22 insertions, 0 deletions
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 +} |