Framework for allowing easy experimentation with eBPF byte-code.
The project can be used both as a library for working with eBPF byte-code, and it comes with a command-line program that can be as an assembler and (eventually) a disassembler.
Build with:
$ cabal build
The project consists of a number of modules:
Ebpf.Asmtypes for representing AST for eBPF programs.Ebpf.AsmParserparser for a textual format of eBPF bytecode.Ebpf.Decodereading bytecode into an AST (incomplete).Ebpf.Encodeencoding the AST to bytecode.Ebpf.Helpershelper functions for building AST.Ebpf.Displayfor user-facing printing of the AST.
$ cabal exec -- ebpf-tools --help
Usage: ebpf-tools ((-a|--assemble) | (-d|--disassemble) | --dump)
[-o|--output OUTFILE] INFILE
Assembler and disassembler for eBPF bytecode
Available options:
-a,--assemble Parse asm file and write bytecode to output
-d,--disassemble Parse bytecode file and write assembly to output
--dump Parse asm file and print an AST
-o,--output OUTFILE Write output to OUTFILE (writes to stdout if not
given)
-h,--help Show this help text
See