Berkeley Packet Filter (BPF) assembler.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
maze 348e672a15 Docfix il y a 1 an
cmd/bpfasm Added Program.Verify method il y a 1 an
internal/parser Cleanup il y a 1 an
testdata Initial import il y a 1 an
.gitignore Renamed BPF ANTLR module to Assembler il y a 1 an
LICENSE Updated license il y a 1 an
Makefile Renamed BPF ANTLR module to Assembler il y a 1 an
README.md Docfix il y a 1 an
assembler.go Added Program.Verify method il y a 1 an
bpf.go Supply type aliases for the bpf package il y a 1 an
doc.go Initial import il y a 1 an
go.mod More representable bpfasm command line tool il y a 1 an
go.sum More representable bpfasm command line tool il y a 1 an
parse.go Updated license il y a 1 an
program.go Added Program.Verify method il y a 1 an
vm.go Added Program.Verify method il y a 1 an
vm_alu_test.go Updated license il y a 1 an
vm_debug.go Updated license il y a 1 an
vm_extension_test.go Updated license il y a 1 an
vm_jump_test.go Updated license il y a 1 an
vm_load_test.go Ported the bpf vm with pluggable extensions il y a 1 an
vm_registers.go Ported the bpf vm with pluggable extensions il y a 1 an
vm_ret_test.go Ported the bpf vm with pluggable extensions il y a 1 an
vm_scratch_test.go Updated license il y a 1 an
vm_test.go Updated license il y a 1 an

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

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.