about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2020-02-22 13:41:22 +0100
committerEmile <hanemile@protonmail.com>2020-02-22 13:41:22 +0100
commit4008dcd9d233019366ff8e59b0061baf2f37fbd4 (patch)
treeddcdb3351d240878ada4ecb608485239c21c9640 /src
parentbf4e2f85e1b27a641568dc114d6990452ad8582d (diff)
moved to src
Diffstat (limited to 'src')
-rw-r--r--src/r2pipe.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/r2pipe.go b/src/r2pipe.go
new file mode 100644
index 0000000..c6ad3fc
--- /dev/null
+++ b/src/r2pipe.go
@@ -0,0 +1,24 @@
+package main
+
+import (
+	"fmt"
+
+	"github.com/radare/r2pipe-go"
+)
+
+func main() {
+	// allocate 1024 bytes of memory
+	r2p, err := r2pipe.NewPipe("malloc://1024")
+	if err != nil {
+		panic(err)
+	}
+	defer r2p.Close()
+
+	// get a hexdump of the first 100 bytes allocated
+	hexdump := r2cmd(r2p, "px 100")
+	fmt.Println(hexdump)
+
+	// compile a warrior using rasm2
+	bot := r2cmd(r2p, "rasm2 -a x86 -b 32 -f bots/warrior.asm")
+	fmt.Println(bot)
+}