/common_helper_extraction

Extraction support functions

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

common_helper_extraction

Build Status codecov Codacy Badge

Extraction support functions

Function Overview

dump_files

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:

cut_at_padding

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), ... ]

extract_encoded_streams

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), ... ]

extract_lzma_streams

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), ... ]

get_decompressed_lzma_streams

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), ... ]