packetgen-plugin-smb 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packetgen-plugin-smb.rb +7 -5
- data/lib/packetgen/plugin/gssapi.rb +125 -0
- data/lib/packetgen/plugin/smb.rb +26 -32
- data/lib/packetgen/plugin/smb/blocks.rb +2 -2
- data/lib/packetgen/plugin/smb/browser.rb +3 -3
- data/lib/packetgen/plugin/smb/browser/domain_announcement.rb +3 -3
- data/lib/packetgen/plugin/smb/browser/host_announcement.rb +4 -4
- data/lib/packetgen/plugin/smb/browser/local_master_announcement.rb +3 -3
- data/lib/packetgen/plugin/smb/close.rb +9 -59
- data/lib/packetgen/plugin/smb/close/request.rb +45 -0
- data/lib/packetgen/plugin/smb/close/response.rb +36 -0
- data/lib/packetgen/plugin/smb/filetime.rb +10 -9
- data/lib/packetgen/plugin/smb/nt_create_and_x.rb +9 -264
- data/lib/packetgen/plugin/smb/ntcreateandx/request.rb +159 -0
- data/lib/packetgen/plugin/smb/ntcreateandx/response.rb +128 -0
- data/lib/packetgen/plugin/smb/string.rb +4 -4
- data/lib/packetgen/plugin/smb/trans.rb +9 -190
- data/lib/packetgen/plugin/smb/trans/request.rb +121 -0
- data/lib/packetgen/plugin/smb/trans/response.rb +94 -0
- data/lib/packetgen/plugin/smb2.rb +181 -0
- data/lib/packetgen/plugin/smb2/base.rb +31 -0
- data/lib/packetgen/plugin/smb2/error.rb +50 -0
- data/lib/packetgen/plugin/smb2/guid.rb +68 -0
- data/lib/packetgen/plugin/smb2/negotiate.rb +22 -0
- data/lib/packetgen/plugin/smb2/negotiate/context.rb +131 -0
- data/lib/packetgen/plugin/smb2/negotiate/request.rb +166 -0
- data/lib/packetgen/plugin/smb2/negotiate/response.rb +190 -0
- data/lib/packetgen/plugin/smb2/session_setup.rb +21 -0
- data/lib/packetgen/plugin/smb2/session_setup/request.rb +98 -0
- data/lib/packetgen/plugin/smb2/session_setup/response.rb +69 -0
- data/lib/packetgen/plugin/smb_version.rb +1 -1
- data/packetgen-plugin-smb.gemspec +2 -1
- metadata +42 -4
@@ -0,0 +1,128 @@
|
|
1
|
+
# This file is part of packetgen-plugin-smb.
|
2
|
+
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
|
+
# Copyright (C) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
|
+
# This program is published under MIT license.
|
5
|
+
|
6
|
+
# frozen_string_literal: true
|
7
|
+
|
8
|
+
module PacketGen::Plugin
|
9
|
+
class SMB
|
10
|
+
# Namespace for NT_CREATE_ANDX related classes
|
11
|
+
module NtCreateAndX
|
12
|
+
# SMB Command NtCreateAndX response
|
13
|
+
# @author Sylvain Daubert
|
14
|
+
class Response < PacketGen::Header::Base
|
15
|
+
# OpLock levels
|
16
|
+
OP_LOCK_LEVELS = {
|
17
|
+
'none' => 0,
|
18
|
+
'exclusive' => 1,
|
19
|
+
'batch' => 2,
|
20
|
+
'level II' => 3,
|
21
|
+
}.freeze
|
22
|
+
|
23
|
+
# @!attribute word_count
|
24
|
+
# The size, in 2-byte words, of the SMB parameters.
|
25
|
+
# @return [Integer]
|
26
|
+
define_field :word_count, PacketGen::Types::Int8, default: 34
|
27
|
+
# @!attribute and_xcommand
|
28
|
+
# 8-bit command code for the next SMB command in the
|
29
|
+
# packet.
|
30
|
+
# @return [Integer]
|
31
|
+
define_field :and_xcommand, PacketGen::Types::Int8Enum, enum: Request::COMMANDS
|
32
|
+
# @!attribute rsv1
|
33
|
+
# 8-bit reserved field.
|
34
|
+
# @return [Integer]
|
35
|
+
define_field :rsv1, PacketGen::Types::Int8, default: 0
|
36
|
+
# @!attribute and_xoffset
|
37
|
+
# 16-bit offset from the start of SMB header to the start of
|
38
|
+
# the {#word_count} field in the next SMB command in this
|
39
|
+
# packet.
|
40
|
+
# @return [Integer]
|
41
|
+
define_field :and_xoffset, PacketGen::Types::Int16le, default: 0
|
42
|
+
# @!attribute oplock_level
|
43
|
+
# 8-bit OpLock level.
|
44
|
+
# @return [Integer]
|
45
|
+
define_field :oplock_level, PacketGen::Types::Int8Enum, enum: OP_LOCK_LEVELS
|
46
|
+
# @!attribute fid
|
47
|
+
# 16-bit FID.
|
48
|
+
# @return [Integer]
|
49
|
+
define_field :fid, PacketGen::Types::Int16le
|
50
|
+
# @!attribute disposition
|
51
|
+
# 32-bit value that represents the action to take if the file
|
52
|
+
# already exists or if the file is a new file and does not already
|
53
|
+
# exist.
|
54
|
+
# @return [Integer]
|
55
|
+
define_field :disposition, PacketGen::Types::Int32le
|
56
|
+
# @!attribute create_time
|
57
|
+
# 64-bit integer representing the time that the file was created.
|
58
|
+
# @return [Integer]
|
59
|
+
define_field :create_time, SMB::Filetime
|
60
|
+
# @!attribute access_time
|
61
|
+
# 64-bit integer representing the time that the file was last accessed.
|
62
|
+
# @return [Integer]
|
63
|
+
define_field :access_time, SMB::Filetime
|
64
|
+
# @!attribute write_time
|
65
|
+
# 64-bit integer representing the time that the file was last writen.
|
66
|
+
# @return [Integer]
|
67
|
+
define_field :write_time, SMB::Filetime
|
68
|
+
# @!attribute change_time
|
69
|
+
# 64-bit integer representing the time that the file was last changed.
|
70
|
+
# @return [Integer]
|
71
|
+
define_field :change_time, SMB::Filetime
|
72
|
+
# @!attribute attributes
|
73
|
+
# 32-bit extended file attributes.
|
74
|
+
# @return [Integer]
|
75
|
+
define_field :attributes, PacketGen::Types::Int32le
|
76
|
+
# @!attribute alloc_size
|
77
|
+
# 64-bit integer representing the number of bytes allocated to the file.
|
78
|
+
# @return [Integer]
|
79
|
+
define_field :alloc_size, PacketGen::Types::Int64le
|
80
|
+
# @!attribute end_of_file
|
81
|
+
# 64-bit integer representing the end of file offset.
|
82
|
+
# @return [Integer]
|
83
|
+
define_field :end_of_file, PacketGen::Types::Int64le
|
84
|
+
# @!attribute res_type
|
85
|
+
# 16-bit file type.
|
86
|
+
# @return [Integer]
|
87
|
+
define_field :res_type, PacketGen::Types::Int16le
|
88
|
+
# @!attribute pipe_status
|
89
|
+
# 16-bit field that shows the status of the named pipe (if opened resource
|
90
|
+
# is a named pipe).
|
91
|
+
# @return [Integer]
|
92
|
+
define_field :pipe_status, PacketGen::Types::Int16le
|
93
|
+
# @!attribute directory
|
94
|
+
# 8-bit field indicating is the FID represents a directory.
|
95
|
+
# @return [Integer]
|
96
|
+
define_field :directory, PacketGen::Types::Int8
|
97
|
+
# @!attribute byte_count
|
98
|
+
# The size, in bytes, of the SMB data. Should be zero.
|
99
|
+
# @return [Integer]
|
100
|
+
define_field :byte_count, PacketGen::Types::Int16le, default: 0
|
101
|
+
|
102
|
+
# Give protocol name for this class
|
103
|
+
# @return [String]
|
104
|
+
def protocol_name
|
105
|
+
'SMB::NtCreateAndX::Response'
|
106
|
+
end
|
107
|
+
|
108
|
+
# Say if FID is a directory
|
109
|
+
# @return [Boolean]
|
110
|
+
def directory?
|
111
|
+
self.directory > 0
|
112
|
+
end
|
113
|
+
|
114
|
+
# @!method human_create_time
|
115
|
+
# @return [String]
|
116
|
+
# @!method human_access_time
|
117
|
+
# @return [String]
|
118
|
+
# @!method human_write_time
|
119
|
+
# @return [String]
|
120
|
+
# @!method human_change_time
|
121
|
+
# @return [String]
|
122
|
+
%i[create access write change].each do |type|
|
123
|
+
class_eval "def human_#{type}_time; self[:#{type}_time].to_human; end"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# This file is part of
|
1
|
+
# This file is part of packetgen-plugin-smb.
|
2
2
|
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
|
-
# Copyright (C)
|
3
|
+
# Copyright (C) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
4
|
# This program is published under MIT license.
|
5
5
|
|
6
6
|
# frozen_string_literal: true
|
@@ -10,10 +10,10 @@ module PacketGen::Plugin
|
|
10
10
|
# SMB strings (UTF-16 little-endian).
|
11
11
|
# @author Sylvain Daubert
|
12
12
|
class String < PacketGen::Types::CString
|
13
|
-
# @param [Boolean]
|
13
|
+
# @param [Boolean] value
|
14
|
+
# @return [Boolean]
|
14
15
|
attr_writer :unicode
|
15
16
|
|
16
|
-
# @param [Boolean, Proc] is string UTF-16 encoded?
|
17
17
|
# @param [Hash] options
|
18
18
|
# @option options [Integer] :static_length set a static length for this string
|
19
19
|
# @option options [Boolean] :unicode If +true+, string is encoded as a UTF-16
|
@@ -1,199 +1,18 @@
|
|
1
|
-
# This file is part of
|
1
|
+
# This file is part of packetgen-plugin-smb.
|
2
2
|
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
|
-
# Copyright (C)
|
3
|
+
# Copyright (C) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
4
|
# This program is published under MIT license.
|
5
5
|
|
6
6
|
# frozen_string_literal: true
|
7
7
|
|
8
8
|
module PacketGen::Plugin
|
9
9
|
class SMB
|
10
|
-
#
|
11
|
-
|
12
|
-
# See also {Blocks}, as {TransRequest} is a specialization of {Blocks#words}
|
13
|
-
# and {Blocks#bytes}.
|
14
|
-
# @author Sylvain Daubert
|
15
|
-
class TransRequest < PacketGen::Header::Base
|
16
|
-
# @!attribute word_count
|
17
|
-
# The size, in 2-byte words, of the SMB command parameters. It should
|
18
|
-
# be +14 + setup_count+.
|
19
|
-
# @return [Integer]
|
20
|
-
define_field :word_count, PacketGen::Types::Int8, default: 14
|
21
|
-
# @!attribute total_param_count
|
22
|
-
# The total number of transaction parameter bytes.
|
23
|
-
# @return [Integer]
|
24
|
-
define_field :total_param_count, PacketGen::Types::Int16le
|
25
|
-
# @!attribute total_data_count
|
26
|
-
# The total number of transaction data bytes.
|
27
|
-
# @return [Integer]
|
28
|
-
define_field :total_data_count, PacketGen::Types::Int16le
|
29
|
-
# @!attribute max_param_count
|
30
|
-
# The maximum number of parameter bytes that the client will accept
|
31
|
-
# in transaction response.
|
32
|
-
# @return [Integer]
|
33
|
-
define_field :max_param_count, PacketGen::Types::Int16le
|
34
|
-
# @!attribute max_data_count
|
35
|
-
# The maximum number of data bytes that the client will accept
|
36
|
-
# in transaction response.
|
37
|
-
# @return [Integer]
|
38
|
-
define_field :max_data_count, PacketGen::Types::Int16le
|
39
|
-
# @!attribute max_setup_count
|
40
|
-
# The maximum number of setup bytes that the client will accept
|
41
|
-
# in transaction response.
|
42
|
-
# @return [Integer]
|
43
|
-
define_field :max_setup_count, PacketGen::Types::Int8
|
44
|
-
# @!attribute rsv1
|
45
|
-
# 8-bit reserved field
|
46
|
-
# @return [Integer]
|
47
|
-
define_field :rsv1, PacketGen::Types::Int8, default: 0
|
48
|
-
# @!attribute flags
|
49
|
-
# 16-bit flags
|
50
|
-
# @return [Integer]
|
51
|
-
define_field :flags, PacketGen::Types::Int16le
|
52
|
-
# @!attribute timeout
|
53
|
-
# 32-bit timeout
|
54
|
-
# @return [Integer]
|
55
|
-
define_field :timeout, PacketGen::Types::Int32le
|
56
|
-
# @!attribute rsv2
|
57
|
-
# 16-bit reserved field
|
58
|
-
# @return [Integer]
|
59
|
-
define_field :rsv2, PacketGen::Types::Int16le, default: 0
|
60
|
-
# @!attribute param_count
|
61
|
-
# 16-bit number of transaction parameter bytes that the clients attempts to
|
62
|
-
# send to the server in this request.
|
63
|
-
# @return [Integer]
|
64
|
-
define_field :param_count, PacketGen::Types::Int16le
|
65
|
-
# @!attribute param_offset
|
66
|
-
# 16-bit offset (in bytes) from the start of the SMB header to the start of the
|
67
|
-
# transaction parameters.
|
68
|
-
# @return [Integer]
|
69
|
-
define_field :param_offset, PacketGen::Types::Int16le
|
70
|
-
# @!attribute data_count
|
71
|
-
# 16-bit number of transaction data bytes that the clients sends to
|
72
|
-
# the server in this request.
|
73
|
-
# @return [Integer]
|
74
|
-
define_field :data_count, PacketGen::Types::Int16le
|
75
|
-
# @!attribute data_offset
|
76
|
-
# 16-bit offset (in bytes) from the start of the SMB header to the start
|
77
|
-
# of the data field.
|
78
|
-
# @return [Integer]
|
79
|
-
define_field :data_offset, PacketGen::Types::Int16le
|
80
|
-
# @!attribute setup_count
|
81
|
-
# 8-bit number of setup words (ie 16-bit words) contained in {#setup} field.
|
82
|
-
define_field :setup_count, PacketGen::Types::Int8
|
83
|
-
# @!attribute rsv3
|
84
|
-
# 8-bit reserved field
|
85
|
-
# @return [Integer]
|
86
|
-
define_field :rsv3, PacketGen::Types::Int8
|
87
|
-
# @!attribute setup
|
88
|
-
# Array of 2-byte words.
|
89
|
-
# @return [Array]
|
90
|
-
define_field :setup, PacketGen::Types::ArrayOfInt16le, builder: ->(h, t) { t.new(counter: h[:setup_count]) }
|
91
|
-
# @!attribute byte_count
|
92
|
-
# @return [Integer]
|
93
|
-
define_field :byte_count, PacketGen::Types::Int16le
|
94
|
-
# @!attribute padname
|
95
|
-
# 8-bit optional padding to align {#name} on a 2-byte boundary. Only present
|
96
|
-
# if {SMB#flags2_unicode?} is +true+.
|
97
|
-
# @return [Integer]
|
98
|
-
define_field :padname, PacketGen::Types::Int8, optional: ->(h) { h.packet && h.packet.smb.flags2_unicode? }
|
99
|
-
# @!attribute name
|
100
|
-
# Pathname of the mailslot or named pipe.
|
101
|
-
# @return [String]
|
102
|
-
define_field :name, SMB::String, builder: ->(h, t) { t.new(unicode: !h.packet || h.packet.smb.flags2_unicode?) }
|
103
|
-
# @!attribute pad1
|
104
|
-
# Padding to align {#body} on 4-byte boundary.
|
105
|
-
# @return [String]
|
106
|
-
define_field :pad1, PacketGen::Types::String, default: "\0" * 4,
|
107
|
-
builder: ->(h, t) { t.new(length_from: -> { h.data_offset - SMB.new.sz - (h.offset_of(:name) + h[:name].sz) }) }
|
108
|
-
define_field :body, PacketGen::Types::String
|
109
|
-
|
110
|
-
# Give protocol name for this class
|
111
|
-
# @return [String]
|
112
|
-
def protocol_name
|
113
|
-
'SMB::TransRequest'
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
# Transaction Response.
|
118
|
-
#
|
119
|
-
# See also {Blocks}, as {TransResponse} is a specialization of {Blocks#words}
|
120
|
-
# and {Blocks#bytes}.
|
121
|
-
# @author Sylvain Daubert
|
122
|
-
class TransResponse < PacketGen::Header::Base
|
123
|
-
# @!attribute word_count
|
124
|
-
# The size, in 2-byte words, of the SMB command parameters. It should
|
125
|
-
# be +14 + setup_count+.
|
126
|
-
# @return [Integer]
|
127
|
-
define_field :word_count, PacketGen::Types::Int8, default: 10
|
128
|
-
# @!attribute total_param_count
|
129
|
-
# The total number of transaction parameter bytes.
|
130
|
-
# @return [Integer]
|
131
|
-
define_field :total_param_count, PacketGen::Types::Int16le
|
132
|
-
# @!attribute total_data_count
|
133
|
-
# The total number of transaction data bytes.
|
134
|
-
# @return [Integer]
|
135
|
-
define_field :total_data_count, PacketGen::Types::Int16le
|
136
|
-
# @!attribute rsv1
|
137
|
-
# 16-bit reserved field
|
138
|
-
# @return [Integer]
|
139
|
-
define_field :rsv1, PacketGen::Types::Int16le, default: 0
|
140
|
-
# @!attribute param_count
|
141
|
-
# 16-bit number of transaction parameter bytes sent in this response.
|
142
|
-
# @return [Integer]
|
143
|
-
define_field :param_count, PacketGen::Types::Int16le
|
144
|
-
# @!attribute param_offset
|
145
|
-
# 16-bit offset (in bytes) from the start of the SMB header to the start of the
|
146
|
-
# transaction parameters.
|
147
|
-
# @return [Integer]
|
148
|
-
define_field :param_offset, PacketGen::Types::Int16le
|
149
|
-
# @!attribute param_displacement
|
150
|
-
# 16-bit offset (in bytes) relative to all of the transaction
|
151
|
-
# parameter bytes in this transaction response at which this block of
|
152
|
-
# parameter bytes SHOULD be placed.
|
153
|
-
# @return [Integer]
|
154
|
-
define_field :param_displacement, PacketGen::Types::Int16le
|
155
|
-
# @!attribute data_count
|
156
|
-
# 16-bit number of transaction data bytes sent in this response.
|
157
|
-
# @return [Integer]
|
158
|
-
define_field :data_count, PacketGen::Types::Int16le
|
159
|
-
# @!attribute data_offset
|
160
|
-
# 16-bit offset (in bytes) from the start of the SMB header to the start
|
161
|
-
# of the data field.
|
162
|
-
# @return [Integer]
|
163
|
-
define_field :data_offset, PacketGen::Types::Int16le
|
164
|
-
# @!attribute data_displacement
|
165
|
-
# 16-bit offset (in bytes) relative to all of the transaction data bytes in
|
166
|
-
# this transaction response at which this block of data bytes SHOULD be placed.
|
167
|
-
# @return [Integer]
|
168
|
-
define_field :data_displacement, PacketGen::Types::Int16le
|
169
|
-
# @!attribute setup_count
|
170
|
-
# 8-bit number of setup words (ie 16-bit words) contained in {#setup} field.
|
171
|
-
define_field :setup_count, PacketGen::Types::Int8
|
172
|
-
# @!attribute rsv3
|
173
|
-
# 8-bit reserved field
|
174
|
-
# @return [Integer]
|
175
|
-
define_field :rsv2, PacketGen::Types::Int8
|
176
|
-
# @!attribute setup
|
177
|
-
# Array of 2-byte words.
|
178
|
-
# @return [ArrayPacketGen::]
|
179
|
-
define_field :setup, PacketGen::Types::ArrayOfInt16le, builder: ->(h, t) { t.new(counter: h[:setup_count]) }
|
180
|
-
# @!attribute byte_count
|
181
|
-
# @return [Integer]
|
182
|
-
define_field :byte_count, PacketGen::Types::Int16le
|
183
|
-
# @!attribute pad1
|
184
|
-
# Padding before {#body} to align it on 32-bit boundary
|
185
|
-
# @return [Integer]
|
186
|
-
define_field :pad1, PacketGen::Types::String, default: "\0" * 4,
|
187
|
-
builder: ->(h, t) { t.new(length_from: -> { h.data_offset - SMB.new.sz - (h.offset_of(:byte_count) + h[:byte_count].sz) }) }
|
188
|
-
define_field :body, PacketGen::Types::String
|
189
|
-
|
190
|
-
# Give protocol name for this class
|
191
|
-
# @return [String]
|
192
|
-
def protocol_name
|
193
|
-
'SMB::TransResponse'
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
self.bind_command 'trans'
|
10
|
+
# Namespace for TRANS related classes
|
11
|
+
module Trans; end
|
198
12
|
end
|
199
13
|
end
|
14
|
+
|
15
|
+
require_relative 'trans/request'
|
16
|
+
require_relative 'trans/response'
|
17
|
+
|
18
|
+
PacketGen::Plugin::SMB.bind_command 'trans'
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# This file is part of packetgen-plugin-smb.
|
2
|
+
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
|
3
|
+
# Copyright (C) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
|
+
# This program is published under MIT license.
|
5
|
+
|
6
|
+
# frozen_string_literal: true
|
7
|
+
|
8
|
+
module PacketGen::Plugin
|
9
|
+
class SMB
|
10
|
+
module Trans
|
11
|
+
# Transaction Request.
|
12
|
+
#
|
13
|
+
# See also {Blocks}, as {Trans::Request} is a specialization of {Blocks#words}
|
14
|
+
# and {Blocks#bytes}.
|
15
|
+
# @author Sylvain Daubert
|
16
|
+
class Request < PacketGen::Header::Base
|
17
|
+
# @!attribute word_count
|
18
|
+
# The size, in 2-byte words, of the SMB command parameters. It should
|
19
|
+
# be +14 + setup_count+.
|
20
|
+
# @return [Integer]
|
21
|
+
define_field :word_count, PacketGen::Types::Int8, default: 14
|
22
|
+
# @!attribute total_param_count
|
23
|
+
# The total number of transaction parameter bytes.
|
24
|
+
# @return [Integer]
|
25
|
+
define_field :total_param_count, PacketGen::Types::Int16le
|
26
|
+
# @!attribute total_data_count
|
27
|
+
# The total number of transaction data bytes.
|
28
|
+
# @return [Integer]
|
29
|
+
define_field :total_data_count, PacketGen::Types::Int16le
|
30
|
+
# @!attribute max_param_count
|
31
|
+
# The maximum number of parameter bytes that the client will accept
|
32
|
+
# in transaction response.
|
33
|
+
# @return [Integer]
|
34
|
+
define_field :max_param_count, PacketGen::Types::Int16le
|
35
|
+
# @!attribute max_data_count
|
36
|
+
# The maximum number of data bytes that the client will accept
|
37
|
+
# in transaction response.
|
38
|
+
# @return [Integer]
|
39
|
+
define_field :max_data_count, PacketGen::Types::Int16le
|
40
|
+
# @!attribute max_setup_count
|
41
|
+
# The maximum number of setup bytes that the client will accept
|
42
|
+
# in transaction response.
|
43
|
+
# @return [Integer]
|
44
|
+
define_field :max_setup_count, PacketGen::Types::Int8
|
45
|
+
# @!attribute rsv1
|
46
|
+
# 8-bit reserved field
|
47
|
+
# @return [Integer]
|
48
|
+
define_field :rsv1, PacketGen::Types::Int8, default: 0
|
49
|
+
# @!attribute flags
|
50
|
+
# 16-bit flags
|
51
|
+
# @return [Integer]
|
52
|
+
define_field :flags, PacketGen::Types::Int16le
|
53
|
+
# @!attribute timeout
|
54
|
+
# 32-bit timeout
|
55
|
+
# @return [Integer]
|
56
|
+
define_field :timeout, PacketGen::Types::Int32le
|
57
|
+
# @!attribute rsv2
|
58
|
+
# 16-bit reserved field
|
59
|
+
# @return [Integer]
|
60
|
+
define_field :rsv2, PacketGen::Types::Int16le, default: 0
|
61
|
+
# @!attribute param_count
|
62
|
+
# 16-bit number of transaction parameter bytes that the clients attempts to
|
63
|
+
# send to the server in this request.
|
64
|
+
# @return [Integer]
|
65
|
+
define_field :param_count, PacketGen::Types::Int16le
|
66
|
+
# @!attribute param_offset
|
67
|
+
# 16-bit offset (in bytes) from the start of the SMB header to the start of the
|
68
|
+
# transaction parameters.
|
69
|
+
# @return [Integer]
|
70
|
+
define_field :param_offset, PacketGen::Types::Int16le
|
71
|
+
# @!attribute data_count
|
72
|
+
# 16-bit number of transaction data bytes that the clients sends to
|
73
|
+
# the server in this request.
|
74
|
+
# @return [Integer]
|
75
|
+
define_field :data_count, PacketGen::Types::Int16le
|
76
|
+
# @!attribute data_offset
|
77
|
+
# 16-bit offset (in bytes) from the start of the SMB header to the start
|
78
|
+
# of the data field.
|
79
|
+
# @return [Integer]
|
80
|
+
define_field :data_offset, PacketGen::Types::Int16le
|
81
|
+
# @!attribute setup_count
|
82
|
+
# 8-bit number of setup words (ie 16-bit words) contained in {#setup} field.
|
83
|
+
define_field :setup_count, PacketGen::Types::Int8
|
84
|
+
# @!attribute rsv3
|
85
|
+
# 8-bit reserved field
|
86
|
+
# @return [Integer]
|
87
|
+
define_field :rsv3, PacketGen::Types::Int8
|
88
|
+
# @!attribute setup
|
89
|
+
# Array of 2-byte words.
|
90
|
+
# @return [Array]
|
91
|
+
define_field :setup, PacketGen::Types::ArrayOfInt16le, builder: ->(h, t) { t.new(counter: h[:setup_count]) }
|
92
|
+
# @!attribute byte_count
|
93
|
+
# @return [Integer]
|
94
|
+
define_field :byte_count, PacketGen::Types::Int16le
|
95
|
+
# @!attribute padname
|
96
|
+
# 8-bit optional padding to align {#name} on a 2-byte boundary. Only present
|
97
|
+
# if {SMB#flags2_unicode?} is +true+.
|
98
|
+
# @return [Integer]
|
99
|
+
define_field :padname, PacketGen::Types::Int8, optional: ->(h) { h.packet && h.packet.smb.flags2_unicode? }
|
100
|
+
# @!attribute name
|
101
|
+
# Pathname of the mailslot or named pipe.
|
102
|
+
# @return [String]
|
103
|
+
define_field :name, SMB::String, builder: ->(h, t) { t.new(unicode: !h.packet || h.packet.smb.flags2_unicode?) }
|
104
|
+
# @!attribute pad1
|
105
|
+
# Padding to align {#body} on 4-byte boundary.
|
106
|
+
# @return [String]
|
107
|
+
define_field :pad1, PacketGen::Types::String, default: "\0" * 4,
|
108
|
+
builder: ->(h, t) { t.new(length_from: -> { h.data_offset - SMB.new.sz - (h.offset_of(:name) + h[:name].sz) }) }
|
109
|
+
# @!attribute body
|
110
|
+
# @return [String]
|
111
|
+
define_field :body, PacketGen::Types::String
|
112
|
+
|
113
|
+
# Give protocol name for this class
|
114
|
+
# @return [String]
|
115
|
+
def protocol_name
|
116
|
+
'SMB::Trans::Request'
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|