Extraction support functions
Uses the result list of one of the other functions and dumps the files to destination_directory
.
File names are OFFSET[suffix]
.
def dump_files(data: list, destination_directory: str, suffix: str='') -> None:
Cuts a BLOB input_data
at paddings of padding_pattern
with a minimal length of padding_min_length
.
cut_at_padding(input_data: bytes, padding_min_length: int=4, padding_pattern: bytes=b'\x00') -> list:
The result is a list of OFFSET, DATA tuples.
[ (OFFSET_1, DATA_1), ... ]
Extracts encoded streams out of a BLOB input_data
.
The streams must be defined by a regular expression stream_regex
.
extract_encoded_streams(input_data: bytes, stream_regex: bytes) -> list
The library provides the following stream_regex
:
SRECORD_REGEX
INTEL_HEX_REGEX
TEKTRONIX_REGEX
TEKTRONIX_EXT_REGEX
The result is a list of OFFSET, DATA tuples.
[ (OFFSET_1, DATA_1), ... ]
Extracts LZMA streams out of a BLOB input_data
.
extract_lzma_streams(input_data: bytes) -> list
The result is a list of OFFSET, DATA tuples.
[ (OFFSET_1, DATA_1), ... ]
Decompresses LZMA streams that may be the result of extract_lzma_streams
.
get_decompressed_lzma_streams(compressed_streams: list) -> list:
The result is a list of OFFSET, DATA tuples.
[ (OFFSET_1, DATA_1), ... ]