Generated from Manticore v1.1.5 • 201 packages. View on pkg.go.dev

message

import "github.com/TheManticoreProject/Manticore/network/smb/smb_v10/message"

Index

type Message

SMBMessage represents an SMB message Source: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-cifs/4d330f4c-151c-4d79-b207-40bd4f754da9

type Message struct {
    Header  *header.Header
    Command command_interface.CommandInterface
}

func NewMessage

func NewMessage() *Message

NewMessage creates a new SMB message Source: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-cifs/4d330f4c-151c-4d79-b207-40bd4f754da9

func (*Message) AddCommand

func (m *Message) AddCommand(command command_interface.CommandInterface)

AddCommand adds a command to the message If the command is an AndX, it will add the command and the next command If the command is not an AndX, it will add the command

func (*Message) Marshal

func (m *Message) Marshal() ([]byte, error)

Marshal serializes the Message into a byte slice.

This method marshals the message’s components in the following order:

  1. Header - Contains protocol identifier, command code, status, flags, etc.
  2. Parameters and Data blocks - For each ParameterDataBlock in the message: a. Parameters - Contains command-specific parameters b. Data - Contains command-specific data

The marshalled data follows the SMB protocol format as specified in MS-CIFS. For AndX messages, multiple parameter-data blocks will be marshalled sequentially.

Returns: - A byte slice containing the marshalled message - An error if marshalling any component fails

func (*Message) Unmarshal

func (m *Message) Unmarshal(marshalledData []byte) error

Unmarshal deserializes a byte slice into the Message structure.

This method reads the binary representation of the Message structure from the input byte slice according to the SMB protocol format. It processes the components in the following order:

  1. Header - Reads protocol identifier, command code, status, flags, etc.
  2. Parameters and Data blocks - For each ParameterDataBlock in the message: a. Parameters - Reads command-specific parameters b. Data - Reads command-specific data

For AndX messages, multiple parameter-data blocks will be unmarshalled sequentially. The method will continue reading blocks until all data in the input slice is consumed.

Parameters: - marshalledData: The byte slice containing the serialized Message structure

Returns: - An error if unmarshalling any component fails, or nil if successful

Subpackages