pst

package
v3.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2022 License: AGPL-3.0-or-later Imports: 16 Imported by: 0

Documentation

Overview

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Package pst This file is part of go-pst (https://github.com/mooijtech/go-pst) Copyright (C) 2021 Marten Mooij (https://www.mooijtech.com/)

Index

Constants

View Source
const (
	BlockTypeXBlock  = 1
	BlockTypeXXBlock = 2
)

Constants defining the block types.

View Source
const (
	IdentifierTypeHID                     = 0
	IdentifierTypeInternal                = 1
	IdentifierTypeNormalFolder            = 2
	IdentifierTypeSearchFolder            = 3
	IdentifierTypeNormalMessage           = 4
	IdentifierTypeAttachment              = 5
	IdentifierTypeSearchUpdateQueue       = 6
	IdentifierTypeSearchCriteriaObject    = 7
	IdentifierTypeAssociatedMessage       = 8
	IdentifierTypeContentsTableIndex      = 10
	IdentifierTypeReceiveFolderTable      = 11
	IdentifierTypeOutgoingQueueTable      = 12
	IdentifierTypeHierarchyTable          = 13
	IdentifierTypeContentsTable           = 14
	IdentifierTypeAssociatedContentsTable = 15
	IdentifierTypeSearchContentsTable     = 16
	IdentifierTypeAttachmentTable         = 17
	IdentifierTypeRecipientTable          = 18
	IdentifierTypeSearchTableIndex        = 19
	IdentifierTypeLTP                     = 31

	IdentifierTypeRootFolder   = 290
	IdentifierTypeMessageStore = 33
	IdentifierTypeNameToIDMap  = 97
)

Constants defining the identifier types. References "Identifier types".

View Source
const (
	BTreeTypeNode  = 0
	BTreeTypeBlock = 1
)

Constants defining the b-tree types.

View Source
const (
	FormatTypeANSI      = "ANSI"
	FormatTypeUnicode   = "Unicode"
	FormatTypeUnicode4k = "Unicode4k"
)

Constants defining the format types. References "Format Types".

View Source
const (
	EncryptionTypeNone    = "None"
	EncryptionTypePermute = "Permute"
	EncryptionTypeCyclic  = "Cyclic"
)

Constants defining the encryption types. References "Encryption Types".

View Source
const (
	PropertyTypeInteger16            = 2
	PropertyTypeInteger32            = 3
	PropertyTypeFloating32           = 4
	PropertyTypeFloating64           = 5
	PropertyTypeCurrency             = 6
	PropertyTypeFloatingTime         = 7
	PropertyTypeErrorCode            = 10
	PropertyTypeBoolean              = 11
	PropertyTypeInteger64            = 20
	PropertyTypeString               = 31
	PropertyTypeString8              = 30
	PropertyTypeTime                 = 64
	PropertyTypeGUID                 = 72
	PropertyTypeServerID             = 251
	PropertyTypeRestriction          = 253
	PropertyTypeRuleAction           = 254
	PropertyTypeBinary               = 258
	PropertyTypeMultipleInteger16    = 4098
	PropertyTypeMultipleInteger32    = 4099
	PropertyTypeMultipleFloating32   = 4100
	PropertyTypeMultipleFloating64   = 4101
	PropertyTypeMultipleCurrency     = 4102
	PropertyTypeMultipleFloatingTime = 4103
	PropertyTypeMultipleInteger64    = 4116
	PropertyTypeMultipleString       = 4127
	PropertyTypeMultipleString8      = 4126
	PropertyTypeMultipleTime         = 4160
	PropertyTypeMultipleGUID         = 4168
	PropertyTypeMultipleBinary       = 4354
	PropertyTypeUnspecified          = 0
	PropertyTypeNull                 = 1
	PropertyTypeObject               = 13
)

Constants defining the property types. References "Property types".

Variables

View Source
var (
	ContentTypePST = []byte("SM")
	ContentTypeOST = []byte("SO")
	ContentTypePAB = []byte("AB")
)

Constants defining the content types. References "Content Types".

View Source
var (
	PropertySetPublicStrings        = 0
	PropertySetCommon               = 1
	PropertySetAddress              = 2
	PropertySetInternetHeaders      = 3
	PropertySetAppointment          = 4
	PropertySetMeeting              = 5
	PropertySetLog                  = 6
	PropertySetMessaging            = 7
	PropertySetNote                 = 8
	PropertySetPostRSS              = 9
	PropertySetTask                 = 10
	PropertySetUnifiedMessaging     = 11
	PropertySetMAPI                 = 12
	PropertySetAirSync              = 13
	PropertySetSharing              = 14
	PropertySetXMLExtractedEntities = 15
	PropertySetAttachment           = 16
)

Constants defining the commonly used property sets.

View Source
var (
	PropertySets = []string{
		"00020329-0000-0000-C000-000000000046",
		"00062008-0000-0000-C000-000000000046",
		"00062004-0000-0000-C000-000000000046",
		"00020386-0000-0000-C000-000000000046",
		"00062002-0000-0000-C000-000000000046",
		"6ED8DA90-450B-101B-98DA-00AA003F1305",
		"0006200A-0000-0000-C000-000000000046",
		"41F28F13-83F4-4114-A584-EEDB5A6B0BFF",
		"0006200E-0000-0000-C000-000000000046",
		"00062041-0000-0000-C000-000000000046",
		"00062003-0000-0000-C000-000000000046",
		"4442858E-A9E3-4E80-B900-317A210CC15B",
		"00020328-0000-0000-C000-000000000046",
		"71035549-0739-4DCB-9163-00F0580DBBDF",
		"00062040-0000-0000-C000-000000000046",
		"23239608-685D-4732-9C55-4C95CB4E8E33",
		"96357F7F-59E1-47D0-99A7-46515C183B54",
	}
)

Defines the property sets (GUIDs) in the Name-To-ID Map. "Property set: A GUID that identifies a group of properties with a similar purpose." References [MS-OXPROPS].pdf "1.3.2 Commonly Used Property Sets"

Functions

func DecodeBytesToString

func DecodeBytesToString(encoding Encoding, data []byte) (string, error)

DecodeBytesToString decodes the message property context item to string using the message encoding.

func DecodeBytesToUTF16String

func DecodeBytesToUTF16String(input []byte) (string, error)

DecodeBytesToUTF16String decodes the bytes to UTF-16. The libpff documentation states: "Unicode strings are stored in UTF-16 little-endian without the byte order mark (BOM)."

func DecodeCompressibleEncryption

func DecodeCompressibleEncryption(data []byte) []byte

DecodeCompressibleEncryption decodes the Heap-on-Node using compressible encryption. References "Compressible encryption".

Types

type Attachment

type Attachment struct {
	PropertyContext  []PropertyContextItem
	LocalDescriptors []LocalDescriptor
}

Attachment represents a message attachment.

func (*Attachment) GetFilename

func (attachment *Attachment) GetFilename() (string, error)

GetFilename returns the file name of this attachment.

func (*Attachment) GetInputStream

func (attachment *Attachment) GetInputStream(pstFile *File, formatType string, encryptionType string) (HeapOnNodeInputStream, error)

GetInputStream returns the input stream of this attachment.

func (*Attachment) GetLongFilename

func (attachment *Attachment) GetLongFilename() (string, error)

GetLongFilename returns the long file name of this attachment.

func (*Attachment) GetString

func (attachment *Attachment) GetString(propertyID int) (string, error)

GetString returns the string value of the property.

func (*Attachment) WriteToFile

func (attachment *Attachment) WriteToFile(outputPath string, pstFile *File, formatType string, encryptionType string) error

WriteToFile writes the input stream of the attachment to the specified output path.

type BTreeNodeEntry

type BTreeNodeEntry struct {
	Data     []byte
	Children []BTreeNodeEntry
}

BTreeNodeEntry represents an entry in a b-tree node.

func FindBTreeNodeFromNode

func FindBTreeNodeFromNode(btreeNode BTreeNodeEntry, identifier int, formatType string) (BTreeNodeEntry, error)

FindBTreeNodeFromNode recursively walks the children of this node to find the given identifier.

func (*BTreeNodeEntry) GetDataIdentifier

func (btreeNodeEntry *BTreeNodeEntry) GetDataIdentifier(formatType string) (int, error)

GetDataIdentifier returns the node identifier of the data (in the node b-tree). References "The b-tree entries".

func (*BTreeNodeEntry) GetFileOffset

func (btreeNodeEntry *BTreeNodeEntry) GetFileOffset(isBranchNode bool, formatType string) (int, error)

GetFileOffset returns the file offset for this b-tree branch or leaf node. References "The b-tree entries".

func (*BTreeNodeEntry) GetIdentifier

func (btreeNodeEntry *BTreeNodeEntry) GetIdentifier(formatType string) (int, error)

GetIdentifier returns the identifier of this b-tree node entry. References "The b-tree entries".

func (*BTreeNodeEntry) GetIdentifierType

func (btreeNodeEntry *BTreeNodeEntry) GetIdentifierType(formatType string) (int, error)

GetIdentifierType returns the b-tree node entry identifier type. References "The b-tree entries", "Identifier".

func (*BTreeNodeEntry) GetLocalDescriptorsIdentifier

func (btreeNodeEntry *BTreeNodeEntry) GetLocalDescriptorsIdentifier(formatType string) (int, error)

GetLocalDescriptorsIdentifier returns the identifier to the local descriptors in the block b-tree.

func (*BTreeNodeEntry) GetSize

func (btreeNodeEntry *BTreeNodeEntry) GetSize(formatType string) (int, error)

GetSize returns the size of the data in the block b-tree leaf node entry. References "The b-tree entries".

type BTreeOnHeapHeader

type BTreeOnHeapHeader struct {
	TableType int
	KeySize   int
	ValueSize int
	Levels    int
	HIDRoot   int
}

BTreeOnHeapHeader represents the b-tree on heap header.

type ColumnDescriptor

type ColumnDescriptor struct {
	PropertyType             int
	PropertyID               int
	DataOffset               int
	DataSize                 int
	CellExistenceBitmapIndex int
}

ColumnDescriptor represents a column in the Table Context. References "Table Context", "Table Context Column Descriptor".

func NewColumnDescriptor

func NewColumnDescriptor(tableContextInputStream HeapOnNodeInputStream, columnStartOffset int) (ColumnDescriptor, error)

NewColumnDescriptor is a constructor for creating column descriptors.

type Encoding

type Encoding struct {
	// References https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers
	Identifier int
	Name       string
}

Encoding represents an IANA index encoding.

func FindEncoding

func FindEncoding(identifier int) (Encoding, error)

FindEncoding returns the encoding by the specified identifier.

func GetEncodings

func GetEncodings() ([]Encoding, error)

GetEncodings returns all available encodings.

func (*Encoding) String

func (encoding *Encoding) String() string

String returns the encoding name.

type File

type File struct {
	Reader io.ReadSeekCloser

	// Variables which need to be initialized.
	NodeBTree   []BTreeNodeEntry
	BlockBTree  []BTreeNodeEntry
	NameToIDMap NameToIDMap
}

File represents a PST file.

func NewFromFile added in v3.1.0

func NewFromFile(filePath string) (File, error)

NewFromFile is a constructor for creating PST files from a file path.

func NewFromReader added in v3.1.0

func NewFromReader(reader io.ReadSeekCloser) File

NewFromReader is a constructor for creating PST files from a reader.

func (*File) Close added in v3.1.0

func (pstFile *File) Close() error

Close closes the PST file reader.

func (*File) FindBTreeNode

func (pstFile *File) FindBTreeNode(btreeType int, identifier int, formatType string) (BTreeNodeEntry, error)

FindBTreeNode returns the node in the node or block b-tree with the given identifier. Note that we don't return the first identifier because there may be two or more nodes with the same identifier so prefer leaf nodes (which there is always only one of).

func (*File) GetBTreeNodeEntries

func (pstFile *File) GetBTreeNodeEntries(btreeNodeOffset int, formatType string) ([]BTreeNodeEntry, error)

GetBTreeNodeEntries returns the entries in the b-tree node. References "The node and block b-tree".

func (*File) GetBTreeNodeEntryCount

func (pstFile *File) GetBTreeNodeEntryCount(btreeNodeOffset int, formatType string) (int, error)

GetBTreeNodeEntryCount returns the amount of entries in the b-tree. References "The node and block b-tree".

func (*File) GetBTreeNodeEntrySize

func (pstFile *File) GetBTreeNodeEntrySize(btreeNodeOffset int, formatType string) (int, error)

GetBTreeNodeEntrySize returns the size of an entry in the b-tree. References "The node and block b-tree".

func (*File) GetBTreeNodeLevel

func (pstFile *File) GetBTreeNodeLevel(btreeNodeOffset int, formatType string) (int, error)

GetBTreeNodeLevel returns the level of the b-tree node. References "The node and block b-tree".

func (*File) GetBTreeOnHeapHeader

func (pstFile *File) GetBTreeOnHeapHeader(heapOnNode HeapOnNode, localDescriptors []LocalDescriptor, formatType string, encryptionType string) (BTreeOnHeapHeader, error)

GetBTreeOnHeapHeader returns the btree on heap header.

func (*File) GetBlockBTreeNode

func (pstFile *File) GetBlockBTreeNode(identifier int, formatType string) (BTreeNodeEntry, error)

GetBlockBTreeNode returns the node with the given identifier in the block b-tree.

func (*File) GetBlockBTreeOffset

func (pstFile *File) GetBlockBTreeOffset(formatType string) (int, error)

GetBlockBTreeOffset returns the file offset to the block b-tree. References "The 64-bit header data", "The 32-bit header data".

func (*File) GetBlockSize

func (pstFile *File) GetBlockSize(formatType string) (int, error)

GetBlockSize returns the size of a block. References "Blocks".

func (*File) GetBlockTrailerSize

func (pstFile *File) GetBlockTrailerSize(formatType string) (int, error)

GetBlockTrailerSize returns the size of a block trailer. References "Blocks".

func (*File) GetBlocks

func (pstFile *File) GetBlocks(nodeEntryHeapOnNodeOffset int, formatType string) ([]BTreeNodeEntry, error)

GetBlocks parses the XBlock and XXBlock from a Heap-on-Node. Used by the NodeInputStream (internal identifiers have blocks).

func (*File) GetBlocksTotalSize

func (pstFile *File) GetBlocksTotalSize(nodeEntryHeapOnNodeOffset int) (int, error)

GetBlocksTotalSize returns the size of the external data referenced by the XBlock or XXBlock.

func (*File) GetContentType

func (pstFile *File) GetContentType() ([]byte, error)

GetContentType returns if the file is a PST, OST or PAB file. References "File Header", "Content Types".

func (*File) GetDataBTreeNode

func (pstFile *File) GetDataBTreeNode(identifier int, formatType string) (BTreeNodeEntry, error)

GetDataBTreeNode searches the identifier in the node b-tree, then searches the data identifier in the block b-tree.

func (*File) GetEncryptionType

func (pstFile *File) GetEncryptionType(formatType string) (string, error)

GetEncryptionType returns the encryption type. References "The 64-bit header data", "The 32-bit header data", "Encryption Types".

func (*File) GetFormatType

func (pstFile *File) GetFormatType() (string, error)

GetFormatType returns the format type. References "File Header", "Format Types".

func (*File) GetLocalDescriptors

func (pstFile *File) GetLocalDescriptors(btreeNodeEntry BTreeNodeEntry, formatType string) ([]LocalDescriptor, error)

func (*File) GetLocalDescriptorsFromIdentifier

func (pstFile *File) GetLocalDescriptorsFromIdentifier(localDescriptorsIdentifier int, formatType string) ([]LocalDescriptor, error)

GetLocalDescriptorsFromIdentifier returns the local descriptors of the local descriptors identifier. References "Local Descriptors".

func (*File) GetMessage

func (pstFile *File) GetMessage(identifier int, formatType string, encryptionType string) (Message, error)

GetMessage returns the message of the identifier.

func (*File) GetMessageStore

func (pstFile *File) GetMessageStore(formatType string, encryptionType string) (MessageStore, error)

GetMessageStore returns the message store of the PST file.

func (*File) GetMessageTableContext

func (pstFile *File) GetMessageTableContext(folder Folder, formatType string, encryptionType string) ([][]TableContextItem, error)

GetMessageTableContext returns the message table context of this folder.

func (*File) GetMessages

func (pstFile *File) GetMessages(folder Folder, formatType string, encryptionType string) ([]Message, error)

GetMessages returns an array of messages from the message table context.

func (*File) GetNameToIDMap

func (pstFile *File) GetNameToIDMap(formatType string, encryptionType string) (NameToIDMap, error)

GetNameToIDMap returns the Name-To-ID Map.

func (*File) GetNodeBTreeNode

func (pstFile *File) GetNodeBTreeNode(identifier int, formatType string) (BTreeNodeEntry, error)

GetNodeBTreeNode returns the node with the given identifier in the node b-tree.

func (*File) GetNodeBTreeOffset

func (pstFile *File) GetNodeBTreeOffset(formatType string) (int, error)

GetNodeBTreeOffset returns the file offset to the node b-tree. References "The 64-bit header data", "The 32-bit header data".

func (*File) GetPropertyContext

func (pstFile *File) GetPropertyContext(heapOnNode HeapOnNode, formatType string, encryptionType string) ([]PropertyContextItem, error)

GetPropertyContext returns the property context (BC Table). References "Property Context".

func (*File) GetRootFolder

func (pstFile *File) GetRootFolder(formatType string, encryptionType string) (Folder, error)

GetRootFolder returns the root folder of the PST file.

func (*File) GetSubFolderTableContext

func (pstFile *File) GetSubFolderTableContext(folder Folder, formatType string, encryptionType string) ([][]TableContextItem, error)

GetSubFolderTableContext returns the table context for the sub-folders of this folder.

func (*File) GetSubFolders

func (pstFile *File) GetSubFolders(folder Folder, formatType string, encryptionType string) ([]Folder, error)

GetSubFolders returns the sub folders of this folder.

func (*File) GetTableContext

func (pstFile *File) GetTableContext(heapOnNode HeapOnNode, localDescriptors []LocalDescriptor, formatType string, encryptionType string, startAtRow int, numberOfRowsToReturn int, columnToGet int) ([][]TableContextItem, error)

GetTableContext returns the table context. The number of rows to return may be -1 to return all rows. References "Table Context".

func (*File) InitializeBTree

func (pstFile *File) InitializeBTree(btreeType int, formatType string) error

InitializeBTree walks the b-tree and finds the node with the given identifier.

func (*File) InitializeBTrees

func (pstFile *File) InitializeBTrees(formatType string) error

InitializeBTrees initializes the node and block b-tree.

func (*File) InitializeNameToIDMap

func (pstFile *File) InitializeNameToIDMap(formatType string, encryptionType string) error

InitializeNameToIDMap initializes the Name-To-ID Map.

func (*File) IsValidSignature

func (pstFile *File) IsValidSignature() (bool, error)

IsValidSignature returns true is the file matches the PFF format signature. References "File Header".

func (*File) NewHeapOnNodeFromLocalDescriptor

func (pstFile *File) NewHeapOnNodeFromLocalDescriptor(localDescriptor LocalDescriptor, formatType string, encryptionType string) (HeapOnNode, error)

NewHeapOnNodeFromLocalDescriptor creates a Heap-on-Node from the local descriptor.

func (*File) NewHeapOnNodeFromNode

func (pstFile *File) NewHeapOnNodeFromNode(btreeNodeEntry BTreeNodeEntry, formatType string, encryptionType string) (HeapOnNode, error)

NewHeapOnNodeFromNode creates a Heap-on-Node from the b-tree node entry.

func (*File) NewHeapOnNodeInputStream

func (pstFile *File) NewHeapOnNodeInputStream(btreeNodeEntry BTreeNodeEntry, formatType string, encryptionType string) (HeapOnNodeInputStream, error)

NewHeapOnNodeInputStream creates a node input stream from the Heap-on-Node.

func (*File) NewHeapOnNodeInputStreamFromHNID

func (pstFile *File) NewHeapOnNodeInputStreamFromHNID(hnid int, heapOnNode HeapOnNode, localDescriptors []LocalDescriptor, formatType string, encryptionType string) (HeapOnNodeInputStream, error)

NewHeapOnNodeInputStreamFromHNID returns the offsets from the allocation table of the given HID.

func (*File) Read

func (pstFile *File) Read(outputBufferSize int, offset int) ([]byte, error)

Read reads the PST file from the given output buffer size and offset to bytes.

func (*File) WalkBTree

func (pstFile *File) WalkBTree(btreeOffset int, formatType string) ([]BTreeNodeEntry, error)

WalkBTree walks the b-tree and returns all nodes.

type Folder

type Folder struct {
	Identifier      int
	DisplayName     string
	HasSubFolders   bool
	MessageCount    int
	PropertyContext []PropertyContextItem
}

Folder represents a folder.

type GUID

type GUID struct {
	Data1 uint32
	Data2 uint16
	Data3 uint16
	Data4 [8]byte
}

GUID represents a GUID/UUID. It has the same structure as golang.org/x/sys/windows.GUID so that it can be used with functions expecting that type. It is defined as its own type as that is only available to builds targeted at `windows`. The representation matches that used by native Windows code.

func GUIDFromWindowsArray

func GUIDFromWindowsArray(b [16]byte) GUID

GUIDFromWindowsArray constructs a GUID from a Windows encoding array of bytes.

func (GUID) String

func (g GUID) String() string

type HeapOnNode

type HeapOnNode struct {
	BTreeNodeEntry BTreeNodeEntry
	InputStream    HeapOnNodeInputStream
}

HeapOnNode represents a Heap-on-Node.

func (*HeapOnNode) GetHIDUserRoot

func (heapOnNode *HeapOnNode) GetHIDUserRoot() (int, error)

GetHIDUserRoot returns the HID user root. References "Heap-on-Node header".

func (*HeapOnNode) GetPageMap

func (heapOnNode *HeapOnNode) GetPageMap(blockOffset int) (int, error)

GetPageMap returns the Heap-on-Node Page Map. References "Heap-on-Node page map".

func (*HeapOnNode) GetTableType

func (heapOnNode *HeapOnNode) GetTableType() (int, error)

GetTableType returns the table type. References "Heap-on-Node header", "Table types".

func (*HeapOnNode) IsValidSignature

func (heapOnNode *HeapOnNode) IsValidSignature() (bool, error)

IsValidSignature returns true if the signature of the block matches 0xEC (236). References "Heap-on-Node header".

type HeapOnNodeInputStream

type HeapOnNodeInputStream struct {
	File           *File
	FormatType     string
	EncryptionType string
	FileOffset     int
	StartOffset    int
	Size           int
	Blocks         []BTreeNodeEntry

	// PropertyContextItem works with data directly instead of a file offset.
	UnencryptedInternalAttachmentData []byte
}

HeapOnNodeInputStream represents a node input stream for a Heap-on-Node.

func (*HeapOnNodeInputStream) Read

func (heapOnNodeInputStream *HeapOnNodeInputStream) Read(outputBufferSize int, offset int) ([]byte, error)

Read reads from the node input stream.

func (*HeapOnNodeInputStream) ReadCompletely

func (heapOnNodeInputStream *HeapOnNodeInputStream) ReadCompletely(formatType string) ([]byte, error)

ReadCompletely reads all the data (handles blocks).

func (*HeapOnNodeInputStream) SeekAndReadUint16

func (heapOnNodeInputStream *HeapOnNodeInputStream) SeekAndReadUint16(outputBufferSize int, offset int) (int, error)

SeekAndReadUint16 seeks and reads an uint16.

func (*HeapOnNodeInputStream) SeekAndReadUint32

func (heapOnNodeInputStream *HeapOnNodeInputStream) SeekAndReadUint32(outputBufferSize int, offset int) (int, error)

SeekAndReadUint32 seeks and reads an uint32.

type LocalDescriptor

type LocalDescriptor struct {
	// contains filtered or unexported fields
}

LocalDescriptor represents an item in the local descriptors. A local descriptor is basically a reference to a node which contains the data.

func FindLocalDescriptor

func FindLocalDescriptor(localDescriptors []LocalDescriptor, identifier int, formatType string) (LocalDescriptor, error)

FindLocalDescriptor returns the local descriptor with the specified identifier.

func (*LocalDescriptor) GetData

func (localDescriptor *LocalDescriptor) GetData(pstFile *File, formatType string, encryptionType string) ([]byte, error)

GetData returns all the local descriptor data from the data node.

func (*LocalDescriptor) GetDataIdentifier

func (localDescriptor *LocalDescriptor) GetDataIdentifier(formatType string) (int, error)

GetDataIdentifier returns the data identifier of the local descriptor. References "Local Descriptors".

func (*LocalDescriptor) GetIdentifier

func (localDescriptor *LocalDescriptor) GetIdentifier(formatType string) (int, error)

GetIdentifier returns the identifier of the local descriptor. References "Local Descriptors".

func (*LocalDescriptor) GetLocalDescriptorsIdentifier

func (localDescriptor *LocalDescriptor) GetLocalDescriptorsIdentifier(formatType string) (int, error)

GetLocalDescriptorsIdentifier returns the local descriptors identifier of the local descriptor. References "Local Descriptors".

type Message

type Message struct {
	PropertyContext         []PropertyContextItem
	LocalDescriptors        []LocalDescriptor
	AttachmentsTableContext [][]TableContextItem
}

Message represents a message.

func (*Message) GetAppointmentAllAttendees

func (message *Message) GetAppointmentAllAttendees(pstFile *File, formatType string, encryptionType string) (string, error)

GetAppointmentAllAttendees returns all attendees to this appointment.

func (*Message) GetAppointmentEndTime

func (message *Message) GetAppointmentEndTime(pstFile *File) (time.Time, error)

GetAppointmentEndTime returns the appointment's end time.

func (*Message) GetAppointmentLocation

func (message *Message) GetAppointmentLocation(pstFile *File, formatType string, encryptionType string) (string, error)

GetAppointmentLocation returns the location of the appointment.

func (*Message) GetAppointmentStartTime

func (message *Message) GetAppointmentStartTime(pstFile *File) (time.Time, error)

GetAppointmentStartTime returns the appointment's start time.

func (*Message) GetAttachment

func (message *Message) GetAttachment(attachmentNumber int, pstFile *File, formatType string, encryptionType string) (Attachment, error)

GetAttachment returns the specified attachment.

func (*Message) GetAttachments

func (message *Message) GetAttachments(pstFile *File, formatType string, encryptionType string) ([]Attachment, error)

GetAttachments returns the attachments of this message.

func (*Message) GetAttachmentsCount

func (message *Message) GetAttachmentsCount(pstFile *File, formatType string, encryptionType string) (int, error)

GetAttachmentsCount returns the amount of rows in the attachments table context.

func (*Message) GetAttachmentsTableContext

func (message *Message) GetAttachmentsTableContext(pstFile *File, formatType string, encryptionType string) ([][]TableContextItem, error)

GetAttachmentsTableContext returns the table context of the attachments of this message.

func (*Message) GetBCC

func (message *Message) GetBCC(pstFile *File, formatType string, encryptionType string) (string, error)

GetBCC returns the BCC of this message.

func (*Message) GetBody

func (message *Message) GetBody(pstFile *File, formatType string, encryptionType string) (string, error)

GetBody returns the plaintext body of the message.

func (*Message) GetBodyHTML

func (message *Message) GetBodyHTML(pstFile *File, formatType string, encryptionType string) (string, error)

GetBodyHTML returns the HTML body of this message.

func (*Message) GetCC

func (message *Message) GetCC(pstFile *File, formatType string, encryptionType string) (string, error)

GetCC returns the "CC" header.

func (*Message) GetContactBusinessPhoneNumber

func (message *Message) GetContactBusinessPhoneNumber(pstFile *File, formatType string, encryptionType string) (string, error)

GetContactBusinessPhoneNumber returns the business phone number of this contact.

func (*Message) GetContactCompanyName

func (message *Message) GetContactCompanyName(pstFile *File, formatType string, encryptionType string) (string, error)

GetContactCompanyName returns the contact's company name.

func (*Message) GetContactEmailDisplayName

func (message *Message) GetContactEmailDisplayName(pstFile *File, formatType string, encryptionType string) (string, error)

GetContactEmailDisplayName returns the contact's email display name.

func (*Message) GetContactGivenName

func (message *Message) GetContactGivenName(pstFile *File, formatType string, encryptionType string) (string, error)

GetContactGivenName returns the given name of this contact.

func (*Message) GetContactMobilePhoneNumber

func (message *Message) GetContactMobilePhoneNumber(pstFile *File, formatType string, encryptionType string) (string, error)

GetContactMobilePhoneNumber returns the contact's mobile phone number.

func (*Message) GetDate

func (message *Message) GetDate(propertyID int) (time.Time, error)

GetMessageDate returns the date value of the property.

func (*Message) GetEncoding

func (message *Message) GetEncoding() (Encoding, error)

GetEncoding returns the encoding of the message.

func (*Message) GetFrom

func (message *Message) GetFrom(pstFile *File, formatType string, encryptionType string) (string, error)

GetFrom returns the "From" header.

func (*Message) GetHeaders

func (message *Message) GetHeaders(pstFile *File, formatType string, encryptionType string) (string, error)

GetHeaders return the message headers.

func (*Message) GetInteger

func (message *Message) GetInteger(propertyID int) (int, error)

GetInteger returns the integer value of the property.

func (*Message) GetMessageClass

func (message *Message) GetMessageClass(pstFile *File, formatType string, encryptionType string) (string, error)

GetMessageClass returns the message class.

func (*Message) GetMessageID

func (message *Message) GetMessageID(pstFile *File, formatType string, encryptionType string) (string, error)

GetMessageID returns the message ID.

func (*Message) GetReceivedDate

func (message *Message) GetReceivedDate() (time.Time, error)

GetReceivedDate returns the date this message was received.

func (*Message) GetString

func (message *Message) GetString(propertyID int, pstFile *File, formatType string, encryptionType string) (string, error)

GetString returns the string value of the property.

func (*Message) GetSubject

func (message *Message) GetSubject(pstFile *File, formatType string, encryptionType string) (string, error)

GetSubject returns the subject of this message.

func (*Message) GetTo

func (message *Message) GetTo(pstFile *File, formatType string, encryptionType string) (string, error)

GetTo returns the "To" header.

func (*Message) HasAttachments

func (message *Message) HasAttachments() (bool, error)

HasAttachments returns true if this message has attachments.

type MessageStore

type MessageStore struct {
	PropertyContext []PropertyContextItem
}

MessageStore represents the message store.

type NameToIDMap

type NameToIDMap struct {
	PropertySets []string
	NameToID     map[int]int
	IDToName     map[int]int
	StringToID   map[string]int
	IDToString   map[int]string
}

NameToIDMap represents the Name-To-ID Map.

func (*NameToIDMap) GetPropertyID

func (nameToIDMap *NameToIDMap) GetPropertyID(key int, propertySetIndex int) (int, error)

GetPropertyID returns the Name-To-ID property ID.

type Property

type Property struct {
	Name string
	ID   int
}

Property represents a property.

func FindProperty

func FindProperty(propertyID int) (Property, error)

FindProperty finds the property from the property ID.

func GetProperties

func GetProperties() ([]Property, error)

GetProperties returns all available properties.

type PropertyContextItem

type PropertyContextItem struct {
	Index                    int
	PropertyID               int
	PropertyType             int
	ReferenceHNID            int
	IsExternalValueReference bool
	// contains filtered or unexported fields
}

PropertyContextItem represents an item within the property context. References "Property Context B-Tree-on-Heap Record".

func FindPropertyContextItem

func FindPropertyContextItem(propertyContext []PropertyContextItem, propertyID int) (PropertyContextItem, error)

FindPropertyContextItem returns the property context item from the property ID.

func (*PropertyContextItem) GetData

func (propertyContextItem *PropertyContextItem) GetData(pstFile *File, localDescriptors []LocalDescriptor, formatType string, encryptionType string) ([]byte, error)

GetData returns all the data of the property context item. Used for property type binary (external reference) which may be located in the local descriptors.

func (*PropertyContextItem) GetDate

func (propertyContextItem *PropertyContextItem) GetDate() time.Time

GetDate returns the date value of the property context item.

func (*PropertyContextItem) GetInteger

func (propertyContextItem *PropertyContextItem) GetInteger() int

GetInteger returns the integer value of the property context item.

func (*PropertyContextItem) GetString

func (propertyContextItem *PropertyContextItem) GetString(encoding Encoding, localDescriptors []LocalDescriptor, pstFile *File, formatType string, encryptionType string) (string, error)

GetString returns the string value of the property context item.

func (*PropertyContextItem) String

func (propertyContextItem *PropertyContextItem) String() (string, error)

String returns the string representation of this property.

type TableContextItem

type TableContextItem struct {
	PropertyType             int
	PropertyID               int
	ReferenceHNID            int
	IsExternalValueReference bool
	Data                     []byte
}

TableContextItem represents an item within the table context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL