dissect.target.helpers.protobuf
#
Module Contents#
Classes#
Implements a protobuf integer type for dissect.cstruct that can span a variable amount of bytes. |
Functions#
Reads a varint from the provided buffer stream. |
|
Encode a decoded protobuf varint to its original bytes. |
- class dissect.target.helpers.protobuf.ProtobufVarint(cstruct: BytesInteger.__init__.cstruct, name: str, size: int, signed: bool, alignment: int = None)#
Bases:
dissect.cstruct.types.bytesinteger.BytesInteger
Implements a protobuf integer type for dissect.cstruct that can span a variable amount of bytes.
Mainly follows the cstruct BytesInteger implementation with minor tweaks to support protobuf’s msb varint implementation.
- dissect.target.helpers.protobuf.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.