Telco's neverending adventure ͡ಥ ͜ʖ ͡ಥ

How to use Pycrate with Bazel

I am a long term fan of Pycrate and the work around synthesizing 3GPP parsers and generators from 3GPP specs. However, running it “quickly” has been always a bit difficult - you probably wanna run some pycrate_mobile stuff, so you need Cryptomobile support. At $WORK, bc of some Xooglers, we are using bazel to build our monorepo. Turns out I could run pycrate from bazel very easily and combine the power of pycrate with the Jupyter ecosystem.

This enables a simple hexstream extracted from PCAP to be analyzed quickly without messing with your mac/linux pip environment, as previewed in this notebook on Github:

In fact, bazel is no magic, it enables a complex graph of dependencies to be expressed through a WORKSPACE and set of BUILD files. In that particular example, we actually register a specific python “pre-built” environement (i.e. python-build-standlone) and instruct bazel how to download, run and execute it. Than, we instruct bazel how to compile the requirement from Pycrate around Cryptography and then we list the usual requirements for running python Notebooks using the pip rules system from Bazel.

#pycrate #python #jupyter #bazel