extract_msg.properties.prop Module

Module contents

class extract_msg.properties.prop.FixedLengthProp(data: bytes)[source]

Bases: PropBase

Class to contain the data for a single fixed length property.

Currently a work in progress.

toBytes() bytes[source]

Converts the property into bytes.

Raises:

ValueError – An issue occured where the value was not converted to bytes.

property signedValue: Any

A signed representation of the value.

Setting the value through this property will convert it if necessary before using the default value setter.

Raises:

struct.error – The value was out of range when setting.

property value: Any

Property value.

class extract_msg.properties.prop.PropBase(data: bytes)[source]

Bases: ABC

Base class for Prop instances.

abstract toBytes() bytes[source]

Converts the property into a string of 16 bytes.

property flags: PropertyFlags

Integer that contains property flags.

property name: str

Hexadecimal representation of the property ID followed by the type.

property propertyID: int

The property ID for this property.

property type: int

The type of property.

class extract_msg.properties.prop.VariableLengthProp(data: bytes)[source]

Bases: PropBase

Class to contain the data for a single variable length property.

toBytes() bytes[source]

Converts the property into a string of 16 bytes.

property size: int

The size of the data the property corresponds to.

For string streams, this is the number of characters contained. For multiple properties, this is the number of entries.

When setting this, the underlying length field will be set which is a manipulated value. For multiple properties of a fixed length, this will be the size value multiplied by the length of the properties. For multiple strings, this will be 4 times the size value. For multiple binary, this will be 8 times the size value. For strings, this will be the number of characters plus 1 if non-unicode, otherwise the number of characters plus 1, all multiplied by 2. For binary, this will be the size with no modification.

Size cannot be set for properties of type 0x000D and 0x0048.

Raises:
  • TypeError – Tried to set the size for a property that cannot have the size changed.

  • ValueError – The translated value for the size is too large when setting.

property reservedFlags: int

The reserved flags field of the variable length property.

extract_msg.properties.prop.createProp(data: bytes) PropBase[source]

Creates an instance of PropBase from the specified bytes.

If the prop type is not recognized, a VariableLengthProp will be created.

extract_msg.properties.prop.createNewProp(name: str)[source]

Creates a blank property using the specified name.

Parameters:

name – An 8 character hex string containing the property ID and type.

Raises:
  • TypeError – A type other than a str was given.

  • ValueError – The string was not 8 hex characters.

  • ValueError – An invalid property type was given.