Skip to main content

Python BPF Assembler

Project description

PyPI Build & Test Docs

Python BPF Assembler.

Based on the BPF assembler in Linux sources.

Installations

Wheels are available.

To build from source you need a relatively recent Flex & Bison:

  • On Windows, you can use winflexbison.

  • On macOS (and sometimes on Linux, on older distributions), you can install them from Homebrew. Note that you might have to add Homebrew’s version to the front of the PATH, e.g. PATH="$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin:$PATH".

Usage

import bpf_asm


ASM = """\
    ldh [12]
    jeq #0x800, accept, drop
accept:
    ret #65536
drop:
    ret #0
"""

print(bpf_asm.assemble(ASM))

Or use the pybpf_asm script. See pybpf_asm --help for usage.

License

GPL-2.0-only.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bpf_asm-0.1.3.tar.gz (24.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

bpf_asm-0.1.3-cp312-cp312-win_amd64.whl (54.2 kB view details)

Uploaded CPython 3.12Windows x86-64

bpf_asm-0.1.3-cp312-cp312-win32.whl (48.6 kB view details)

Uploaded CPython 3.12Windows x86

bpf_asm-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (66.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bpf_asm-0.1.3-cp312-cp312-macosx_10_9_universal2.whl (94.8 kB view details)

Uploaded CPython 3.12macOS 10.9+ universal2 (ARM64, x86-64)

bpf_asm-0.1.3-cp311-cp311-win_amd64.whl (54.0 kB view details)

Uploaded CPython 3.11Windows x86-64

bpf_asm-0.1.3-cp311-cp311-win32.whl (49.5 kB view details)

Uploaded CPython 3.11Windows x86

bpf_asm-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (65.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

bpf_asm-0.1.3-cp311-cp311-macosx_10_9_universal2.whl (95.3 kB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

bpf_asm-0.1.3-cp310-cp310-win_amd64.whl (53.9 kB view details)

Uploaded CPython 3.10Windows x86-64

bpf_asm-0.1.3-cp310-cp310-win32.whl (49.6 kB view details)

Uploaded CPython 3.10Windows x86

bpf_asm-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (66.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bpf_asm-0.1.3-cp310-cp310-macosx_10_9_universal2.whl (95.3 kB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)

bpf_asm-0.1.3-cp39-cp39-win_amd64.whl (53.9 kB view details)

Uploaded CPython 3.9Windows x86-64

bpf_asm-0.1.3-cp39-cp39-win32.whl (49.6 kB view details)

Uploaded CPython 3.9Windows x86

bpf_asm-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (66.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bpf_asm-0.1.3-cp39-cp39-macosx_10_9_universal2.whl (95.3 kB view details)

Uploaded CPython 3.9macOS 10.9+ universal2 (ARM64, x86-64)

bpf_asm-0.1.3-cp38-cp38-win_amd64.whl (53.9 kB view details)

Uploaded CPython 3.8Windows x86-64

bpf_asm-0.1.3-cp38-cp38-win32.whl (49.6 kB view details)

Uploaded CPython 3.8Windows x86

bpf_asm-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (66.2 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

bpf_asm-0.1.3-cp38-cp38-macosx_10_9_universal2.whl (95.7 kB view details)

Uploaded CPython 3.8macOS 10.9+ universal2 (ARM64, x86-64)

bpf_asm-0.1.3-cp37-cp37m-win_amd64.whl (54.4 kB view details)

Uploaded CPython 3.7mWindows x86-64

bpf_asm-0.1.3-cp37-cp37m-win32.whl (49.5 kB view details)

Uploaded CPython 3.7mWindows x86

bpf_asm-0.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (65.6 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

File details

Details for the file bpf_asm-0.1.3.tar.gz.

File metadata

  • Download URL: bpf_asm-0.1.3.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for bpf_asm-0.1.3.tar.gz
Algorithm Hash digest
SHA256 fe21e0e1aa8f3d017e4640fa6e22528c105b77b0cbeb307ad62f194c5b75c7c6
MD5 c863b1f12a4a752c88411472a6ed2007
BLAKE2b-256 877b6210b082b92769a276dc52e53366dada361717503e10f91961179c1fec63

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: bpf_asm-0.1.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 54.2 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for bpf_asm-0.1.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 65c7c1ec0402adbbb4297af9e49f0fb4eb72e8635b0a1da1125d2748c6091760
MD5 27dc38e9f0d5a5f8da1d51084edcc576
BLAKE2b-256 9a82523124837b9331316eff729e58c3e02de43ec4f9221cc244a7e4459dded6

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp312-cp312-win32.whl.

File metadata

  • Download URL: bpf_asm-0.1.3-cp312-cp312-win32.whl
  • Upload date:
  • Size: 48.6 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for bpf_asm-0.1.3-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 69074b3968c76611eaaa68e1d6ec5355115b3cfa7e8c1c18f171e531c7627dbc
MD5 342629bc27f956ce954c57da9d204324
BLAKE2b-256 f82e6d77e7e7aa5c121645555bfb83100f59f3185a64767fbdec187b8b847b8d

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bpf_asm-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c6123cdbfbd0e321b2e83b9562416dd88b62e47412110003b8e3183a7c3fbc55
MD5 11a26ba85fd31fe8bd224644a54974a1
BLAKE2b-256 2323d64ddf222191e2edba48a3fda0bcff8ee8a79826163e64a61d901b252e22

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp312-cp312-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for bpf_asm-0.1.3-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 055e759536ffd70b26112a46e716170437ad777206f18b2750578ef30333529b
MD5 55caa1e01ebd4893786942dfce96ec03
BLAKE2b-256 bcbfe11e85bfb9275f8a49388ed76d5983408154890ba9b85c92b82960fd6cb3

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: bpf_asm-0.1.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 54.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for bpf_asm-0.1.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 962fbb60514443137e458d63f4d70d4d8687838f3eb5148443972e68e183df62
MD5 6eae00cfbf0e0dcad2e40498f177c322
BLAKE2b-256 992777487bcedf931423b1400bcc5b6e4dcf417cb0e0a714deb5d229c5c5c488

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp311-cp311-win32.whl.

File metadata

  • Download URL: bpf_asm-0.1.3-cp311-cp311-win32.whl
  • Upload date:
  • Size: 49.5 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for bpf_asm-0.1.3-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 749bc635ba03d207c12d4ea459275c1a0c91a8a8e5dbe9d97396949b26bfd1c4
MD5 205fa0f98321e43f19acb04a6b8978a8
BLAKE2b-256 92143ed07fa937da349aedffb8db6c1b1ca09641137001e2aceec5fb345ac1b1

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bpf_asm-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b8c7859309ee575b71ae82a590a6cb362378dc18e0a4d2a5fe0e35886fdb3548
MD5 62b2ea2c67b1a4fa4a9bdb7554af8eda
BLAKE2b-256 78b7c641b20ed3c2c4585351ddd90db22a54ff3a8057ba8303c4c4d33b1a6fba

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for bpf_asm-0.1.3-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 605d540460cd2bfa655c096178353306aea467c366e9a3f779d82e5bfb009622
MD5 4cd8ed48a06ecfa19ce85eca521cc692
BLAKE2b-256 989dc90c7a4f1908499e85db976b508a3915a6079373e146a9f05a3ab8395c9b

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: bpf_asm-0.1.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 53.9 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for bpf_asm-0.1.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 186b7a4d9562ee5005fc8eb86db719b956156de2ece8d0f00775c246739fe59a
MD5 a90a9db72bb28bcaf139679b47e9b12a
BLAKE2b-256 64abf1090aa6f92473b14a312ecab8fa1a1135f602e91502d489088db9c9613d

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp310-cp310-win32.whl.

File metadata

  • Download URL: bpf_asm-0.1.3-cp310-cp310-win32.whl
  • Upload date:
  • Size: 49.6 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for bpf_asm-0.1.3-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 f7b055f914bcfc67b9cf5ec1e50e216090002463aaf3a7bcbc5a81fa8c36198f
MD5 f6de5858befe439f71785f1871a2e53e
BLAKE2b-256 719358b5b493916c9e23c0a6ee33fd9be47afffb21de9c97b24b3a604599e087

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bpf_asm-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f6128685c0aa03e13ab7c33fdd36d2a9fe11dc10cac4f7ebcb699cb3f332a89a
MD5 437fa8115be8203eeb9e8a8c96cbfd55
BLAKE2b-256 3d6d10d0400ea306733ccae22ebfbfad59245745432af2f249e6844cf3c48f61

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for bpf_asm-0.1.3-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 3afe5603d1ceedf0a7370bf9a15b22f570b98952ea08fa9ee99b71f74b483cf9
MD5 f3996767ab1702a9367428e2e31b6219
BLAKE2b-256 683db15442dceb5e8bd9d374eb37a0ff53b6b32fd12d8c7bec82a8ab059603b5

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: bpf_asm-0.1.3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 53.9 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for bpf_asm-0.1.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 afeac87cb94bbbf755d1a727b755b1d452344e0c8ee75ce777c36676bb6d3adc
MD5 47420c668512b38076c7ebf75988a8c9
BLAKE2b-256 6f1fcd504f832626101a15f31ccf307fe7f154da6efb242caf961bdcf8f57353

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp39-cp39-win32.whl.

File metadata

  • Download URL: bpf_asm-0.1.3-cp39-cp39-win32.whl
  • Upload date:
  • Size: 49.6 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for bpf_asm-0.1.3-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 c9fd961f5e38f6cb4df636ecf7c973e1174fbddcf1a55b8b4eedddce2572ed13
MD5 988eca72f22c322f71dba13c6911965d
BLAKE2b-256 7ee6882a0763aeeda5d332a4999cf70e8b90a37f92e01daa7003c9ed21fd024e

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bpf_asm-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 83fabb5b5168e310864a8165650a693080a02cda7904cd02561e035a13bfe486
MD5 f531880bc9c25f92202f0d8240a60996
BLAKE2b-256 8b71773c11fbda39d17905b196dfc9128b1d762b12c8ac9482d07d7610b28b69

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for bpf_asm-0.1.3-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 5e1c12e05956991adbd1e88468ddcaca8361a4608f72d8a3ccb8ca54f0bbf864
MD5 3a76af170550c1e8286131c8ef63e05b
BLAKE2b-256 53b374606bc823967ffcceb58248b1adcd12ea898ca6c90f497b733f01c1491c

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: bpf_asm-0.1.3-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 53.9 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for bpf_asm-0.1.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 1002cdad87e1ed3ecaebb7ad5edb2b21051bb84f04d889b2e4ccf7f4fb636832
MD5 ec9219a9d1e63ddef9c3b8027b15b12b
BLAKE2b-256 e1da98fd0d5606bcab85df10d929949dae191250d07af79108a1e94a6e01d597

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp38-cp38-win32.whl.

File metadata

  • Download URL: bpf_asm-0.1.3-cp38-cp38-win32.whl
  • Upload date:
  • Size: 49.6 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for bpf_asm-0.1.3-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 c0845ae7983fb498123731c26125be60df285879c8696b7c021d6a78a690fb4b
MD5 009460f041f041795db07db7717a58fb
BLAKE2b-256 ffb0bb1d452a755882aab3c2321c39dfbc3d6cb20a54fb2609a41c1e670a5c63

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bpf_asm-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4161e0da23c2520d43901005855eeee022141cdf5e2f0a9c8721a61b9ac98b4e
MD5 224c3b43bb367c8fa8e903056a745010
BLAKE2b-256 d76b951cda80b932ccc64a7902d6625bd6528c8ad8907877c7fb11a9b1ca1687

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp38-cp38-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for bpf_asm-0.1.3-cp38-cp38-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 bb7db462a5b280833ef5401a3ef0614e50ebe2339912d96a92936bd512868ea2
MD5 5f94d1c8879eb0548878b9126dd4e0ca
BLAKE2b-256 b3e4032fa29059b72aa8e3bc3a7be9fafd0036aa36d64aee4705043e495900b3

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: bpf_asm-0.1.3-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 54.4 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for bpf_asm-0.1.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 d8bd36906e48c7d389b845cc58e8268c3c07bc57e59251f2716f4f57d2b3d366
MD5 e68f9b2996274c25f217dd89218f4f91
BLAKE2b-256 19e4fdf6d4a53de8ef7075c58baae79a3a5803e981afc562975a9958e24f6a5a

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp37-cp37m-win32.whl.

File metadata

  • Download URL: bpf_asm-0.1.3-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 49.5 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for bpf_asm-0.1.3-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 8ae85981dd08a9e52f27f826e4e96640f0098acaa00a40f86935792d9a33e49d
MD5 b93c908fa8301a28e30a9a8ecd6e34ee
BLAKE2b-256 d4b208ac65088e9c08c783029585a18075454314daddd0d102cfdb47ab9140e0

See more details on using hashes here.

File details

Details for the file bpf_asm-0.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bpf_asm-0.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e7d5cc47c50aeecf20e392eb33b77ba8652c3818e8c7d0e6134db7d86d8de951
MD5 e17d40d970373632a43f60cf6acd61f3
BLAKE2b-256 b8829522ce5a1c02ee07c0616f7366296d09529b3d5794f58b71e4c128433610

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page