about summary refs log tree commit diff
path: root/src/r2pipe.go
blob: c6ad3fcf3638be1f444f0dd8bd11be05dfdb0e97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)
}