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

command_interface

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

Index

type Command

Command is a struct that implements the CommandInterface

type Command struct {
    // Command code
    CommandCode codes.CommandCode

    // AndX command
    AndX *andx.AndX

    // Parameters
    Parameters *parameters.Parameters

    // Data
    Data *data.Data

    // Next command
    NextCommand CommandInterface

    // Unicode records whether the enclosing SMB message uses Unicode strings
    // (the SMB_FLAGS2_UNICODE header flag). It is set by the message layer
    // before Unmarshal so string fields are decoded with the right encoding.
    Unicode bool
}

func (*Command) AddCommandToChain

func (c *Command) AddCommandToChain(nextCommand CommandInterface)

AddCommandToChain adds a command to the chain

Parameters:

  • nextCommand: The next command to add to the chain

func (*Command) GetAndX

func (c *Command) GetAndX() *andx.AndX

GetAndX returns the AndX of the command

Returns:

  • *andx.AndX: The AndX of the command

func (*Command) GetChainLength

func (c *Command) GetChainLength() uint

GetChainLength returns the length of the chain of commands

Returns:

  • uint: The length of the chain of commands

func (*Command) GetCommandCode

func (c *Command) GetCommandCode() codes.CommandCode

GetCommandCode returns the command code

Returns:

  • codes.CommandCode: The command code

func (*Command) GetData

func (c *Command) GetData() *data.Data

GetData returns the data of the command

Returns:

  • *data.Data: The data of the command

func (*Command) GetNextCommand

func (c *Command) GetNextCommand() CommandInterface

GetNextCommand returns the next command in the chain If the command is not an AndX, it returns nil

Returns:

  • CommandInterface: The next command in the chain

func (*Command) GetParameters

func (c *Command) GetParameters() *parameters.Parameters

GetParameters returns the parameters of the command

Returns:

  • *parameters.Parameters: The parameters of the command

func (*Command) Init

func (c *Command) Init()

Init initializes the command

Parameters:

  • commandCode: The command code to set

func (*Command) IsAndX

func (c *Command) IsAndX() bool

IsAndX returns true if the command is an AndX

Returns:

  • bool: True if the command is an AndX, false otherwise

func (*Command) IsUnicode

func (c *Command) IsUnicode() bool

IsUnicode reports whether the enclosing SMB message uses Unicode strings.

Returns:

  • bool: True if the SMB_FLAGS2_UNICODE header flag is set

func (*Command) Marshal

func (c *Command) Marshal() ([]byte, error)

Marshal returns the marshalled command

Returns:

  • []byte: The marshalled command
  • error: An error if the marshalling fails

func (*Command) SetAndX

func (c *Command) SetAndX(andX *andx.AndX)

SetAndX sets the AndX of the command

Parameters:

  • andX: The AndX to set

func (*Command) SetCommandCode

func (c *Command) SetCommandCode(commandCode codes.CommandCode)

SetCommandCode sets the command code

Parameters:

  • commandCode: The command code to set

func (*Command) SetData

func (c *Command) SetData(data *data.Data)

SetData sets the data of the command

Parameters:

  • data: The data to set

func (*Command) SetNextCommand

func (c *Command) SetNextCommand(nextCommand CommandInterface)

SetNextCommand sets the next command in the chain

Parameters:

  • nextCommand: The next command to set

func (*Command) SetParameters

func (c *Command) SetParameters(parameters *parameters.Parameters)

SetParameters sets the parameters of the command

Parameters:

  • parameters: The parameters to set

func (*Command) SetUnicode

func (c *Command) SetUnicode(unicode bool)

SetUnicode records whether the enclosing SMB message uses Unicode strings.

Parameters:

  • unicode: True if the SMB_FLAGS2_UNICODE header flag is set

func (*Command) Unmarshal

func (c *Command) Unmarshal(data []byte) (int, error)

Unmarshal unmarshals the command

Parameters:

  • data: The data to unmarshal

Returns:

  • int: The number of bytes unmarshalled
  • error: An error if the unmarshalling fails

type CommandInterface

type CommandInterface interface {
    // GetCommandCode returns the command code
    GetCommandCode() codes.CommandCode

    // SetCommandCode sets the command code
    SetCommandCode(codes.CommandCode)

    // GetAndX returns the AndX of the command
    GetAndX() *andx.AndX

    // SetAndX sets the AndX of the command
    SetAndX(*andx.AndX)

    // IsAndX returns true if the command is an AndX
    IsAndX() bool

    // GetParameters returns the parameters of the command
    GetParameters() *parameters.Parameters

    // SetParameters sets the parameters of the command
    SetParameters(*parameters.Parameters)

    // GetData returns the data of the command
    GetData() *data.Data

    // SetData sets the data of the command
    SetData(*data.Data)

    // GetNextCommand returns the next command in the chain
    // If the command is not an AndX, it returns nil
    GetNextCommand() CommandInterface

    // SetNextCommand sets the next command in the chain
    SetNextCommand(CommandInterface)

    // AddCommandToChain adds a command to the chain
    AddCommandToChain(CommandInterface)

    // GetChainLength returns the length of the chain of commands
    GetChainLength() uint

    // Marshal returns the marshalled command
    Marshal() ([]byte, error)

    // Unmarshal unmarshals the command
    Unmarshal([]byte) (int, error)

    // Init initializes the command
    Init()

    // SetUnicode records whether the enclosing SMB message uses Unicode strings
    // (the SMB_FLAGS2_UNICODE header flag), so that Unmarshal can decode
    // string fields with the correct character encoding.
    SetUnicode(bool)

    // IsUnicode reports whether the enclosing SMB message uses Unicode strings.
    IsUnicode() bool
}