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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc233d3dcb94925757db9c4f5dde9647f97cce4d1e73001f3bbbcb41309ed435
|
4
|
+
data.tar.gz: 50d2ebf353a37d073bae3f6f7458057e4db8a7f2b5c0932094e1820056ab2746
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5862b573e7b9bba3826f10ef8e1ac8bbb34817e49f93338223ca5fbfcd0ad19cbeb65b64428fc1832c7603fe8a5a5cfc32cb6ac31d63c2e66de4a518ab89de6d
|
7
|
+
data.tar.gz: bb9a3e27eb4c36e3b6197d6450bef4efd73af1e3a0849c07383ea32924d155e0e21f975f7c91b4092ba70cce3d03cb368f92d38311a1a6585c946b5c1462dae5
|
data/lib/packetgen-plugin-smb.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
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
|
-
require
|
9
|
-
require_relative
|
10
|
-
require_relative
|
8
|
+
require 'packetgen'
|
9
|
+
require_relative 'packetgen/plugin/smb_version'
|
10
|
+
require_relative 'packetgen/plugin/gssapi'
|
11
|
+
require_relative 'packetgen/plugin/smb'
|
12
|
+
require_relative 'packetgen/plugin/smb2'
|
@@ -0,0 +1,125 @@
|
|
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
|
+
require 'rasn1'
|
9
|
+
|
10
|
+
module PacketGen::Plugin
|
11
|
+
# GSS API, from RFC 4178
|
12
|
+
#
|
13
|
+
# GSSAPI ::= CHOICE {
|
14
|
+
# init InitialContextToken,
|
15
|
+
# token_resp NegTokenResp
|
16
|
+
# }
|
17
|
+
#
|
18
|
+
# InitialContextToken ::= [APPLICATION 0] IMPLICIT SEQUENCE {
|
19
|
+
# oid OBJECT IDENTIFIER,
|
20
|
+
# token_init NegTokenInit
|
21
|
+
# }
|
22
|
+
#
|
23
|
+
# NegTokenInit ::= [0] EXPLICIT SEQUENCE {
|
24
|
+
# mechTypes [0] MechTypeList,
|
25
|
+
# reqFlags [1] BIT STRING OPTIONAL, -- No more used
|
26
|
+
# mechToken [2] OCTET STRING OPTIONAL,
|
27
|
+
# mechListMIC [3] OCTET STRING OPTIONAL,
|
28
|
+
# }
|
29
|
+
#
|
30
|
+
# NegTokenResp ::= [1] EXPLICIT SEQUENCE {
|
31
|
+
# negState [0] ENUMERATED {
|
32
|
+
# accept-completed (0),
|
33
|
+
# accept-incomplete (1),
|
34
|
+
# reject (2),
|
35
|
+
# request-mic (3)
|
36
|
+
# } OPTIONAL,
|
37
|
+
# supportedMech [1] MechType OPTIONAL,
|
38
|
+
# responseToken [2] OCTET STRING OPTIONAL,
|
39
|
+
# mechListMIC [3] OCTET STRING OPTIONAL,
|
40
|
+
# }
|
41
|
+
#
|
42
|
+
# @example initial context
|
43
|
+
# gssapi.chosen #=> 0
|
44
|
+
# # Access to oid of initial context
|
45
|
+
# gssapi[:oid] #=> RASN1::Types::ObjectId
|
46
|
+
# gssapi[:oid].value #=> "1.3.6.1.5.5.2"
|
47
|
+
# # Access to token_init
|
48
|
+
# gssapi[:token_init] #=> PacketGen::Plugin::GSSAPI::NegTokenInit
|
49
|
+
# gssapi[:token_init][:mech_types] #=> RASN1::Types::SequenceOf
|
50
|
+
# # Get mech_types as an array of OID strings
|
51
|
+
# gssapi[:token_init][:mech_types].value.map(&:value)
|
52
|
+
# # Get mech_token value
|
53
|
+
# gssapi[:token_init][:mech_token].value
|
54
|
+
#
|
55
|
+
# @example response token
|
56
|
+
# gssapi.chosen #=> 1
|
57
|
+
# gssapi[:token_resp][:negstate] #=> RASN1::Types::Enumerated
|
58
|
+
# gssapi[:token_resp][:negstate].value #=> String
|
59
|
+
# gssapi[:token_resp][:supported_mech] #=> RASN1::Types::ObjectId
|
60
|
+
# gssapi[:token_resp][:supported_mech].value #=> String
|
61
|
+
# gssapi[:token_resp][:response] #=> RASN1::Types::OctetString
|
62
|
+
# @author Sylvain Daubert
|
63
|
+
class GSSAPI < RASN1::Model
|
64
|
+
# GSS API Negotiation Token Init
|
65
|
+
#
|
66
|
+
# A GSSAPI Negotiation Token Init is a ASN.1 SEQUENCE, explicitly tagged 0,
|
67
|
+
# containing from 1 up to 4 elements:
|
68
|
+
# * +mech_types+ is a mandatory SEQUENCE OF OBJECT ID. This SEQUENCE OF
|
69
|
+
# is explicitly tagged 0.
|
70
|
+
# * +req_flags+ is an optional BIT STRING, explicitly tagged 1.
|
71
|
+
# * +mech_token+ is an optional OCTET STRING, explicitly tagged 2.
|
72
|
+
# * +mech_list_mic+ is an optional OCTET STRING, explicitly tagged 3.
|
73
|
+
class NegTokenInit < RASN1::Model
|
74
|
+
sequence :token, explicit: 0, class: :context, constructed: true,
|
75
|
+
content: [sequence_of(:mech_types, RASN1::Types::ObjectId, explicit: 0, class: :context),
|
76
|
+
bit_string(:req_flags, explicit: 1, class: :context, constructed: true, optional: true),
|
77
|
+
octet_string(:mech_token, explicit: 2, class: :context, constructed: true, optional: true),
|
78
|
+
octet_string(:mech_list_mic, explicit: 3, class: :context, constructed: true, optional: true)]
|
79
|
+
end
|
80
|
+
|
81
|
+
# GSS API Negotiation Token Response
|
82
|
+
class NegTokenResp < RASN1::Model
|
83
|
+
# Negotiation states
|
84
|
+
NEG_STATES = {
|
85
|
+
'accept-completed' => 0,
|
86
|
+
'accept-incomplete' => 1,
|
87
|
+
'reject' => 2,
|
88
|
+
'request-mic' => 3
|
89
|
+
}
|
90
|
+
sequence :token, explicit: 1, class: :context, constructed: true,
|
91
|
+
content: [enumerated(:negstate, enum: NEG_STATES, explicit: 0, class: :context, constructed: true, optional: true),
|
92
|
+
objectid(:supported_mech, explicit: 1, class: :context, constructed: true, optional: true),
|
93
|
+
octet_string(:response, explicit: 2, class: :context, constructed: true, optional: true),
|
94
|
+
octet_string(:mech_list_mic, explicit: 3, class: :context, constructed: true, optional: true)]
|
95
|
+
end
|
96
|
+
|
97
|
+
choice :gssapi,
|
98
|
+
content: [sequence(:init, implicit: 0, class: :application,
|
99
|
+
content: [objectid(:oid, value: '1.3.6.1.5.5.2'),
|
100
|
+
model(:token_init, NegTokenInit)]),
|
101
|
+
model(:token_resp, NegTokenResp)]
|
102
|
+
|
103
|
+
# @param [Hash] args
|
104
|
+
# @param [Symbol] :type +:init+ or +:response+ to force selection of
|
105
|
+
# token CHOICE.
|
106
|
+
def initialize(args={})
|
107
|
+
token = args.delete(:token)
|
108
|
+
super
|
109
|
+
self[:gssapi].chosen = (token == :init) ? 0 : 1
|
110
|
+
end
|
111
|
+
# Populate Object from +str+
|
112
|
+
# @param [String] str
|
113
|
+
# @return [self]
|
114
|
+
def read(str)
|
115
|
+
parse!(str, ber: true)
|
116
|
+
self
|
117
|
+
end
|
118
|
+
|
119
|
+
# Get size of GSSAPI DER string, in bytes
|
120
|
+
# @return [Integer]
|
121
|
+
def sz
|
122
|
+
to_der.size
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
data/lib/packetgen/plugin/smb.rb
CHANGED
@@ -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
|
@@ -86,24 +86,24 @@ module PacketGen::Plugin
|
|
86
86
|
# @!attribute body
|
87
87
|
# @return [String]
|
88
88
|
define_field :body, PacketGen::Types::String
|
89
|
-
# @!attribute flags_reply
|
89
|
+
# @!attribute flags_reply?
|
90
90
|
# When set, the message is a reply from server to client.
|
91
91
|
# @return [Boolean]
|
92
|
-
# @!attribute flags_opbatch
|
92
|
+
# @!attribute flags_opbatch?
|
93
93
|
# Obsolescent.
|
94
94
|
# @return [Boolean]
|
95
|
-
# @!attribute flags_oplock
|
95
|
+
# @!attribute flags_oplock?
|
96
96
|
# Obsolescent.
|
97
97
|
# @return [Boolean]
|
98
|
-
# @!attribute flags_canon_paths
|
98
|
+
# @!attribute flags_canon_paths?
|
99
99
|
# Obsolescent.
|
100
100
|
# @return [Boolean]
|
101
|
-
# @!attribute flags_case_insensitive
|
101
|
+
# @!attribute flags_case_insensitive?
|
102
102
|
# Obsolete.
|
103
103
|
# @return [Boolean]
|
104
|
-
# @!attribute flags_reserved
|
104
|
+
# @!attribute flags_reserved?
|
105
105
|
# @return [Boolean]
|
106
|
-
# @!attribute flags_rbuf_avail
|
106
|
+
# @!attribute flags_rbuf_avail?
|
107
107
|
# Obsolete.
|
108
108
|
# @return [Boolean]
|
109
109
|
# @!attribute flags_locknread
|
@@ -113,42 +113,42 @@ module PacketGen::Plugin
|
|
113
113
|
define_bit_fields_on :flags, :flags_reply, :flags_opbatch, :flags_oplock,
|
114
114
|
:flags_canon_paths, :flags_case_insensitive,
|
115
115
|
:flags_reserved, :flags_buf_avail, :flags_locknread
|
116
|
-
# @!attribute flags2_unicode
|
116
|
+
# @!attribute flags2_unicode?
|
117
117
|
# If set, each field that contains a string in this message is encoded
|
118
118
|
# as UTF-16.
|
119
119
|
# @return [Boolean]
|
120
|
-
# @!attribute flags2_ntstatus
|
120
|
+
# @!attribute flags2_ntstatus?
|
121
121
|
# If set in a client request, server must return errors as NTSTATUS, else
|
122
122
|
# as SMBSTATUS.
|
123
123
|
# @return [Boolean]
|
124
|
-
# @!attribute flags2_paging_io
|
124
|
+
# @!attribute flags2_paging_io?
|
125
125
|
# Client may read a file if it does not have read permission but have
|
126
126
|
# execute one.
|
127
127
|
# @return [Boolean]
|
128
|
-
# @!attribute flags2_dfs
|
128
|
+
# @!attribute flags2_dfs?
|
129
129
|
# If set, any pathnames should be resolved in the Distributed File System
|
130
130
|
# (DFS).
|
131
131
|
# @return [Boolean]
|
132
|
-
# @!attribute flags2_extended_security
|
132
|
+
# @!attribute flags2_extended_security?
|
133
133
|
# @return [Boolean]
|
134
|
-
# @!attribute flags2_reparse_path
|
134
|
+
# @!attribute flags2_reparse_path?
|
135
135
|
# @return [Boolean]
|
136
136
|
# @!attribute flags2_reserved
|
137
137
|
# 3-bit reserved field
|
138
138
|
# @return [Integer]
|
139
|
-
# @!attribute flags2_is_long_name
|
139
|
+
# @!attribute flags2_is_long_name?
|
140
140
|
# @return [Boolean]
|
141
|
-
# @!attribute flags2_rsv
|
141
|
+
# @!attribute flags2_rsv?
|
142
142
|
# @return [Boolean]
|
143
|
-
# @!attribute flags2_security_signature_required
|
143
|
+
# @!attribute flags2_security_signature_required?
|
144
144
|
# @return [Boolean]
|
145
|
-
# @!attribute flags2_compressed
|
145
|
+
# @!attribute flags2_compressed?
|
146
146
|
# @return [Boolean]
|
147
|
-
# @!attribute flags2_signature
|
147
|
+
# @!attribute flags2_signature?
|
148
148
|
# @return [Boolean]
|
149
|
-
# @!attribute flags2_eas
|
149
|
+
# @!attribute flags2_eas?
|
150
150
|
# @return [Boolean]
|
151
|
-
# @!attribute flags2_long_names
|
151
|
+
# @!attribute flags2_long_names?
|
152
152
|
# If unset, file names must adhere to the 8.3 naming convention.
|
153
153
|
# @return [Boolean]
|
154
154
|
define_bit_fields_on :flags2, :flags2_unicode, :flags2_ntstatus,
|
@@ -163,8 +163,8 @@ module PacketGen::Plugin
|
|
163
163
|
# @return [void]
|
164
164
|
def self.bind_command(command)
|
165
165
|
contantized = command.capitalize.gsub(/_(\w)/) { $1.upcase }
|
166
|
-
krequest = self.const_get("#{contantized}Request")
|
167
|
-
kresponse = self.const_get("#{contantized}Response")
|
166
|
+
krequest = self.const_get("#{contantized}::Request")
|
167
|
+
kresponse = self.const_get("#{contantized}::Response")
|
168
168
|
PacketGen::Header.add_class krequest
|
169
169
|
self.bind krequest, command: SMB::COMMANDS[command], flags: ->(v) { v.nil? ? 0 : (v & 0x80).zero? }
|
170
170
|
PacketGen::Header.add_class kresponse
|
@@ -172,10 +172,7 @@ module PacketGen::Plugin
|
|
172
172
|
end
|
173
173
|
|
174
174
|
def inspect
|
175
|
-
|
176
|
-
fields.each do |attr|
|
177
|
-
next if attr == :body
|
178
|
-
|
175
|
+
super do |attr|
|
179
176
|
case attr
|
180
177
|
when :flags, :flags2
|
181
178
|
value = bits_on(attr).reject { |_, v| v > 1 }
|
@@ -185,14 +182,11 @@ module PacketGen::Plugin
|
|
185
182
|
.join(',')
|
186
183
|
.gsub!(/#{attr}_/, '')
|
187
184
|
value = '%-16s (0x%02x)' % [value, self[attr].to_i]
|
188
|
-
str
|
185
|
+
str = PacketGen::Inspect.shift_level
|
189
186
|
str << PacketGen::Inspect::FMT_ATTR % [self[attr].class.to_s.sub(/.*::/, ''),
|
190
187
|
attr, value]
|
191
|
-
else
|
192
|
-
str << PacketGen::Inspect.inspect_attribute(attr, self[attr], 1)
|
193
188
|
end
|
194
189
|
end
|
195
|
-
str
|
196
190
|
end
|
197
191
|
end
|
198
192
|
PacketGen::Header.add_class SMB
|
@@ -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
|
@@ -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
|
@@ -81,7 +81,7 @@ module PacketGen::Plugin
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
PacketGen::Header.add_class Browser
|
84
|
-
|
84
|
+
Trans::Request.bind Browser, name: '\\MAILSLOT\\BROWSE'
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
@@ -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
|
@@ -27,7 +27,7 @@ module PacketGen::Plugin
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
PacketGen::Header.add_class DomainAnnouncement
|
30
|
-
SMB::
|
30
|
+
SMB::Trans::Request.bind DomainAnnouncement, name: '\\MAILSLOT\\BROWSE', body: ->(v) { v[0] == OPCODES['DomainAnnouncement'] }
|
31
31
|
end
|
32
32
|
end
|
33
33
|
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
|
@@ -14,7 +14,7 @@ module PacketGen::Plugin
|
|
14
14
|
# specify the types of resources and services it supports.
|
15
15
|
# @author Sylvain Daubert
|
16
16
|
class HostAnnouncement < Browser
|
17
|
-
|
17
|
+
remove_field :body
|
18
18
|
update_field :opcode, default: 1
|
19
19
|
# @!attribute update_count
|
20
20
|
# 8-bit integer. Not used. Should be 0
|
@@ -65,7 +65,7 @@ module PacketGen::Plugin
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
PacketGen::Header.add_class HostAnnouncement
|
68
|
-
SMB::
|
68
|
+
SMB::Trans::Request.bind HostAnnouncement, name: '\\MAILSLOT\\BROWSE', body: ->(v) { v[0] == OPCODES['HostAnnouncement'] }
|
69
69
|
end
|
70
70
|
end
|
71
71
|
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
|
@@ -22,7 +22,7 @@ module PacketGen::Plugin
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
PacketGen::Header.add_class LocalMasterAnnouncement
|
25
|
-
SMB::
|
25
|
+
SMB::Trans::Request.bind LocalMasterAnnouncement, name: '\\MAILSLOT\\BROWSE', body: ->(v) { v[0] == OPCODES['LocalMasterAnnouncement'] }
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -1,68 +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
|
-
class CloseRequest < PacketGen::Header::Base
|
13
|
-
# @!attribute word_count
|
14
|
-
# The size, in 2-byte words, of the SMB command parameters. It should
|
15
|
-
# be +3+.
|
16
|
-
# @return [Integer]
|
17
|
-
define_field :word_count, PacketGen::Types::Int8, default: 3
|
18
|
-
# @!attribute fid
|
19
|
-
# 16-bit FID of the object to close
|
20
|
-
# @return [Integer]
|
21
|
-
define_field :fid, PacketGen::Types::Int16le, default: 3
|
22
|
-
# @!attribute last_modified
|
23
|
-
# 32-bit time value encoded as the number of seconds since January
|
24
|
-
# 1, 1970 00:00:00.0. The client can request that the last modification
|
25
|
-
# time for the file be updated to this time value. A value of +0x00000000+
|
26
|
-
# or +0xFFFFFFFF+ results in the server not updating the last modification
|
27
|
-
# time.
|
28
|
-
# @return [Integer]
|
29
|
-
define_field :last_modified, PacketGen::Types::Int32le
|
30
|
-
# @!attribute byte_count
|
31
|
-
# Should be 0.
|
32
|
-
# @return [Integer]
|
33
|
-
define_field :byte_count, PacketGen::Types::Int16le, default: 0
|
34
|
-
|
35
|
-
# Give protocol name for this class
|
36
|
-
# @return [String]
|
37
|
-
def protocol_name
|
38
|
-
'SMB::CloseRequest'
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# Close Response.
|
43
|
-
#
|
44
|
-
# This is a void container. {#word_count} and {#byte_count} should be 0.
|
45
|
-
# @author Sylvain Daubert
|
46
|
-
# @since 0.1.0
|
47
|
-
class CloseResponse < PacketGen::Header::Base
|
48
|
-
# @!attribute word_count
|
49
|
-
# The size, in 2-byte words, of the SMB command parameters. It should
|
50
|
-
# be +0+.
|
51
|
-
# @return [Integer]
|
52
|
-
define_field :word_count, PacketGen::Types::Int8, default: 3
|
53
|
-
define_field :last_modified, PacketGen::Types::Int32le
|
54
|
-
# @!attribute byte_count
|
55
|
-
# Should be 0.
|
56
|
-
# @return [Integer]
|
57
|
-
define_field :byte_count, PacketGen::Types::Int16le, default: 0
|
58
|
-
|
59
|
-
# Give protocol name for this class
|
60
|
-
# @return [String]
|
61
|
-
def protocol_name
|
62
|
-
'SMB::CloseResponse'
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
self.bind_command 'close'
|
10
|
+
# Namespace for CLOSE related classes
|
11
|
+
module Close; end
|
67
12
|
end
|
68
13
|
end
|
14
|
+
|
15
|
+
require_relative 'close/request'
|
16
|
+
require_relative 'close/response'
|
17
|
+
|
18
|
+
PacketGen::Plugin::SMB.bind_command 'close'
|