chipwhisperer icon indicating copy to clipboard operation
chipwhisperer copied to clipboard

Add TPIU pure-python parser

Open jmichelp opened this issue 1 month ago • 2 comments

Orbuculum stopped accepting raw TPIU frames since v2.2.0. As TPIU framing is stable, parsing it in Python makes sense, leaving the other more complicated layers to Orbuculum to parse.

The code additionnaly leveraged the official python wrapper pyorb (pip install python-orbuculum) to directly use liborb and thus removes the need to write data to files, call binaries and then parse their text output. As packets are then returned as different python classes, it also opens support for more advanced ITM/ETM/DTW work for SCA.

Also added self-test to make sure future code changes don't introduce regression as the parsing is a bit twisted.

Code is heavily inspired from the TPIU decoder contained in Orbuculum project.

jmichelp avatar Nov 14 '25 14:11 jmichelp

mypy is failing because match/case statement has been introduced in python 3.10 and mypy workflow uses python 3.9.

That being said, python 3.9 is EOL and not supported anymore since Oct 31, 2025. Changing the code into if/elif/else statement would impact the readability IMO. But I can also remove the function completely as it's more a helper function for debugging/inspecting packets.

jmichelp avatar Nov 14 '25 14:11 jmichelp

This is great, thank you for the contribution. We will be moving away from 3.9 so that's not an issue. There is just a typo in the example usage, replace read_capture)data() with read_capture_data().

jpcrypt avatar Nov 26 '25 20:11 jpcrypt