Class: PacketGen::Plugin::SMB::NtCreateAndX::Response

Inherits:
Header::Base
  • Object
show all
Defined in:
lib/packetgen/plugin/smb/ntcreateandx/response.rb

Overview

SMB Command NtCreateAndX response

Author:

  • Sylvain Daubert

Constant Summary collapse

OP_LOCK_LEVELS =

OpLock levels

{
  'none' => 0,
  'exclusive' => 1,
  'batch' => 2,
  'level II' => 3,
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_timeInteger

64-bit integer representing the time that the file was last accessed.

Returns:

  • (Integer)


63
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 63

define_field :access_time, SMB::Filetime

#alloc_sizeInteger

64-bit integer representing the number of bytes allocated to the file.

Returns:

  • (Integer)


79
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 79

define_field :alloc_size, PacketGen::Types::Int64le

#and_xcommandInteger

8-bit command code for the next SMB command in the packet.

Returns:

  • (Integer)


31
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 31

define_field :and_xcommand, PacketGen::Types::Int8Enum, enum: Request::COMMANDS

#and_xoffsetInteger

16-bit offset from the start of SMB header to the start of the #word_count field in the next SMB command in this packet.

Returns:

  • (Integer)


41
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 41

define_field :and_xoffset, PacketGen::Types::Int16le, default: 0

#attributesInteger

32-bit extended file attributes.

Returns:

  • (Integer)


75
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 75

define_field :attributes, PacketGen::Types::Int32le

#byte_countInteger

The size, in bytes, of the SMB data. Should be zero.

Returns:

  • (Integer)


100
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 100

define_field :byte_count, PacketGen::Types::Int16le, default: 0

#change_timeInteger

64-bit integer representing the time that the file was last changed.

Returns:

  • (Integer)


71
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 71

define_field :change_time, SMB::Filetime

#create_timeInteger

64-bit integer representing the time that the file was created.

Returns:

  • (Integer)


59
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 59

define_field :create_time, SMB::Filetime

#directoryInteger

8-bit field indicating is the FID represents a directory.

Returns:

  • (Integer)


96
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 96

define_field :directory, PacketGen::Types::Int8

#dispositionInteger

32-bit value that represents the action to take if the file already exists or if the file is a new file and does not already exist.

Returns:

  • (Integer)


55
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 55

define_field :disposition, PacketGen::Types::Int32le

#end_of_fileInteger

64-bit integer representing the end of file offset.

Returns:

  • (Integer)


83
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 83

define_field :end_of_file, PacketGen::Types::Int64le

#fidInteger

16-bit FID.

Returns:

  • (Integer)


49
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 49

define_field :fid, PacketGen::Types::Int16le

#oplock_levelInteger

8-bit OpLock level.

Returns:

  • (Integer)


45
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 45

define_field :oplock_level, PacketGen::Types::Int8Enum, enum: OP_LOCK_LEVELS

#pipe_statusInteger

16-bit field that shows the status of the named pipe (if opened resource is a named pipe).

Returns:

  • (Integer)


92
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 92

define_field :pipe_status, PacketGen::Types::Int16le

#res_typeInteger

16-bit file type.

Returns:

  • (Integer)


87
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 87

define_field :res_type, PacketGen::Types::Int16le

#rsv1Integer

8-bit reserved field.

Returns:

  • (Integer)


35
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 35

define_field :rsv1, PacketGen::Types::Int8, default: 0

#word_countInteger

The size, in 2-byte words, of the SMB parameters.

Returns:

  • (Integer)


26
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 26

define_field :word_count, PacketGen::Types::Int8, default: 34

#write_timeInteger

64-bit integer representing the time that the file was last writen.

Returns:

  • (Integer)


67
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 67

define_field :write_time, SMB::Filetime

Class Method Details

.protocol_nameString

Give protocol name for this class

Returns:



104
105
106
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 104

def self.protocol_name
  'SMB::NtCreateAndX::Response'
end

Instance Method Details

#directory?Boolean

Say if FID is a directory

Returns:

  • (Boolean)


110
111
112
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 110

def directory?
  self.directory > 0
end

#human_access_timeString

Returns:



122
123
124
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 122

%i[create access write change].each do |type|
  class_eval "def human_#{type}_time; self[:#{type}_time].to_human; end"
end

#human_change_timeString

Returns:



122
123
124
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 122

%i[create access write change].each do |type|
  class_eval "def human_#{type}_time; self[:#{type}_time].to_human; end"
end

#human_create_timeString

Returns:



122
123
124
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 122

%i[create access write change].each do |type|
  class_eval "def human_#{type}_time; self[:#{type}_time].to_human; end"
end

#human_write_timeString

Returns:



122
123
124
# File 'lib/packetgen/plugin/smb/ntcreateandx/response.rb', line 122

%i[create access write change].each do |type|
  class_eval "def human_#{type}_time; self[:#{type}_time].to_human; end"
end