:py:mod:`dissect.target.helpers.protobuf` ========================================= .. py:module:: dissect.target.helpers.protobuf Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dissect.target.helpers.protobuf.ProtobufVarint Functions ~~~~~~~~~ .. autoapisummary:: :nosignatures: dissect.target.helpers.protobuf.decode_varint dissect.target.helpers.protobuf.encode_varint .. py:class:: ProtobufVarint Bases: :py:obj:`dissect.cstruct.types.base.BaseType` Implements a protobuf integer type for dissect.cstruct that can span a variable amount of bytes. Supports protobuf's msb varint implementation. .. rubric:: References - https://protobuf.dev/programming-guides/encoding/ - https://github.com/protocolbuffers/protobuf/blob/main/python/google/protobuf/internal/decoder.py .. py:function:: decode_varint(stream: BinaryIO) -> int Reads a varint from the provided buffer stream. If we have not reached the end of a varint, the msb will be 1. We read every byte from our current position until the msb is 0. .. py:function:: encode_varint(number: int) -> bytes Encode a decoded protobuf varint to its original bytes.