ausimian

ausimian

BPF - Convert binary pattern matching to classic BPF programs

I just pushed a library called BPF that converts binary pattern matching expressions into (classic) BPF (Berkeley Packet Filter) programs that you can use with SO_ATTACHFILTER or libpcap. There’s also an interpreter that allows you to test your programs against binaries.

BPF programs are essentially predicates on packets that run in the kernel and are usually used to filter traffic efficiently for programs like tcpdump etc, They are described using a Turing-incomplete instruction set.

I intend to add some integration tests using Tundra shortly.

Features

  • Elixir syntax - Write filters using binary pattern matching and guards
  • Multi-clause support - Multiple patterns with fallthrough semantics
  • Guard expressions - Comparisons, logical operators, bitwise operations, arithmetic
  • Packet length filtering - Use byte_size(packet) to filter by packet size
  • SSA-based compiler - Optimized code generation with register allocation

Package
Docs

https://github.com/ausimian/bpf

First Post!

Asd

Asd

Very cool! Do you have any example setup for how to call libpcap with it?

Most Liked

ausimian

ausimian

I published it. I’ve tested it on macos and linux, but i haven’t stressed it.

Last Post!

Asd

Asd

D:

That’s very nice. I can finally play with covert channels in Elixir. I think this library deserves a separate topic!

Where Next?

Popular in Announcing Top

zorbash
I created Kitto a framework for dashboards inspired by Dashing. The distributed characteristics of Elixir and the low memory footprint...
New
kelvinst
Hey everyone! Well, we made this lib a while ago and now we decided to finally go out and public with it! It’s a tool for creating and m...
New
handnot2
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application. This library uses Erlang esaml to provide plug enabl...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44265 214
New
maltoe
Hello! Came here to announce ChromicPDF, a pet project PDF generator I’ve been working on for the past few months. Why another PDF gener...
New
oltarasenko
Dear Elixir community, After a year of development, bug fixes, and improvements, we are proudly ready to share the release of Crawly 0.1...
New
kip
Image is an image processing library for Elixir. It is based upon the fabulous vix library that provides a libvips wrapper for Elixir. I...
622 19610 194
New

Other popular topics Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 55125 245
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31586 112
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New

We're in Beta

About us Mission Statement