ruby_smb 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/examples/anonymous_auth.rb +3 -3
- data/examples/append_file.rb +10 -8
- data/examples/authenticate.rb +9 -5
- data/examples/delete_file.rb +8 -6
- data/examples/enum_registry_key.rb +5 -4
- data/examples/enum_registry_values.rb +5 -4
- data/examples/list_directory.rb +8 -6
- data/examples/negotiate_with_netbios_service.rb +9 -5
- data/examples/net_share_enum_all.rb +6 -4
- data/examples/pipes.rb +11 -12
- data/examples/query_service_status.rb +64 -0
- data/examples/read_file.rb +8 -6
- data/examples/read_registry_key_value.rb +6 -5
- data/examples/rename_file.rb +9 -7
- data/examples/tree_connect.rb +7 -5
- data/examples/write_file.rb +9 -7
- data/lib/ruby_smb/client.rb +72 -43
- data/lib/ruby_smb/client/negotiation.rb +1 -0
- data/lib/ruby_smb/dcerpc.rb +2 -0
- data/lib/ruby_smb/dcerpc/error.rb +3 -0
- data/lib/ruby_smb/dcerpc/ndr.rb +209 -44
- data/lib/ruby_smb/dcerpc/request.rb +13 -0
- data/lib/ruby_smb/dcerpc/rpc_security_attributes.rb +34 -0
- data/lib/ruby_smb/dcerpc/rrp_unicode_string.rb +9 -6
- data/lib/ruby_smb/dcerpc/svcctl.rb +479 -0
- data/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_request.rb +48 -0
- data/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_response.rb +26 -0
- data/lib/ruby_smb/dcerpc/svcctl/close_service_handle_request.rb +25 -0
- data/lib/ruby_smb/dcerpc/svcctl/close_service_handle_response.rb +26 -0
- data/lib/ruby_smb/dcerpc/svcctl/control_service_request.rb +26 -0
- data/lib/ruby_smb/dcerpc/svcctl/control_service_response.rb +26 -0
- data/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_request.rb +35 -0
- data/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_response.rb +23 -0
- data/lib/ruby_smb/dcerpc/svcctl/open_service_w_request.rb +31 -0
- data/lib/ruby_smb/dcerpc/svcctl/open_service_w_response.rb +23 -0
- data/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_request.rb +25 -0
- data/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_response.rb +44 -0
- data/lib/ruby_smb/dcerpc/svcctl/query_service_status_request.rb +23 -0
- data/lib/ruby_smb/dcerpc/svcctl/query_service_status_response.rb +27 -0
- data/lib/ruby_smb/dcerpc/svcctl/service_status.rb +25 -0
- data/lib/ruby_smb/dcerpc/svcctl/start_service_w_request.rb +27 -0
- data/lib/ruby_smb/dcerpc/svcctl/start_service_w_response.rb +25 -0
- data/lib/ruby_smb/dcerpc/winreg.rb +98 -17
- data/lib/ruby_smb/dcerpc/winreg/create_key_request.rb +73 -0
- data/lib/ruby_smb/dcerpc/winreg/create_key_response.rb +36 -0
- data/lib/ruby_smb/dcerpc/winreg/enum_key_request.rb +1 -1
- data/lib/ruby_smb/dcerpc/winreg/enum_value_request.rb +1 -1
- data/lib/ruby_smb/dcerpc/winreg/enum_value_response.rb +1 -1
- data/lib/ruby_smb/dcerpc/winreg/open_root_key_request.rb +4 -4
- data/lib/ruby_smb/dcerpc/winreg/query_info_key_request.rb +1 -1
- data/lib/ruby_smb/dcerpc/winreg/query_value_request.rb +7 -6
- data/lib/ruby_smb/dcerpc/winreg/query_value_response.rb +10 -10
- data/lib/ruby_smb/dcerpc/winreg/save_key_request.rb +37 -0
- data/lib/ruby_smb/dcerpc/winreg/save_key_response.rb +23 -0
- data/lib/ruby_smb/dispatcher/base.rb +1 -1
- data/lib/ruby_smb/dispatcher/socket.rb +1 -1
- data/lib/ruby_smb/field/stringz16.rb +17 -1
- data/lib/ruby_smb/nbss/session_header.rb +4 -4
- data/lib/ruby_smb/smb1/file.rb +2 -10
- data/lib/ruby_smb/smb1/pipe.rb +2 -0
- data/lib/ruby_smb/smb2/file.rb +25 -17
- data/lib/ruby_smb/smb2/pipe.rb +3 -0
- data/lib/ruby_smb/smb2/tree.rb +9 -3
- data/lib/ruby_smb/version.rb +1 -1
- data/spec/lib/ruby_smb/client_spec.rb +161 -60
- data/spec/lib/ruby_smb/dcerpc/ndr_spec.rb +1396 -77
- data/spec/lib/ruby_smb/dcerpc/rpc_security_attributes_spec.rb +161 -0
- data/spec/lib/ruby_smb/dcerpc/rrp_unicode_string_spec.rb +49 -12
- data/spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_request_spec.rb +191 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_response_spec.rb +38 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/close_service_handle_request_spec.rb +30 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/close_service_handle_response_spec.rb +38 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/control_service_request_spec.rb +39 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/control_service_response_spec.rb +38 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_request_spec.rb +78 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_response_spec.rb +38 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/open_service_w_request_spec.rb +59 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/open_service_w_response_spec.rb +38 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_request_spec.rb +38 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_response_spec.rb +152 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/query_service_status_request_spec.rb +30 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/query_service_status_response_spec.rb +38 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/service_status_spec.rb +72 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/start_service_w_request_spec.rb +46 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl/start_service_w_response_spec.rb +30 -0
- data/spec/lib/ruby_smb/dcerpc/svcctl_spec.rb +512 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/create_key_request_spec.rb +110 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/create_key_response_spec.rb +44 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/enum_key_request_spec.rb +0 -4
- data/spec/lib/ruby_smb/dcerpc/winreg/enum_value_request_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/winreg/enum_value_response_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/winreg/open_root_key_request_spec.rb +9 -4
- data/spec/lib/ruby_smb/dcerpc/winreg/query_info_key_request_spec.rb +0 -4
- data/spec/lib/ruby_smb/dcerpc/winreg/query_value_request_spec.rb +17 -17
- data/spec/lib/ruby_smb/dcerpc/winreg/query_value_response_spec.rb +11 -23
- data/spec/lib/ruby_smb/dcerpc/winreg/save_key_request_spec.rb +57 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/save_key_response_spec.rb +22 -0
- data/spec/lib/ruby_smb/dcerpc/winreg_spec.rb +215 -41
- data/spec/lib/ruby_smb/dispatcher/socket_spec.rb +10 -10
- data/spec/lib/ruby_smb/field/stringz16_spec.rb +12 -0
- data/spec/lib/ruby_smb/nbss/session_header_spec.rb +4 -11
- data/spec/lib/ruby_smb/smb1/pipe_spec.rb +7 -0
- data/spec/lib/ruby_smb/smb2/file_spec.rb +60 -6
- data/spec/lib/ruby_smb/smb2/pipe_spec.rb +7 -0
- data/spec/lib/ruby_smb/smb2/tree_spec.rb +35 -1
- metadata +72 -2
- metadata.gz.sig +0 -0
@@ -44,5 +44,17 @@ RSpec.describe RubySMB::Field::Stringz16 do
|
|
44
44
|
io = StringIO.new("A\x00B\x00C\x00D\x00")
|
45
45
|
expect { stringz16.read(io) }.to raise_error(EOFError)
|
46
46
|
end
|
47
|
+
|
48
|
+
it 'trims the string to #max_length and makes sure it ends with a null terminator' do
|
49
|
+
io = StringIO.new("A\x00B\x00C\x00D\x00")
|
50
|
+
str = described_class.new(max_length: 6)
|
51
|
+
expect(str.read(io).to_binary_s).to eq("A\x00B\x00\x00\x00".b)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'raises an exception when #max_length is not a multiple of two' do
|
55
|
+
io = StringIO.new("A\x00B\x00C\x00D\x00")
|
56
|
+
str = described_class.new(max_length: 5)
|
57
|
+
expect { str.read(io) }.to raise_error(ArgumentError)
|
58
|
+
end
|
47
59
|
end
|
48
60
|
end
|
@@ -2,8 +2,7 @@ RSpec.describe RubySMB::Nbss::SessionHeader do
|
|
2
2
|
subject(:session_header) { described_class.new }
|
3
3
|
|
4
4
|
it { is_expected.to respond_to :session_packet_type }
|
5
|
-
it { is_expected.to respond_to :
|
6
|
-
it { is_expected.to respond_to :packet_length }
|
5
|
+
it { is_expected.to respond_to :stream_protocol_length }
|
7
6
|
|
8
7
|
it 'is big endian' do
|
9
8
|
expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :big
|
@@ -15,15 +14,9 @@ RSpec.describe RubySMB::Nbss::SessionHeader do
|
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
18
|
-
describe '#
|
19
|
-
it 'is a
|
20
|
-
expect(session_header.
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#packet_length' do
|
25
|
-
it 'is a 17-bit Unsigned Integer' do
|
26
|
-
expect(session_header.packet_length).to be_a BinData::Bit17
|
17
|
+
describe '#stream_protocol_length' do
|
18
|
+
it 'is a 24-bit Unsigned Integer' do
|
19
|
+
expect(session_header.stream_protocol_length).to be_a BinData::Uint24be
|
27
20
|
end
|
28
21
|
end
|
29
22
|
end
|
@@ -155,6 +155,13 @@ RSpec.describe RubySMB::SMB1::Pipe do
|
|
155
155
|
expect(pipe.respond_to?(:has_registry_key?)).to be true
|
156
156
|
end
|
157
157
|
end
|
158
|
+
|
159
|
+
context 'with \'svcctl\' filename' do
|
160
|
+
it 'extends svcctl class' do
|
161
|
+
pipe = described_class.new(tree: tree, response: nt_create_andx_response, name: 'svcctl')
|
162
|
+
expect(pipe.respond_to?(:query_service_config)).to be true
|
163
|
+
end
|
164
|
+
end
|
158
165
|
end
|
159
166
|
|
160
167
|
describe '#dcerpc_request' do
|
@@ -107,6 +107,10 @@ RSpec.describe RubySMB::SMB2::File do
|
|
107
107
|
it 'sets the offset of the packet' do
|
108
108
|
expect(file.read_packet(offset: 55).offset).to eq 55
|
109
109
|
end
|
110
|
+
|
111
|
+
it 'sets the credit_charge of the packet' do
|
112
|
+
expect(file.read_packet(credit_charge: 3).smb2_header.credit_charge).to eq 3
|
113
|
+
end
|
110
114
|
end
|
111
115
|
|
112
116
|
describe '#read' do
|
@@ -125,7 +129,7 @@ RSpec.describe RubySMB::SMB2::File do
|
|
125
129
|
end
|
126
130
|
|
127
131
|
it 'uses a single packet to read the entire file' do
|
128
|
-
expect(file).to receive(:read_packet).with(read_length: 108, offset: 0).and_return(small_read)
|
132
|
+
expect(file).to receive(:read_packet).with(read_length: 108, offset: 0, credit_charge: 0).and_return(small_read)
|
129
133
|
expect(client).to receive(:send_recv).with(small_read, encrypt: false).and_return 'fake data'
|
130
134
|
expect(RubySMB::SMB2::Packet::ReadResponse).to receive(:read).with('fake data').and_return(small_response)
|
131
135
|
expect(file.read).to eq 'fake data'
|
@@ -161,14 +165,15 @@ RSpec.describe RubySMB::SMB2::File do
|
|
161
165
|
}
|
162
166
|
|
163
167
|
before :example do
|
168
|
+
client.server_supports_multi_credit = 1
|
164
169
|
allow(file).to receive(:read_packet)
|
165
170
|
allow(client).to receive(:send_recv)
|
166
171
|
allow(RubySMB::SMB2::Packet::ReadResponse).to receive(:read).and_return(big_response)
|
167
172
|
end
|
168
173
|
|
169
|
-
it 'uses
|
170
|
-
expect(file).to receive(:read_packet).once.with(read_length: described_class::MAX_PACKET_SIZE, offset: 0).and_return(big_read)
|
171
|
-
expect(file).to receive(:read_packet).once.with(read_length: described_class::MAX_PACKET_SIZE, offset: described_class::MAX_PACKET_SIZE).and_return(big_read)
|
174
|
+
it 'uses multiple packets to read the file in chunks' do
|
175
|
+
expect(file).to receive(:read_packet).once.with(read_length: described_class::MAX_PACKET_SIZE, offset: 0, credit_charge: 1).and_return(big_read)
|
176
|
+
expect(file).to receive(:read_packet).once.with(read_length: described_class::MAX_PACKET_SIZE, offset: described_class::MAX_PACKET_SIZE, credit_charge: 1).and_return(big_read)
|
172
177
|
expect(client).to receive(:send_recv).twice.and_return 'fake data'
|
173
178
|
expect(RubySMB::SMB2::Packet::ReadResponse).to receive(:read).twice.with('fake data').and_return(big_response)
|
174
179
|
file.read(bytes: (described_class::MAX_PACKET_SIZE * 2))
|
@@ -184,7 +189,7 @@ RSpec.describe RubySMB::SMB2::File do
|
|
184
189
|
|
185
190
|
context 'when the second response is not valid' do
|
186
191
|
it 'raise an InvalidPacket exception' do
|
187
|
-
allow(file).to receive(:read_packet).with(read_length: described_class::MAX_PACKET_SIZE, offset: described_class::MAX_PACKET_SIZE) do
|
192
|
+
allow(file).to receive(:read_packet).with(read_length: described_class::MAX_PACKET_SIZE, offset: described_class::MAX_PACKET_SIZE, credit_charge: 1) do
|
188
193
|
big_response.smb2_header.command = RubySMB::SMB2::Commands::LOGOFF
|
189
194
|
end
|
190
195
|
expect { file.read(bytes: (described_class::MAX_PACKET_SIZE * 2)) }.to raise_error(RubySMB::Error::InvalidPacket)
|
@@ -193,12 +198,31 @@ RSpec.describe RubySMB::SMB2::File do
|
|
193
198
|
|
194
199
|
context 'when the second response status code is not STATUS_SUCCESS' do
|
195
200
|
it 'raise an UnexpectedStatusCode exception' do
|
196
|
-
allow(file).to receive(:read_packet).with(read_length: described_class::MAX_PACKET_SIZE, offset: described_class::MAX_PACKET_SIZE) do
|
201
|
+
allow(file).to receive(:read_packet).with(read_length: described_class::MAX_PACKET_SIZE, offset: described_class::MAX_PACKET_SIZE, credit_charge: 1) do
|
197
202
|
big_response.smb2_header.nt_status = WindowsError::NTStatus::STATUS_INVALID_HANDLE.value
|
198
203
|
end
|
199
204
|
expect { file.read(bytes: (described_class::MAX_PACKET_SIZE * 2)) }.to raise_error(RubySMB::Error::UnexpectedStatusCode)
|
200
205
|
end
|
201
206
|
end
|
207
|
+
|
208
|
+
context 'when the server does not support multi credits' do
|
209
|
+
it 'reads 65536 bytes at a time with no credit charge' do
|
210
|
+
client.server_supports_multi_credit = false
|
211
|
+
expect(file).to receive(:read_packet).once.with(read_length: 65536, offset: 0, credit_charge: 0).and_return(big_read)
|
212
|
+
expect(file).to receive(:read_packet).once.with(read_length: 65536, offset: 65536, credit_charge: 0).and_return(big_read)
|
213
|
+
file.read(bytes: (described_class::MAX_PACKET_SIZE * 4))
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
context 'when the server supports multi credits' do
|
218
|
+
it 'reads a number of bytes equal to #server_max_read_size, with the expected credit charge' do
|
219
|
+
credit_charge = (90000 - 1) / 65536 + 1
|
220
|
+
client.server_max_read_size = 90000
|
221
|
+
expect(file).to receive(:read_packet).once.with(read_length: 90000, offset: 0, credit_charge: credit_charge).and_return(big_read)
|
222
|
+
expect(file).to receive(:read_packet).once.with(read_length: (described_class::MAX_PACKET_SIZE * 4 - 90000), offset: 90000, credit_charge: credit_charge).and_return(big_read)
|
223
|
+
file.read(bytes: (described_class::MAX_PACKET_SIZE * 4))
|
224
|
+
end
|
225
|
+
end
|
202
226
|
end
|
203
227
|
end
|
204
228
|
|
@@ -222,6 +246,10 @@ RSpec.describe RubySMB::SMB2::File do
|
|
222
246
|
it 'sets the buffer on the packet' do
|
223
247
|
expect(file.write_packet(data:'hello').buffer).to eq 'hello'
|
224
248
|
end
|
249
|
+
|
250
|
+
it 'sets the credit_charge on the packet header' do
|
251
|
+
expect(file.write_packet(credit_charge: 5).smb2_header.credit_charge).to eq 5
|
252
|
+
end
|
225
253
|
end
|
226
254
|
|
227
255
|
describe '#write' do
|
@@ -242,6 +270,11 @@ RSpec.describe RubySMB::SMB2::File do
|
|
242
270
|
end
|
243
271
|
|
244
272
|
context 'for a large write' do
|
273
|
+
before :example do
|
274
|
+
allow(client).to receive(:send_recv).and_return(write_response.to_binary_s)
|
275
|
+
client.server_supports_multi_credit = 1
|
276
|
+
end
|
277
|
+
|
245
278
|
it 'sends multiple packets' do
|
246
279
|
expect(client).to receive(:send_recv).twice.and_return(write_response.to_binary_s)
|
247
280
|
file.write(data: SecureRandom.random_bytes(described_class::MAX_PACKET_SIZE + 1))
|
@@ -254,6 +287,27 @@ RSpec.describe RubySMB::SMB2::File do
|
|
254
287
|
expect(client).to receive(:send_recv).twice.with(write_request, encrypt: true).and_return(write_response.to_binary_s)
|
255
288
|
file.write(data: SecureRandom.random_bytes(described_class::MAX_PACKET_SIZE + 1))
|
256
289
|
end
|
290
|
+
|
291
|
+
context 'when the server does not support multi credits' do
|
292
|
+
it 'writes 65536 bytes at a time with no credit charge' do
|
293
|
+
client.server_supports_multi_credit = false
|
294
|
+
data = SecureRandom.random_bytes(65536 * 2)
|
295
|
+
expect(file).to receive(:write_packet).once.with(data: data[0, 65536], offset: 0, credit_charge: 0)
|
296
|
+
expect(file).to receive(:write_packet).once.with(data: data[65536, (data.size - 65536)], offset: 65536, credit_charge: 0)
|
297
|
+
file.write(data: data)
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
context 'when the server supports multi credits' do
|
302
|
+
it 'reads a number of bytes equal to #server_max_write_size, with the expected credit charge' do
|
303
|
+
data = SecureRandom.random_bytes(90000 * 2)
|
304
|
+
credit_charge = (90000 - 1) / 65536 + 1
|
305
|
+
client.server_max_write_size = 90000
|
306
|
+
expect(file).to receive(:write_packet).once.with(data: data[0, 90000], offset: 0, credit_charge: credit_charge)
|
307
|
+
expect(file).to receive(:write_packet).once.with(data: data[90000, (data.size - 90000)], offset: 90000, credit_charge: credit_charge)
|
308
|
+
file.write(data: data)
|
309
|
+
end
|
310
|
+
end
|
257
311
|
end
|
258
312
|
|
259
313
|
it 'raises an InvalidPacket exception if the response is not valid' do
|
@@ -161,6 +161,13 @@ RSpec.describe RubySMB::SMB2::Pipe do
|
|
161
161
|
expect(pipe.respond_to?(:has_registry_key?)).to be true
|
162
162
|
end
|
163
163
|
end
|
164
|
+
|
165
|
+
context 'with \'svcctl\' filename' do
|
166
|
+
it 'extends svcctl class' do
|
167
|
+
pipe = described_class.new(tree: tree, response: create_response, name: 'svcctl')
|
168
|
+
expect(pipe.respond_to?(:query_service_config)).to be true
|
169
|
+
end
|
170
|
+
end
|
164
171
|
end
|
165
172
|
|
166
173
|
describe '#dcerpc_request' do
|
@@ -195,7 +195,7 @@ RSpec.describe RubySMB::SMB2::Tree do
|
|
195
195
|
allow(client).to receive(:send_recv) do |packet|
|
196
196
|
expect(packet.file_information_class).to eq RubySMB::Fscc::FileInformation::FileIdFullDirectoryInformation::CLASS_LEVEL
|
197
197
|
expect(packet.name).to eq '*'.encode('UTF-16LE')
|
198
|
-
expect(packet.output_length).to eq
|
198
|
+
expect(packet.output_length).to eq 65_536
|
199
199
|
end
|
200
200
|
tree.list
|
201
201
|
end
|
@@ -288,6 +288,40 @@ RSpec.describe RubySMB::SMB2::Tree do
|
|
288
288
|
end
|
289
289
|
end
|
290
290
|
|
291
|
+
context 'when the dialect is 0x0202' do
|
292
|
+
it 'sets the packet output_length to 65536 and credit_charge header to 0' do
|
293
|
+
client.dialect = '0x0202'
|
294
|
+
allow(client).to receive(:send_recv) do |packet|
|
295
|
+
expect(packet.output_length).to eq(65536)
|
296
|
+
expect(packet.smb2_header.credit_charge).to eq(0)
|
297
|
+
end
|
298
|
+
tree.list
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
context 'when the server does not support multi credits' do
|
303
|
+
it 'sets the packet output_length to 65536 and credit_charge header to 0' do
|
304
|
+
client.server_supports_multi_credit = false
|
305
|
+
allow(client).to receive(:send_recv) do |packet|
|
306
|
+
expect(packet.output_length).to eq(65536)
|
307
|
+
expect(packet.smb2_header.credit_charge).to eq(0)
|
308
|
+
end
|
309
|
+
tree.list
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
context 'when the dialect is not 0x0202 and the server supports multi credits' do
|
314
|
+
it 'sets the packet output_length to server_max_read_size and credit_charge header to the expected value' do
|
315
|
+
client.server_supports_multi_credit = true
|
316
|
+
credit_charge = (90000 - 1) / 65536 + 1
|
317
|
+
client.server_max_read_size = 90000
|
318
|
+
allow(client).to receive(:send_recv) do |packet|
|
319
|
+
expect(packet.output_length).to eq(90000)
|
320
|
+
expect(packet.smb2_header.credit_charge).to eq(credit_charge)
|
321
|
+
end
|
322
|
+
tree.list
|
323
|
+
end
|
324
|
+
end
|
291
325
|
end
|
292
326
|
|
293
327
|
describe '#open_file' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_smb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Metasploit Hackers
|
@@ -97,7 +97,7 @@ cert_chain:
|
|
97
97
|
JI/W23RbIRksG2pioMhd4dCXq3FLLlkOV1YfCwWixNB+iIhQPPZVaPNfgPhCn4Dt
|
98
98
|
DeGjje/qA4fkLtRmOtb9PUBq3ToRDE4=
|
99
99
|
-----END CERTIFICATE-----
|
100
|
-
date: 2020-
|
100
|
+
date: 2020-08-17 00:00:00.000000000 Z
|
101
101
|
dependencies:
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: redcarpet
|
@@ -267,6 +267,7 @@ files:
|
|
267
267
|
- examples/negotiate_with_netbios_service.rb
|
268
268
|
- examples/net_share_enum_all.rb
|
269
269
|
- examples/pipes.rb
|
270
|
+
- examples/query_service_status.rb
|
270
271
|
- examples/read_file.rb
|
271
272
|
- examples/read_file_encryption.rb
|
272
273
|
- examples/read_registry_key_value.rb
|
@@ -294,13 +295,34 @@ files:
|
|
294
295
|
- lib/ruby_smb/dcerpc/ptypes.rb
|
295
296
|
- lib/ruby_smb/dcerpc/request.rb
|
296
297
|
- lib/ruby_smb/dcerpc/response.rb
|
298
|
+
- lib/ruby_smb/dcerpc/rpc_security_attributes.rb
|
297
299
|
- lib/ruby_smb/dcerpc/rrp_unicode_string.rb
|
298
300
|
- lib/ruby_smb/dcerpc/srvsvc.rb
|
299
301
|
- lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all.rb
|
302
|
+
- lib/ruby_smb/dcerpc/svcctl.rb
|
303
|
+
- lib/ruby_smb/dcerpc/svcctl/change_service_config_w_request.rb
|
304
|
+
- lib/ruby_smb/dcerpc/svcctl/change_service_config_w_response.rb
|
305
|
+
- lib/ruby_smb/dcerpc/svcctl/close_service_handle_request.rb
|
306
|
+
- lib/ruby_smb/dcerpc/svcctl/close_service_handle_response.rb
|
307
|
+
- lib/ruby_smb/dcerpc/svcctl/control_service_request.rb
|
308
|
+
- lib/ruby_smb/dcerpc/svcctl/control_service_response.rb
|
309
|
+
- lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_request.rb
|
310
|
+
- lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_response.rb
|
311
|
+
- lib/ruby_smb/dcerpc/svcctl/open_service_w_request.rb
|
312
|
+
- lib/ruby_smb/dcerpc/svcctl/open_service_w_response.rb
|
313
|
+
- lib/ruby_smb/dcerpc/svcctl/query_service_config_w_request.rb
|
314
|
+
- lib/ruby_smb/dcerpc/svcctl/query_service_config_w_response.rb
|
315
|
+
- lib/ruby_smb/dcerpc/svcctl/query_service_status_request.rb
|
316
|
+
- lib/ruby_smb/dcerpc/svcctl/query_service_status_response.rb
|
317
|
+
- lib/ruby_smb/dcerpc/svcctl/service_status.rb
|
318
|
+
- lib/ruby_smb/dcerpc/svcctl/start_service_w_request.rb
|
319
|
+
- lib/ruby_smb/dcerpc/svcctl/start_service_w_response.rb
|
300
320
|
- lib/ruby_smb/dcerpc/uuid.rb
|
301
321
|
- lib/ruby_smb/dcerpc/winreg.rb
|
302
322
|
- lib/ruby_smb/dcerpc/winreg/close_key_request.rb
|
303
323
|
- lib/ruby_smb/dcerpc/winreg/close_key_response.rb
|
324
|
+
- lib/ruby_smb/dcerpc/winreg/create_key_request.rb
|
325
|
+
- lib/ruby_smb/dcerpc/winreg/create_key_response.rb
|
304
326
|
- lib/ruby_smb/dcerpc/winreg/enum_key_request.rb
|
305
327
|
- lib/ruby_smb/dcerpc/winreg/enum_key_response.rb
|
306
328
|
- lib/ruby_smb/dcerpc/winreg/enum_value_request.rb
|
@@ -314,6 +336,8 @@ files:
|
|
314
336
|
- lib/ruby_smb/dcerpc/winreg/query_value_request.rb
|
315
337
|
- lib/ruby_smb/dcerpc/winreg/query_value_response.rb
|
316
338
|
- lib/ruby_smb/dcerpc/winreg/regsam.rb
|
339
|
+
- lib/ruby_smb/dcerpc/winreg/save_key_request.rb
|
340
|
+
- lib/ruby_smb/dcerpc/winreg/save_key_response.rb
|
317
341
|
- lib/ruby_smb/dispatcher.rb
|
318
342
|
- lib/ruby_smb/dispatcher/base.rb
|
319
343
|
- lib/ruby_smb/dispatcher/socket.rb
|
@@ -503,12 +527,33 @@ files:
|
|
503
527
|
- spec/lib/ruby_smb/dcerpc/pdu_header_spec.rb
|
504
528
|
- spec/lib/ruby_smb/dcerpc/request_spec.rb
|
505
529
|
- spec/lib/ruby_smb/dcerpc/response_spec.rb
|
530
|
+
- spec/lib/ruby_smb/dcerpc/rpc_security_attributes_spec.rb
|
506
531
|
- spec/lib/ruby_smb/dcerpc/rrp_unicode_string_spec.rb
|
507
532
|
- spec/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all_spec.rb
|
508
533
|
- spec/lib/ruby_smb/dcerpc/srvsvc_spec.rb
|
534
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_request_spec.rb
|
535
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_response_spec.rb
|
536
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/close_service_handle_request_spec.rb
|
537
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/close_service_handle_response_spec.rb
|
538
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/control_service_request_spec.rb
|
539
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/control_service_response_spec.rb
|
540
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_request_spec.rb
|
541
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_response_spec.rb
|
542
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/open_service_w_request_spec.rb
|
543
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/open_service_w_response_spec.rb
|
544
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_request_spec.rb
|
545
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_response_spec.rb
|
546
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/query_service_status_request_spec.rb
|
547
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/query_service_status_response_spec.rb
|
548
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/service_status_spec.rb
|
549
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/start_service_w_request_spec.rb
|
550
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/start_service_w_response_spec.rb
|
551
|
+
- spec/lib/ruby_smb/dcerpc/svcctl_spec.rb
|
509
552
|
- spec/lib/ruby_smb/dcerpc/uuid_spec.rb
|
510
553
|
- spec/lib/ruby_smb/dcerpc/winreg/close_key_request_spec.rb
|
511
554
|
- spec/lib/ruby_smb/dcerpc/winreg/close_key_response_spec.rb
|
555
|
+
- spec/lib/ruby_smb/dcerpc/winreg/create_key_request_spec.rb
|
556
|
+
- spec/lib/ruby_smb/dcerpc/winreg/create_key_response_spec.rb
|
512
557
|
- spec/lib/ruby_smb/dcerpc/winreg/enum_key_request_spec.rb
|
513
558
|
- spec/lib/ruby_smb/dcerpc/winreg/enum_key_response_spec.rb
|
514
559
|
- spec/lib/ruby_smb/dcerpc/winreg/enum_value_request_spec.rb
|
@@ -522,6 +567,8 @@ files:
|
|
522
567
|
- spec/lib/ruby_smb/dcerpc/winreg/query_value_request_spec.rb
|
523
568
|
- spec/lib/ruby_smb/dcerpc/winreg/query_value_response_spec.rb
|
524
569
|
- spec/lib/ruby_smb/dcerpc/winreg/regsam_spec.rb
|
570
|
+
- spec/lib/ruby_smb/dcerpc/winreg/save_key_request_spec.rb
|
571
|
+
- spec/lib/ruby_smb/dcerpc/winreg/save_key_response_spec.rb
|
525
572
|
- spec/lib/ruby_smb/dcerpc/winreg_spec.rb
|
526
573
|
- spec/lib/ruby_smb/dcerpc_spec.rb
|
527
574
|
- spec/lib/ruby_smb/dispatcher/base_spec.rb
|
@@ -708,12 +755,33 @@ test_files:
|
|
708
755
|
- spec/lib/ruby_smb/dcerpc/pdu_header_spec.rb
|
709
756
|
- spec/lib/ruby_smb/dcerpc/request_spec.rb
|
710
757
|
- spec/lib/ruby_smb/dcerpc/response_spec.rb
|
758
|
+
- spec/lib/ruby_smb/dcerpc/rpc_security_attributes_spec.rb
|
711
759
|
- spec/lib/ruby_smb/dcerpc/rrp_unicode_string_spec.rb
|
712
760
|
- spec/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all_spec.rb
|
713
761
|
- spec/lib/ruby_smb/dcerpc/srvsvc_spec.rb
|
762
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_request_spec.rb
|
763
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_response_spec.rb
|
764
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/close_service_handle_request_spec.rb
|
765
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/close_service_handle_response_spec.rb
|
766
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/control_service_request_spec.rb
|
767
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/control_service_response_spec.rb
|
768
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_request_spec.rb
|
769
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_response_spec.rb
|
770
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/open_service_w_request_spec.rb
|
771
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/open_service_w_response_spec.rb
|
772
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_request_spec.rb
|
773
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_response_spec.rb
|
774
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/query_service_status_request_spec.rb
|
775
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/query_service_status_response_spec.rb
|
776
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/service_status_spec.rb
|
777
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/start_service_w_request_spec.rb
|
778
|
+
- spec/lib/ruby_smb/dcerpc/svcctl/start_service_w_response_spec.rb
|
779
|
+
- spec/lib/ruby_smb/dcerpc/svcctl_spec.rb
|
714
780
|
- spec/lib/ruby_smb/dcerpc/uuid_spec.rb
|
715
781
|
- spec/lib/ruby_smb/dcerpc/winreg/close_key_request_spec.rb
|
716
782
|
- spec/lib/ruby_smb/dcerpc/winreg/close_key_response_spec.rb
|
783
|
+
- spec/lib/ruby_smb/dcerpc/winreg/create_key_request_spec.rb
|
784
|
+
- spec/lib/ruby_smb/dcerpc/winreg/create_key_response_spec.rb
|
717
785
|
- spec/lib/ruby_smb/dcerpc/winreg/enum_key_request_spec.rb
|
718
786
|
- spec/lib/ruby_smb/dcerpc/winreg/enum_key_response_spec.rb
|
719
787
|
- spec/lib/ruby_smb/dcerpc/winreg/enum_value_request_spec.rb
|
@@ -727,6 +795,8 @@ test_files:
|
|
727
795
|
- spec/lib/ruby_smb/dcerpc/winreg/query_value_request_spec.rb
|
728
796
|
- spec/lib/ruby_smb/dcerpc/winreg/query_value_response_spec.rb
|
729
797
|
- spec/lib/ruby_smb/dcerpc/winreg/regsam_spec.rb
|
798
|
+
- spec/lib/ruby_smb/dcerpc/winreg/save_key_request_spec.rb
|
799
|
+
- spec/lib/ruby_smb/dcerpc/winreg/save_key_response_spec.rb
|
730
800
|
- spec/lib/ruby_smb/dcerpc/winreg_spec.rb
|
731
801
|
- spec/lib/ruby_smb/dcerpc_spec.rb
|
732
802
|
- spec/lib/ruby_smb/dispatcher/base_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|