Minimal version of the LTE downgrade analyzer

This also renames the lte_parser crate to telcom_parser, since it'll
handle any 2G or 3G parsing going forward.
This commit is contained in:
Will Greenberg
2024-02-08 15:38:36 -08:00
parent d570ad3cb1
commit 5d7caba1a6
19 changed files with 150 additions and 52 deletions

26
telcom-parser/README.md Normal file
View File

@@ -0,0 +1,26 @@
# Autogenerated telcom packet parsing
This crate contains [ASN.1](https://en.wikipedia.org/wiki/ASN.1) specs for various telcom message payloads, as well as autogenerated
Rust code for parsing these messages. We're using [hampi](https://github.com/ystero-dev/hampi/) as a parser generator, and it seems
3GPP protocols are encoded in the unaligned Packed Encoding Rules (or uPER) codec.
## Generating the parser
To install the hampi compiler, run:
```
> cargo install asn1-compiler
```
To generate the parser for LTE RRC, run:
```
> hampi-rs-asn1c --codec uper --derive clone --derive partial-eq --derive serialize --module src/lte_rrc.rs -- specs/EUTRA* specs/PC5-RRC-Definitions.asn
```
## Sourcing the ASN.1 files
3GPP, who develops the standards for 4G (and all the other G's) publishes ASN.1 specs for their protocols in these horrific Microsoft Word docs (e.g. [here](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=2440)). The ASN.1 blocks are denoted by `--ASN1START` and `--ASN1STOP` text, so extracting them automatically is possible using a script like [hampi's](https://github.com/ystero-dev/hampi/blob/master/examples/specs/parse_spec.py). Instead of doing this ourselves, we just sourced ours from [these](https://obj-sys.com/products/asn1apis/lte_3gpp_apis.php#lte_4g_apis).
# TODO
* implement proof of concept binary using this to parse QMDL, summarize the packets