Berkeley Packet Filter (BPF) assembler. https://godoc.org/maze.io/x/bpf
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
maze 348e672a15 Docfix 5 meses atrás
cmd/bpfasm Added Program.Verify method 5 meses atrás
internal/parser Cleanup 5 meses atrás
testdata Initial import 5 meses atrás
.gitignore Renamed BPF ANTLR module to Assembler 5 meses atrás
LICENSE Updated license 5 meses atrás
Makefile Renamed BPF ANTLR module to Assembler 5 meses atrás
README.md Docfix 5 meses atrás
assembler.go Added Program.Verify method 5 meses atrás
bpf.go Supply type aliases for the bpf package 5 meses atrás
doc.go Initial import 5 meses atrás
go.mod More representable bpfasm command line tool 5 meses atrás
go.sum More representable bpfasm command line tool 5 meses atrás
parse.go Updated license 5 meses atrás
program.go Added Program.Verify method 5 meses atrás
vm.go Added Program.Verify method 5 meses atrás
vm_alu_test.go Updated license 5 meses atrás
vm_debug.go Updated license 5 meses atrás
vm_extension_test.go Updated license 5 meses atrás
vm_jump_test.go Updated license 5 meses atrás
vm_load_test.go Ported the bpf vm with pluggable extensions 5 meses atrás
vm_registers.go Ported the bpf vm with pluggable extensions 5 meses atrás
vm_ret_test.go Ported the bpf vm with pluggable extensions 5 meses atrás
vm_scratch_test.go Updated license 5 meses atrás
vm_test.go Updated license 5 meses atrás

README.md

bpf

Berkeley Packet Filter (BPF) assembler.

Installation

Easy as running go get:

~$ go get maze.io/x/bpf/cmd/bpfasm

Usage

Compiling an assembly file:

demo.asm contents:

; icmp random packet sampling, 1 in 4
        ldh 	[12]
        jne 	#0x800, drop
        ldb 	[23]
        jneq 	#1, drop
        ; get a random uint32 number
        ld      rand
        mod 	#4
        jneq 	#1, drop
        ret 	#-1
drop:	ret 	#0

Assembling to (big endian) binary:

~$ bpfasm assemble demo.asm
writing to demo.asm.bin

Disassembling:

~$ bpfasm disassemble demo.asm.bin
ld     #12
jne    #2048,6
ld     #23
jneq   #1,4
ld     #rand
mod    #4
jneq   #1,1
ret    #4294967295
ret    #0

Copyright

The assembler parser and compiler are © 2019 Wijnand Modderman-Lenstra.

The assembler virtual machine and opcode assembler are © 2009, 2016 The Go Authors.

For more details, see the LICENSE.