ruby_smb 1.0.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.travis.yml +3 -2
- data/Gemfile +6 -2
- data/README.md +35 -47
- data/examples/enum_registry_key.rb +28 -0
- data/examples/enum_registry_values.rb +30 -0
- data/examples/negotiate.rb +51 -8
- data/examples/pipes.rb +2 -1
- data/examples/read_file_encryption.rb +56 -0
- data/examples/read_registry_key_value.rb +32 -0
- data/lib/ruby_smb.rb +4 -1
- data/lib/ruby_smb/client.rb +200 -20
- data/lib/ruby_smb/client/authentication.rb +70 -33
- data/lib/ruby_smb/client/echo.rb +20 -2
- data/lib/ruby_smb/client/encryption.rb +62 -0
- data/lib/ruby_smb/client/negotiation.rb +160 -24
- data/lib/ruby_smb/client/signing.rb +19 -0
- data/lib/ruby_smb/client/tree_connect.rb +24 -18
- data/lib/ruby_smb/client/utils.rb +8 -7
- data/lib/ruby_smb/client/winreg.rb +46 -0
- data/lib/ruby_smb/crypto.rb +30 -0
- data/lib/ruby_smb/dcerpc.rb +38 -0
- data/lib/ruby_smb/dcerpc/bind.rb +2 -2
- data/lib/ruby_smb/dcerpc/bind_ack.rb +2 -2
- data/lib/ruby_smb/dcerpc/error.rb +3 -0
- data/lib/ruby_smb/dcerpc/ndr.rb +95 -16
- data/lib/ruby_smb/dcerpc/pdu_header.rb +1 -1
- data/lib/ruby_smb/dcerpc/request.rb +28 -9
- data/lib/ruby_smb/dcerpc/rrp_unicode_string.rb +35 -0
- data/lib/ruby_smb/dcerpc/srvsvc.rb +10 -0
- data/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all.rb +9 -0
- data/lib/ruby_smb/dcerpc/winreg.rb +340 -0
- data/lib/ruby_smb/dcerpc/winreg/close_key_request.rb +24 -0
- data/lib/ruby_smb/dcerpc/winreg/close_key_response.rb +27 -0
- data/lib/ruby_smb/dcerpc/winreg/enum_key_request.rb +45 -0
- data/lib/ruby_smb/dcerpc/winreg/enum_key_response.rb +42 -0
- data/lib/ruby_smb/dcerpc/winreg/enum_value_request.rb +39 -0
- data/lib/ruby_smb/dcerpc/winreg/enum_value_response.rb +36 -0
- data/lib/ruby_smb/dcerpc/winreg/open_key_request.rb +34 -0
- data/lib/ruby_smb/dcerpc/winreg/open_key_response.rb +25 -0
- data/lib/ruby_smb/dcerpc/winreg/open_root_key_request.rb +43 -0
- data/lib/ruby_smb/dcerpc/winreg/open_root_key_response.rb +35 -0
- data/lib/ruby_smb/dcerpc/winreg/query_info_key_request.rb +27 -0
- data/lib/ruby_smb/dcerpc/winreg/query_info_key_response.rb +40 -0
- data/lib/ruby_smb/dcerpc/winreg/query_value_request.rb +39 -0
- data/lib/ruby_smb/dcerpc/winreg/query_value_response.rb +57 -0
- data/lib/ruby_smb/dcerpc/winreg/regsam.rb +40 -0
- data/lib/ruby_smb/dispatcher/socket.rb +5 -3
- data/lib/ruby_smb/error.rb +68 -2
- data/lib/ruby_smb/generic_packet.rb +33 -4
- data/lib/ruby_smb/smb1/commands.rb +1 -1
- data/lib/ruby_smb/smb1/file.rb +66 -15
- data/lib/ruby_smb/smb1/packet/close_request.rb +2 -5
- data/lib/ruby_smb/smb1/packet/close_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/echo_request.rb +2 -4
- data/lib/ruby_smb/smb1/packet/echo_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/empty_packet.rb +10 -1
- data/lib/ruby_smb/smb1/packet/logoff_request.rb +2 -4
- data/lib/ruby_smb/smb1/packet/logoff_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/negotiate_request.rb +2 -5
- data/lib/ruby_smb/smb1/packet/negotiate_response.rb +3 -7
- data/lib/ruby_smb/smb1/packet/negotiate_response_extended.rb +4 -4
- data/lib/ruby_smb/smb1/packet/nt_create_andx_request.rb +2 -4
- data/lib/ruby_smb/smb1/packet/nt_create_andx_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/nt_trans/create_request.rb +2 -1
- data/lib/ruby_smb/smb1/packet/nt_trans/create_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/nt_trans/request.rb +2 -4
- data/lib/ruby_smb/smb1/packet/nt_trans/response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/read_andx_request.rb +2 -5
- data/lib/ruby_smb/smb1/packet/read_andx_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/session_setup_legacy_request.rb +2 -1
- data/lib/ruby_smb/smb1/packet/session_setup_legacy_response.rb +3 -2
- data/lib/ruby_smb/smb1/packet/session_setup_request.rb +2 -5
- data/lib/ruby_smb/smb1/packet/session_setup_response.rb +3 -2
- data/lib/ruby_smb/smb1/packet/trans/peek_nmpipe_request.rb +0 -1
- data/lib/ruby_smb/smb1/packet/trans/peek_nmpipe_response.rb +3 -2
- data/lib/ruby_smb/smb1/packet/trans/request.rb +2 -5
- data/lib/ruby_smb/smb1/packet/trans/response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/trans/transact_nmpipe_request.rb +1 -1
- data/lib/ruby_smb/smb1/packet/trans/transact_nmpipe_response.rb +1 -1
- data/lib/ruby_smb/smb1/packet/trans2/find_first2_request.rb +2 -1
- data/lib/ruby_smb/smb1/packet/trans2/find_first2_response.rb +8 -2
- data/lib/ruby_smb/smb1/packet/trans2/find_next2_request.rb +2 -1
- data/lib/ruby_smb/smb1/packet/trans2/find_next2_response.rb +8 -2
- data/lib/ruby_smb/smb1/packet/trans2/open2_request.rb +2 -1
- data/lib/ruby_smb/smb1/packet/trans2/open2_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/trans2/request.rb +2 -4
- data/lib/ruby_smb/smb1/packet/trans2/request_secondary.rb +2 -4
- data/lib/ruby_smb/smb1/packet/trans2/response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/trans2/set_file_information_request.rb +2 -1
- data/lib/ruby_smb/smb1/packet/trans2/set_file_information_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/tree_connect_request.rb +2 -4
- data/lib/ruby_smb/smb1/packet/tree_connect_response.rb +13 -3
- data/lib/ruby_smb/smb1/packet/tree_disconnect_request.rb +2 -4
- data/lib/ruby_smb/smb1/packet/tree_disconnect_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/write_andx_request.rb +3 -6
- data/lib/ruby_smb/smb1/packet/write_andx_response.rb +2 -1
- data/lib/ruby_smb/smb1/pipe.rb +87 -6
- data/lib/ruby_smb/smb1/tree.rb +41 -3
- data/lib/ruby_smb/smb2/bit_field/session_flags.rb +2 -1
- data/lib/ruby_smb/smb2/bit_field/share_flags.rb +6 -4
- data/lib/ruby_smb/smb2/file.rb +103 -25
- data/lib/ruby_smb/smb2/negotiate_context.rb +108 -0
- data/lib/ruby_smb/smb2/packet.rb +2 -0
- data/lib/ruby_smb/smb2/packet/close_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/close_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/compression_transform_header.rb +41 -0
- data/lib/ruby_smb/smb2/packet/create_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/create_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/echo_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/echo_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/error_packet.rb +15 -3
- data/lib/ruby_smb/smb2/packet/ioctl_request.rb +2 -5
- data/lib/ruby_smb/smb2/packet/ioctl_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/logoff_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/logoff_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/negotiate_request.rb +51 -17
- data/lib/ruby_smb/smb2/packet/negotiate_response.rb +51 -4
- data/lib/ruby_smb/smb2/packet/query_directory_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/query_directory_response.rb +8 -2
- data/lib/ruby_smb/smb2/packet/read_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/read_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/session_setup_request.rb +2 -5
- data/lib/ruby_smb/smb2/packet/session_setup_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/set_info_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/set_info_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/transform_header.rb +84 -0
- data/lib/ruby_smb/smb2/packet/tree_connect_request.rb +93 -10
- data/lib/ruby_smb/smb2/packet/tree_connect_response.rb +10 -22
- data/lib/ruby_smb/smb2/packet/tree_disconnect_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/tree_disconnect_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/write_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/write_response.rb +2 -1
- data/lib/ruby_smb/smb2/pipe.rb +86 -12
- data/lib/ruby_smb/smb2/smb2_header.rb +1 -1
- data/lib/ruby_smb/smb2/tree.rb +65 -21
- data/lib/ruby_smb/version.rb +1 -1
- data/ruby_smb.gemspec +5 -3
- data/spec/lib/ruby_smb/client_spec.rb +1563 -104
- data/spec/lib/ruby_smb/crypto_spec.rb +25 -0
- data/spec/lib/ruby_smb/dcerpc/bind_ack_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/bind_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/ndr_spec.rb +410 -0
- data/spec/lib/ruby_smb/dcerpc/request_spec.rb +50 -7
- data/spec/lib/ruby_smb/dcerpc/rrp_unicode_string_spec.rb +98 -0
- data/spec/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all_spec.rb +13 -0
- data/spec/lib/ruby_smb/dcerpc/srvsvc_spec.rb +60 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/close_key_request_spec.rb +28 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/close_key_response_spec.rb +36 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/enum_key_request_spec.rb +108 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/enum_key_response_spec.rb +97 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/enum_value_request_spec.rb +94 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/enum_value_response_spec.rb +82 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/open_key_request_spec.rb +74 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/open_key_response_spec.rb +35 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/open_root_key_request_spec.rb +90 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/open_root_key_response_spec.rb +38 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/query_info_key_request_spec.rb +39 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/query_info_key_response_spec.rb +113 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/query_value_request_spec.rb +88 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/query_value_response_spec.rb +150 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/regsam_spec.rb +32 -0
- data/spec/lib/ruby_smb/dcerpc/winreg_spec.rb +710 -0
- data/spec/lib/ruby_smb/dcerpc_spec.rb +81 -0
- data/spec/lib/ruby_smb/dispatcher/socket_spec.rb +3 -1
- data/spec/lib/ruby_smb/error_spec.rb +59 -0
- data/spec/lib/ruby_smb/generic_packet_spec.rb +52 -4
- data/spec/lib/ruby_smb/smb1/file_spec.rb +191 -2
- data/spec/lib/ruby_smb/smb1/packet/empty_packet_spec.rb +68 -0
- data/spec/lib/ruby_smb/smb1/packet/session_setup_legacy_request_spec.rb +2 -2
- data/spec/lib/ruby_smb/smb1/packet/session_setup_legacy_response_spec.rb +2 -2
- data/spec/lib/ruby_smb/smb1/packet/session_setup_request_spec.rb +2 -2
- data/spec/lib/ruby_smb/smb1/packet/session_setup_response_spec.rb +1 -1
- data/spec/lib/ruby_smb/smb1/packet/trans2/find_first2_response_spec.rb +11 -2
- data/spec/lib/ruby_smb/smb1/packet/trans2/find_next2_response_spec.rb +11 -2
- data/spec/lib/ruby_smb/smb1/packet/tree_connect_response_spec.rb +40 -0
- data/spec/lib/ruby_smb/smb1/pipe_spec.rb +272 -149
- data/spec/lib/ruby_smb/smb1/tree_spec.rb +44 -7
- data/spec/lib/ruby_smb/smb2/bit_field/session_flags_spec.rb +9 -0
- data/spec/lib/ruby_smb/smb2/bit_field/share_flags_spec.rb +27 -0
- data/spec/lib/ruby_smb/smb2/file_spec.rb +323 -6
- data/spec/lib/ruby_smb/smb2/negotiate_context_spec.rb +332 -0
- data/spec/lib/ruby_smb/smb2/packet/compression_transform_header_spec.rb +108 -0
- data/spec/lib/ruby_smb/smb2/packet/error_packet_spec.rb +78 -0
- data/spec/lib/ruby_smb/smb2/packet/negotiate_request_spec.rb +138 -3
- data/spec/lib/ruby_smb/smb2/packet/negotiate_response_spec.rb +120 -2
- data/spec/lib/ruby_smb/smb2/packet/query_directory_response_spec.rb +8 -0
- data/spec/lib/ruby_smb/smb2/packet/transform_header_spec.rb +220 -0
- data/spec/lib/ruby_smb/smb2/packet/tree_connect_request_spec.rb +339 -9
- data/spec/lib/ruby_smb/smb2/packet/tree_connect_response_spec.rb +3 -22
- data/spec/lib/ruby_smb/smb2/pipe_spec.rb +286 -149
- data/spec/lib/ruby_smb/smb2/smb2_header_spec.rb +2 -2
- data/spec/lib/ruby_smb/smb2/tree_spec.rb +261 -2
- metadata +191 -83
- metadata.gz.sig +0 -0
- data/lib/ruby_smb/smb1/dcerpc.rb +0 -67
- data/lib/ruby_smb/smb2/dcerpc.rb +0 -70
- data/spec/lib/ruby_smb/smb1/packet/error_packet_spec.rb +0 -37
@@ -44,8 +44,8 @@ RSpec.describe RubySMB::SMB2::SMB2Header do
|
|
44
44
|
expect(header.credit_charge).to be_a BinData::Uint16le
|
45
45
|
end
|
46
46
|
|
47
|
-
it 'has a default value of
|
48
|
-
expect(header.credit_charge).to eq
|
47
|
+
it 'has a default value of 1' do
|
48
|
+
expect(header.credit_charge).to eq 1
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -26,6 +26,7 @@ RSpec.describe RubySMB::SMB2::Tree do
|
|
26
26
|
it { is_expected.to respond_to :permissions }
|
27
27
|
it { is_expected.to respond_to :share }
|
28
28
|
it { is_expected.to respond_to :id }
|
29
|
+
it { is_expected.to respond_to :encryption_required }
|
29
30
|
|
30
31
|
it 'inherits the client that spawned it' do
|
31
32
|
expect(tree.client).to eq client
|
@@ -44,10 +45,24 @@ RSpec.describe RubySMB::SMB2::Tree do
|
|
44
45
|
allow(RubySMB::SMB2::Packet::TreeDisconnectRequest).to receive(:new).and_return(disco_req)
|
45
46
|
modified_req = disco_req
|
46
47
|
modified_req.smb2_header.tree_id = tree.id
|
47
|
-
expect(client).to receive(:send_recv).with(modified_req).and_return(disco_resp.to_binary_s)
|
48
|
+
expect(client).to receive(:send_recv).with(modified_req, encrypt: false).and_return(disco_resp.to_binary_s)
|
48
49
|
tree.disconnect!
|
49
50
|
end
|
50
51
|
|
52
|
+
it 'calls Client #send_recv with encryption set if required' do
|
53
|
+
allow(tree).to receive(:set_header_fields).and_return(disco_req)
|
54
|
+
tree.encryption_required = true
|
55
|
+
expect(client).to receive(:send_recv).with(disco_req, encrypt: true).and_return(disco_resp.to_binary_s)
|
56
|
+
tree.disconnect!
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'raises an InvalidPacket exception if the response is not valid' do
|
60
|
+
allow(client).to receive(:send_recv)
|
61
|
+
allow(RubySMB::SMB2::Packet::TreeDisconnectResponse).to receive(:read).and_return(disco_resp)
|
62
|
+
allow(disco_resp).to receive(:valid?).and_return(false)
|
63
|
+
expect { tree.disconnect! }.to raise_error(RubySMB::Error::InvalidPacket)
|
64
|
+
end
|
65
|
+
|
51
66
|
it 'returns the NTStatus code from the response' do
|
52
67
|
allow(client).to receive(:send_recv).and_return(disco_resp.to_binary_s)
|
53
68
|
expect(tree.disconnect!).to eq disco_resp.status_code
|
@@ -126,9 +141,25 @@ RSpec.describe RubySMB::SMB2::Tree do
|
|
126
141
|
|
127
142
|
it 'sends the create request packet and gets a response back' do
|
128
143
|
allow(tree).to receive(:open_directory_packet).and_return(create_req)
|
129
|
-
expect(client).to receive(:send_recv).with(create_req).and_return(create_response.to_binary_s)
|
144
|
+
expect(client).to receive(:send_recv).with(create_req, encrypt: false).and_return(create_response.to_binary_s)
|
145
|
+
tree.open_directory
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'calls Client #send_recv with encryption set if required' do
|
149
|
+
allow(tree).to receive(:open_directory_packet).and_return(create_req)
|
150
|
+
tree.encryption_required = true
|
151
|
+
expect(client).to receive(:send_recv).with(create_req, encrypt: true).and_return(create_response.to_binary_s)
|
130
152
|
tree.open_directory
|
131
153
|
end
|
154
|
+
|
155
|
+
context 'when the response is not a valid packet' do
|
156
|
+
it 'raises an InvalidPacket exception' do
|
157
|
+
allow(client).to receive(:send_recv)
|
158
|
+
allow(RubySMB::SMB2::Packet::CreateResponse).to receive(:read).and_return(create_response)
|
159
|
+
create_response.smb2_header.command = RubySMB::SMB2::Commands::LOGOFF
|
160
|
+
expect { tree.open_directory }.to raise_error(RubySMB::Error::InvalidPacket)
|
161
|
+
end
|
162
|
+
end
|
132
163
|
end
|
133
164
|
|
134
165
|
describe '#list' do
|
@@ -190,6 +221,19 @@ RSpec.describe RubySMB::SMB2::Tree do
|
|
190
221
|
tree.list
|
191
222
|
end
|
192
223
|
|
224
|
+
it 'sends the expected packet and reads the response' do
|
225
|
+
allow(tree).to receive(:set_header_fields).and_return(query_dir_req)
|
226
|
+
expect(client).to receive(:send_recv).with(query_dir_req, encrypt: false)
|
227
|
+
tree.list
|
228
|
+
end
|
229
|
+
|
230
|
+
it 'calls Client #send_recv with encryption set if required' do
|
231
|
+
allow(tree).to receive(:set_header_fields).and_return(query_dir_req)
|
232
|
+
tree.encryption_required = true
|
233
|
+
expect(client).to receive(:send_recv).with(query_dir_req, encrypt: true)
|
234
|
+
tree.list
|
235
|
+
end
|
236
|
+
|
193
237
|
let(:file1) { double('file information') }
|
194
238
|
let(:file2) { double('file information') }
|
195
239
|
|
@@ -202,6 +246,13 @@ RSpec.describe RubySMB::SMB2::Tree do
|
|
202
246
|
expect(tree.list).to eq([file1])
|
203
247
|
end
|
204
248
|
|
249
|
+
context 'when the response is not a valid packet' do
|
250
|
+
it 'raises an InvalidPacket exception' do
|
251
|
+
query_dir_res.smb2_header.command = RubySMB::SMB2::Commands::LOGOFF
|
252
|
+
expect { tree.list }.to raise_error(RubySMB::Error::InvalidPacket)
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
205
256
|
context 'when multiple requests are needed to retrieve the full directory list' do
|
206
257
|
before :example do
|
207
258
|
query_dir_res.smb2_header.nt_status = WindowsError::NTStatus::STATUS_SUCCESS.value
|
@@ -238,4 +289,212 @@ RSpec.describe RubySMB::SMB2::Tree do
|
|
238
289
|
end
|
239
290
|
|
240
291
|
end
|
292
|
+
|
293
|
+
describe '#open_file' do
|
294
|
+
let(:create_request) { RubySMB::SMB2::Packet::CreateRequest.new }
|
295
|
+
let(:create_response) { RubySMB::SMB2::Packet::CreateResponse.new }
|
296
|
+
let(:filename) { "test_file\x00".encode('UTF-16LE') }
|
297
|
+
|
298
|
+
before :each do
|
299
|
+
allow(RubySMB::SMB2::Packet::CreateRequest).to receive(:new).and_return(create_request)
|
300
|
+
allow(RubySMB::SMB2::Packet::CreateResponse).to receive(:read).and_return(create_response)
|
301
|
+
end
|
302
|
+
|
303
|
+
it 'calls #set_header_fields' do
|
304
|
+
allow(client).to receive(:send_recv).and_return(create_response.to_binary_s)
|
305
|
+
expect(tree).to receive(:set_header_fields).with(create_request).and_call_original
|
306
|
+
tree.open_file(filename: filename)
|
307
|
+
end
|
308
|
+
|
309
|
+
describe 'filename' do
|
310
|
+
it 'takes the filename as an argument' do
|
311
|
+
allow(client).to receive(:send_recv) do |packet|
|
312
|
+
expect(packet.name).to eq(filename)
|
313
|
+
create_response.to_binary_s
|
314
|
+
end
|
315
|
+
tree.open_file(filename: filename)
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
describe 'attributes' do
|
320
|
+
it 'has the correct default fields set' do
|
321
|
+
allow(client).to receive(:send_recv) do |packet|
|
322
|
+
expect(packet.file_attributes.directory).to eq(0)
|
323
|
+
expect(packet.file_attributes.normal).to eq(1)
|
324
|
+
create_response.to_binary_s
|
325
|
+
end
|
326
|
+
tree.open_file(filename: filename)
|
327
|
+
end
|
328
|
+
|
329
|
+
it 'can take the Attributes as an argument' do
|
330
|
+
attributes = { normal: 0 }
|
331
|
+
allow(client).to receive(:send_recv) do |packet|
|
332
|
+
expect(packet.file_attributes.normal).to eq(0)
|
333
|
+
create_response.to_binary_s
|
334
|
+
end
|
335
|
+
tree.open_file(filename: filename, attributes: attributes)
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
describe 'options' do
|
340
|
+
it 'has the correct default fields set' do
|
341
|
+
allow(client).to receive(:send_recv) do |packet|
|
342
|
+
expect(packet.create_options.directory_file).to eq(0)
|
343
|
+
expect(packet.create_options.non_directory_file).to eq(1)
|
344
|
+
create_response.to_binary_s
|
345
|
+
end
|
346
|
+
tree.open_file(filename: filename)
|
347
|
+
end
|
348
|
+
|
349
|
+
it 'can take the Create Options as an argument' do
|
350
|
+
options = RubySMB::SMB1::BitField::CreateOptions.new(directory_file: 1)
|
351
|
+
allow(client).to receive(:send_recv) do |packet|
|
352
|
+
expect(packet.create_options.directory_file).to eq(1)
|
353
|
+
expect(packet.create_options.non_directory_file).to eq(0)
|
354
|
+
create_response.to_binary_s
|
355
|
+
end
|
356
|
+
tree.open_file(filename: filename, options: options)
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
360
|
+
describe 'disposition' do
|
361
|
+
it 'defaults to FILE_OPEN' do
|
362
|
+
allow(client).to receive(:send_recv) do |packet|
|
363
|
+
expect(packet.create_disposition).to eq(RubySMB::Dispositions::FILE_OPEN)
|
364
|
+
create_response.to_binary_s
|
365
|
+
end
|
366
|
+
tree.open_file(filename: filename)
|
367
|
+
end
|
368
|
+
|
369
|
+
it 'can take the Disposition as an argument' do
|
370
|
+
allow(client).to receive(:send_recv) do |packet|
|
371
|
+
expect(packet.create_disposition).to eq(RubySMB::Dispositions::FILE_OPEN_IF)
|
372
|
+
create_response.to_binary_s
|
373
|
+
end
|
374
|
+
tree.open_file(filename: filename, disposition: RubySMB::Dispositions::FILE_OPEN_IF)
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
describe 'impersonation level' do
|
379
|
+
it 'defaults to SEC_IMPERSONATE' do
|
380
|
+
allow(client).to receive(:send_recv) do |packet|
|
381
|
+
expect(packet.impersonation_level).to eq(RubySMB::ImpersonationLevels::SEC_IMPERSONATE)
|
382
|
+
create_response.to_binary_s
|
383
|
+
end
|
384
|
+
tree.open_file(filename: filename)
|
385
|
+
end
|
386
|
+
|
387
|
+
it 'can take the Impersonation Level as an argument' do
|
388
|
+
allow(client).to receive(:send_recv) do |packet|
|
389
|
+
expect(packet.impersonation_level).to eq(RubySMB::ImpersonationLevels::SEC_DELEGATE)
|
390
|
+
create_response.to_binary_s
|
391
|
+
end
|
392
|
+
tree.open_file(filename: filename, impersonation: RubySMB::ImpersonationLevels::SEC_DELEGATE)
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
396
|
+
describe 'RWD access permissions' do
|
397
|
+
it 'will set the read permission from the parameters' do
|
398
|
+
allow(client).to receive(:send_recv) do |packet|
|
399
|
+
expect(packet.share_access.read_access).to eq(1)
|
400
|
+
expect(packet.desired_access.read_data).to eq(1)
|
401
|
+
create_response.to_binary_s
|
402
|
+
end
|
403
|
+
tree.open_file(filename: filename, read: true)
|
404
|
+
end
|
405
|
+
|
406
|
+
it 'will set the write permission from the parameters' do
|
407
|
+
allow(client).to receive(:send_recv) do |packet|
|
408
|
+
expect(packet.share_access.write_access).to eq(1)
|
409
|
+
expect(packet.desired_access.write_data).to eq(1)
|
410
|
+
expect(packet.desired_access.append_data).to eq(1)
|
411
|
+
create_response.to_binary_s
|
412
|
+
end
|
413
|
+
tree.open_file(filename: filename, write: true)
|
414
|
+
end
|
415
|
+
|
416
|
+
it 'will set the delete permission from the parameters' do
|
417
|
+
allow(client).to receive(:send_recv) do |packet|
|
418
|
+
expect(packet.share_access.delete_access).to eq(1)
|
419
|
+
expect(packet.desired_access.delete_access).to eq(1)
|
420
|
+
create_response.to_binary_s
|
421
|
+
end
|
422
|
+
tree.open_file(filename: filename, delete: true)
|
423
|
+
end
|
424
|
+
end
|
425
|
+
|
426
|
+
it 'sets #requested_oplock to 0xFF' do
|
427
|
+
allow(client).to receive(:send_recv) do |packet|
|
428
|
+
expect(packet.requested_oplock).to eq(0xFF)
|
429
|
+
create_response.to_binary_s
|
430
|
+
end
|
431
|
+
tree.open_file(filename: filename, delete: true)
|
432
|
+
end
|
433
|
+
|
434
|
+
it 'sends the CreateRequest request packet and gets the expected CreateResponse response back' do
|
435
|
+
expect(client).to receive(:send_recv).with(create_request, encrypt: false).and_return(create_response.to_binary_s)
|
436
|
+
tree.open_file(filename: filename)
|
437
|
+
end
|
438
|
+
|
439
|
+
it 'calls Client #send_recv with encryption set if required' do
|
440
|
+
tree.encryption_required = true
|
441
|
+
expect(client).to receive(:send_recv).with(create_request, encrypt: true).and_return(create_response.to_binary_s)
|
442
|
+
tree.open_file(filename: filename)
|
443
|
+
end
|
444
|
+
|
445
|
+
context 'when sending the request packet and gets a response back' do
|
446
|
+
before :example do
|
447
|
+
allow(client).to receive(:send_recv).and_return(create_response.to_binary_s)
|
448
|
+
end
|
449
|
+
|
450
|
+
context 'when it is a file' do
|
451
|
+
context 'when encryption is not required' do
|
452
|
+
it 'returns the expected RubySMB::SMB2::File object' do
|
453
|
+
file_obj = RubySMB::SMB2::File.new(name: filename, tree: tree, response: create_response, encrypt: false)
|
454
|
+
expect(RubySMB::SMB2::File).to receive(:new).with(name: filename, tree: tree, response: create_response, encrypt: false).and_return(file_obj)
|
455
|
+
expect(tree.open_file(filename: filename)).to eq(file_obj)
|
456
|
+
end
|
457
|
+
end
|
458
|
+
|
459
|
+
context 'when encryption is required' do
|
460
|
+
it 'returns the expected RubySMB::SMB2::File object' do
|
461
|
+
file_obj = RubySMB::SMB2::File.new(name: filename, tree: tree, response: create_response, encrypt: true)
|
462
|
+
tree.encryption_required = true
|
463
|
+
expect(RubySMB::SMB2::File).to receive(:new).with(name: filename, tree: tree, response: create_response, encrypt: true).and_return(file_obj)
|
464
|
+
expect(tree.open_file(filename: filename)).to eq(file_obj)
|
465
|
+
end
|
466
|
+
end
|
467
|
+
end
|
468
|
+
|
469
|
+
context 'when it is a pipe' do
|
470
|
+
it 'returns the expected RubySMB::SMB2::Pipe object' do
|
471
|
+
response.share_type = 0x02
|
472
|
+
pipe_obj = RubySMB::SMB2::Pipe.new(name: filename, tree: tree, response: create_response)
|
473
|
+
expect(RubySMB::SMB2::Pipe).to receive(:new).with(name: filename, tree: tree, response: create_response).and_return(pipe_obj)
|
474
|
+
expect(tree.open_file(filename: filename)).to eq(pipe_obj)
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
context 'when it is an unsupported share type' do
|
479
|
+
it 'raises a RubySMBError exception' do
|
480
|
+
response.share_type = 0x03
|
481
|
+
expect { tree.open_file(filename: filename) }.to raise_error(RubySMB::Error::RubySMBError)
|
482
|
+
end
|
483
|
+
end
|
484
|
+
|
485
|
+
context 'when the response is not a CreateResponse packet' do
|
486
|
+
it 'raises an InvalidPacket exception' do
|
487
|
+
create_response.smb2_header.command = RubySMB::SMB2::Commands::LOGOFF
|
488
|
+
expect { tree.open_file(filename: filename) }.to raise_error(RubySMB::Error::InvalidPacket)
|
489
|
+
end
|
490
|
+
end
|
491
|
+
|
492
|
+
context 'when the response status code is not STATUS_SUCCESS' do
|
493
|
+
it 'raises an UnexpectedStatusCode exception' do
|
494
|
+
create_response.smb2_header.nt_status = WindowsError::NTStatus::STATUS_INVALID_HANDLE.value
|
495
|
+
expect { tree.open_file(filename: filename) }.to raise_error(RubySMB::Error::UnexpectedStatusCode)
|
496
|
+
end
|
497
|
+
end
|
498
|
+
end
|
499
|
+
end
|
241
500
|
end
|
metadata
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_smb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Metasploit Hackers
|
7
8
|
- David Maloney
|
8
9
|
- James Lee
|
9
10
|
- Dev Mohanty
|
@@ -13,85 +14,90 @@ bindir: bin
|
|
13
14
|
cert_chain:
|
14
15
|
- |
|
15
16
|
-----BEGIN CERTIFICATE-----
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
17
|
+
MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl
|
18
|
+
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
|
19
|
+
d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv
|
20
|
+
b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG
|
21
|
+
EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl
|
22
|
+
cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi
|
23
|
+
MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c
|
24
|
+
JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP
|
25
|
+
mDI2dsze3Tyoou9q+yHyUmHfnyDXH+K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VBOBmmvA43qoKideuhOBrVGBHvIF/yO9p23dIiUrGmW9kxXCSxgute
|
97
|
+
JI/W23RbIRksG2pioMhd4dCXq3FLLlkOV1YfCwWixNB+iIhQPPZVaPNfgPhCn4Dt
|
98
|
+
DeGjje/qA4fkLtRmOtb9PUBq3ToRDE4=
|
93
99
|
-----END CERTIFICATE-----
|
94
|
-
date:
|
100
|
+
date: 2020-06-09 00:00:00.000000000 Z
|
95
101
|
dependencies:
|
96
102
|
- !ruby/object:Gem::Dependency
|
97
103
|
name: redcarpet
|
@@ -205,12 +211,37 @@ dependencies:
|
|
205
211
|
- - ">="
|
206
212
|
- !ruby/object:Gem::Version
|
207
213
|
version: '0'
|
214
|
+
- !ruby/object:Gem::Dependency
|
215
|
+
name: openssl-ccm
|
216
|
+
requirement: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - ">="
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: '0'
|
221
|
+
type: :runtime
|
222
|
+
prerelease: false
|
223
|
+
version_requirements: !ruby/object:Gem::Requirement
|
224
|
+
requirements:
|
225
|
+
- - ">="
|
226
|
+
- !ruby/object:Gem::Version
|
227
|
+
version: '0'
|
228
|
+
- !ruby/object:Gem::Dependency
|
229
|
+
name: openssl-cmac
|
230
|
+
requirement: !ruby/object:Gem::Requirement
|
231
|
+
requirements:
|
232
|
+
- - ">="
|
233
|
+
- !ruby/object:Gem::Version
|
234
|
+
version: '0'
|
235
|
+
type: :runtime
|
236
|
+
prerelease: false
|
237
|
+
version_requirements: !ruby/object:Gem::Requirement
|
238
|
+
requirements:
|
239
|
+
- - ">="
|
240
|
+
- !ruby/object:Gem::Version
|
241
|
+
version: '0'
|
208
242
|
description: ''
|
209
243
|
email:
|
210
|
-
-
|
211
|
-
- egypt@metasploit.com
|
212
|
-
- dev_mohanty@rapid7.com
|
213
|
-
- paristvinternet-github@yahoo.com
|
244
|
+
- msfdev@metasploit.com
|
214
245
|
executables: []
|
215
246
|
extensions: []
|
216
247
|
extra_rdoc_files: []
|
@@ -229,12 +260,16 @@ files:
|
|
229
260
|
- examples/append_file.rb
|
230
261
|
- examples/authenticate.rb
|
231
262
|
- examples/delete_file.rb
|
263
|
+
- examples/enum_registry_key.rb
|
264
|
+
- examples/enum_registry_values.rb
|
232
265
|
- examples/list_directory.rb
|
233
266
|
- examples/negotiate.rb
|
234
267
|
- examples/negotiate_with_netbios_service.rb
|
235
268
|
- examples/net_share_enum_all.rb
|
236
269
|
- examples/pipes.rb
|
237
270
|
- examples/read_file.rb
|
271
|
+
- examples/read_file_encryption.rb
|
272
|
+
- examples/read_registry_key_value.rb
|
238
273
|
- examples/rename_file.rb
|
239
274
|
- examples/tree_connect.rb
|
240
275
|
- examples/write_file.rb
|
@@ -242,10 +277,13 @@ files:
|
|
242
277
|
- lib/ruby_smb/client.rb
|
243
278
|
- lib/ruby_smb/client/authentication.rb
|
244
279
|
- lib/ruby_smb/client/echo.rb
|
280
|
+
- lib/ruby_smb/client/encryption.rb
|
245
281
|
- lib/ruby_smb/client/negotiation.rb
|
246
282
|
- lib/ruby_smb/client/signing.rb
|
247
283
|
- lib/ruby_smb/client/tree_connect.rb
|
248
284
|
- lib/ruby_smb/client/utils.rb
|
285
|
+
- lib/ruby_smb/client/winreg.rb
|
286
|
+
- lib/ruby_smb/crypto.rb
|
249
287
|
- lib/ruby_smb/dcerpc.rb
|
250
288
|
- lib/ruby_smb/dcerpc/bind.rb
|
251
289
|
- lib/ruby_smb/dcerpc/bind_ack.rb
|
@@ -256,9 +294,26 @@ files:
|
|
256
294
|
- lib/ruby_smb/dcerpc/ptypes.rb
|
257
295
|
- lib/ruby_smb/dcerpc/request.rb
|
258
296
|
- lib/ruby_smb/dcerpc/response.rb
|
297
|
+
- lib/ruby_smb/dcerpc/rrp_unicode_string.rb
|
259
298
|
- lib/ruby_smb/dcerpc/srvsvc.rb
|
260
299
|
- lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all.rb
|
261
300
|
- lib/ruby_smb/dcerpc/uuid.rb
|
301
|
+
- lib/ruby_smb/dcerpc/winreg.rb
|
302
|
+
- lib/ruby_smb/dcerpc/winreg/close_key_request.rb
|
303
|
+
- lib/ruby_smb/dcerpc/winreg/close_key_response.rb
|
304
|
+
- lib/ruby_smb/dcerpc/winreg/enum_key_request.rb
|
305
|
+
- lib/ruby_smb/dcerpc/winreg/enum_key_response.rb
|
306
|
+
- lib/ruby_smb/dcerpc/winreg/enum_value_request.rb
|
307
|
+
- lib/ruby_smb/dcerpc/winreg/enum_value_response.rb
|
308
|
+
- lib/ruby_smb/dcerpc/winreg/open_key_request.rb
|
309
|
+
- lib/ruby_smb/dcerpc/winreg/open_key_response.rb
|
310
|
+
- lib/ruby_smb/dcerpc/winreg/open_root_key_request.rb
|
311
|
+
- lib/ruby_smb/dcerpc/winreg/open_root_key_response.rb
|
312
|
+
- lib/ruby_smb/dcerpc/winreg/query_info_key_request.rb
|
313
|
+
- lib/ruby_smb/dcerpc/winreg/query_info_key_response.rb
|
314
|
+
- lib/ruby_smb/dcerpc/winreg/query_value_request.rb
|
315
|
+
- lib/ruby_smb/dcerpc/winreg/query_value_response.rb
|
316
|
+
- lib/ruby_smb/dcerpc/winreg/regsam.rb
|
262
317
|
- lib/ruby_smb/dispatcher.rb
|
263
318
|
- lib/ruby_smb/dispatcher/base.rb
|
264
319
|
- lib/ruby_smb/dispatcher/socket.rb
|
@@ -324,7 +379,6 @@ files:
|
|
324
379
|
- lib/ruby_smb/smb1/commands.rb
|
325
380
|
- lib/ruby_smb/smb1/create_actions.rb
|
326
381
|
- lib/ruby_smb/smb1/data_block.rb
|
327
|
-
- lib/ruby_smb/smb1/dcerpc.rb
|
328
382
|
- lib/ruby_smb/smb1/dialect.rb
|
329
383
|
- lib/ruby_smb/smb1/file.rb
|
330
384
|
- lib/ruby_smb/smb1/oplock_levels.rb
|
@@ -402,12 +456,13 @@ files:
|
|
402
456
|
- lib/ruby_smb/smb2/bit_field/smb2_security_mode_single.rb
|
403
457
|
- lib/ruby_smb/smb2/commands.rb
|
404
458
|
- lib/ruby_smb/smb2/create_context.rb
|
405
|
-
- lib/ruby_smb/smb2/dcerpc.rb
|
406
459
|
- lib/ruby_smb/smb2/file.rb
|
407
460
|
- lib/ruby_smb/smb2/info_type.rb
|
461
|
+
- lib/ruby_smb/smb2/negotiate_context.rb
|
408
462
|
- lib/ruby_smb/smb2/packet.rb
|
409
463
|
- lib/ruby_smb/smb2/packet/close_request.rb
|
410
464
|
- lib/ruby_smb/smb2/packet/close_response.rb
|
465
|
+
- lib/ruby_smb/smb2/packet/compression_transform_header.rb
|
411
466
|
- lib/ruby_smb/smb2/packet/create_request.rb
|
412
467
|
- lib/ruby_smb/smb2/packet/create_response.rb
|
413
468
|
- lib/ruby_smb/smb2/packet/echo_request.rb
|
@@ -427,6 +482,7 @@ files:
|
|
427
482
|
- lib/ruby_smb/smb2/packet/session_setup_response.rb
|
428
483
|
- lib/ruby_smb/smb2/packet/set_info_request.rb
|
429
484
|
- lib/ruby_smb/smb2/packet/set_info_response.rb
|
485
|
+
- lib/ruby_smb/smb2/packet/transform_header.rb
|
430
486
|
- lib/ruby_smb/smb2/packet/tree_connect_request.rb
|
431
487
|
- lib/ruby_smb/smb2/packet/tree_connect_response.rb
|
432
488
|
- lib/ruby_smb/smb2/packet/tree_disconnect_request.rb
|
@@ -439,16 +495,38 @@ files:
|
|
439
495
|
- lib/ruby_smb/version.rb
|
440
496
|
- ruby_smb.gemspec
|
441
497
|
- spec/lib/ruby_smb/client_spec.rb
|
498
|
+
- spec/lib/ruby_smb/crypto_spec.rb
|
442
499
|
- spec/lib/ruby_smb/dcerpc/bind_ack_spec.rb
|
443
500
|
- spec/lib/ruby_smb/dcerpc/bind_spec.rb
|
501
|
+
- spec/lib/ruby_smb/dcerpc/ndr_spec.rb
|
444
502
|
- spec/lib/ruby_smb/dcerpc/p_syntax_id_t_spec.rb
|
445
503
|
- spec/lib/ruby_smb/dcerpc/pdu_header_spec.rb
|
446
504
|
- spec/lib/ruby_smb/dcerpc/request_spec.rb
|
447
505
|
- spec/lib/ruby_smb/dcerpc/response_spec.rb
|
506
|
+
- spec/lib/ruby_smb/dcerpc/rrp_unicode_string_spec.rb
|
448
507
|
- spec/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all_spec.rb
|
508
|
+
- spec/lib/ruby_smb/dcerpc/srvsvc_spec.rb
|
449
509
|
- spec/lib/ruby_smb/dcerpc/uuid_spec.rb
|
510
|
+
- spec/lib/ruby_smb/dcerpc/winreg/close_key_request_spec.rb
|
511
|
+
- spec/lib/ruby_smb/dcerpc/winreg/close_key_response_spec.rb
|
512
|
+
- spec/lib/ruby_smb/dcerpc/winreg/enum_key_request_spec.rb
|
513
|
+
- spec/lib/ruby_smb/dcerpc/winreg/enum_key_response_spec.rb
|
514
|
+
- spec/lib/ruby_smb/dcerpc/winreg/enum_value_request_spec.rb
|
515
|
+
- spec/lib/ruby_smb/dcerpc/winreg/enum_value_response_spec.rb
|
516
|
+
- spec/lib/ruby_smb/dcerpc/winreg/open_key_request_spec.rb
|
517
|
+
- spec/lib/ruby_smb/dcerpc/winreg/open_key_response_spec.rb
|
518
|
+
- spec/lib/ruby_smb/dcerpc/winreg/open_root_key_request_spec.rb
|
519
|
+
- spec/lib/ruby_smb/dcerpc/winreg/open_root_key_response_spec.rb
|
520
|
+
- spec/lib/ruby_smb/dcerpc/winreg/query_info_key_request_spec.rb
|
521
|
+
- spec/lib/ruby_smb/dcerpc/winreg/query_info_key_response_spec.rb
|
522
|
+
- spec/lib/ruby_smb/dcerpc/winreg/query_value_request_spec.rb
|
523
|
+
- spec/lib/ruby_smb/dcerpc/winreg/query_value_response_spec.rb
|
524
|
+
- spec/lib/ruby_smb/dcerpc/winreg/regsam_spec.rb
|
525
|
+
- spec/lib/ruby_smb/dcerpc/winreg_spec.rb
|
526
|
+
- spec/lib/ruby_smb/dcerpc_spec.rb
|
450
527
|
- spec/lib/ruby_smb/dispatcher/base_spec.rb
|
451
528
|
- spec/lib/ruby_smb/dispatcher/socket_spec.rb
|
529
|
+
- spec/lib/ruby_smb/error_spec.rb
|
452
530
|
- spec/lib/ruby_smb/field/extended_attribute_flag_spec.rb
|
453
531
|
- spec/lib/ruby_smb/field/file_time_spec.rb
|
454
532
|
- spec/lib/ruby_smb/field/nt_status_spec.rb
|
@@ -503,7 +581,7 @@ files:
|
|
503
581
|
- spec/lib/ruby_smb/smb1/packet/close_response_spec.rb
|
504
582
|
- spec/lib/ruby_smb/smb1/packet/echo_request_spec.rb
|
505
583
|
- spec/lib/ruby_smb/smb1/packet/echo_response_spec.rb
|
506
|
-
- spec/lib/ruby_smb/smb1/packet/
|
584
|
+
- spec/lib/ruby_smb/smb1/packet/empty_packet_spec.rb
|
507
585
|
- spec/lib/ruby_smb/smb1/packet/logoff_request_spec.rb
|
508
586
|
- spec/lib/ruby_smb/smb1/packet/logoff_response_spec.rb
|
509
587
|
- spec/lib/ruby_smb/smb1/packet/negotiate_request_spec.rb
|
@@ -560,12 +638,15 @@ files:
|
|
560
638
|
- spec/lib/ruby_smb/smb2/bit_field/smb_secruity_mode_spec.rb
|
561
639
|
- spec/lib/ruby_smb/smb2/create_context_spec.rb
|
562
640
|
- spec/lib/ruby_smb/smb2/file_spec.rb
|
641
|
+
- spec/lib/ruby_smb/smb2/negotiate_context_spec.rb
|
563
642
|
- spec/lib/ruby_smb/smb2/packet/close_request_spec.rb
|
564
643
|
- spec/lib/ruby_smb/smb2/packet/close_response_spec.rb
|
644
|
+
- spec/lib/ruby_smb/smb2/packet/compression_transform_header_spec.rb
|
565
645
|
- spec/lib/ruby_smb/smb2/packet/create_request_spec.rb
|
566
646
|
- spec/lib/ruby_smb/smb2/packet/create_response_spec.rb
|
567
647
|
- spec/lib/ruby_smb/smb2/packet/echo_request_spec.rb
|
568
648
|
- spec/lib/ruby_smb/smb2/packet/echo_response_spec.rb
|
649
|
+
- spec/lib/ruby_smb/smb2/packet/error_packet_spec.rb
|
569
650
|
- spec/lib/ruby_smb/smb2/packet/ioctl_request_spec.rb
|
570
651
|
- spec/lib/ruby_smb/smb2/packet/logoff_request_spec.rb
|
571
652
|
- spec/lib/ruby_smb/smb2/packet/logoff_response_spec.rb
|
@@ -579,6 +660,7 @@ files:
|
|
579
660
|
- spec/lib/ruby_smb/smb2/packet/session_setup_response_spec.rb
|
580
661
|
- spec/lib/ruby_smb/smb2/packet/set_info_request_spec.rb
|
581
662
|
- spec/lib/ruby_smb/smb2/packet/set_info_response_spec.rb
|
663
|
+
- spec/lib/ruby_smb/smb2/packet/transform_header_spec.rb
|
582
664
|
- spec/lib/ruby_smb/smb2/packet/tree_connect_request_spec.rb
|
583
665
|
- spec/lib/ruby_smb/smb2/packet/tree_connect_response_spec.rb
|
584
666
|
- spec/lib/ruby_smb/smb2/packet/tree_disconnect_request_spec.rb
|
@@ -604,7 +686,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
604
686
|
requirements:
|
605
687
|
- - ">="
|
606
688
|
- !ruby/object:Gem::Version
|
607
|
-
version: 2.
|
689
|
+
version: '2.5'
|
608
690
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
609
691
|
requirements:
|
610
692
|
- - ">="
|
@@ -612,22 +694,44 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
612
694
|
version: '0'
|
613
695
|
requirements: []
|
614
696
|
rubyforge_project:
|
615
|
-
rubygems_version: 2.
|
697
|
+
rubygems_version: 2.7.10
|
616
698
|
signing_key:
|
617
699
|
specification_version: 4
|
618
700
|
summary: A pure Ruby implementation of the SMB Protocol Family
|
619
701
|
test_files:
|
620
702
|
- spec/lib/ruby_smb/client_spec.rb
|
703
|
+
- spec/lib/ruby_smb/crypto_spec.rb
|
621
704
|
- spec/lib/ruby_smb/dcerpc/bind_ack_spec.rb
|
622
705
|
- spec/lib/ruby_smb/dcerpc/bind_spec.rb
|
706
|
+
- spec/lib/ruby_smb/dcerpc/ndr_spec.rb
|
623
707
|
- spec/lib/ruby_smb/dcerpc/p_syntax_id_t_spec.rb
|
624
708
|
- spec/lib/ruby_smb/dcerpc/pdu_header_spec.rb
|
625
709
|
- spec/lib/ruby_smb/dcerpc/request_spec.rb
|
626
710
|
- spec/lib/ruby_smb/dcerpc/response_spec.rb
|
711
|
+
- spec/lib/ruby_smb/dcerpc/rrp_unicode_string_spec.rb
|
627
712
|
- spec/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all_spec.rb
|
713
|
+
- spec/lib/ruby_smb/dcerpc/srvsvc_spec.rb
|
628
714
|
- spec/lib/ruby_smb/dcerpc/uuid_spec.rb
|
715
|
+
- spec/lib/ruby_smb/dcerpc/winreg/close_key_request_spec.rb
|
716
|
+
- spec/lib/ruby_smb/dcerpc/winreg/close_key_response_spec.rb
|
717
|
+
- spec/lib/ruby_smb/dcerpc/winreg/enum_key_request_spec.rb
|
718
|
+
- spec/lib/ruby_smb/dcerpc/winreg/enum_key_response_spec.rb
|
719
|
+
- spec/lib/ruby_smb/dcerpc/winreg/enum_value_request_spec.rb
|
720
|
+
- spec/lib/ruby_smb/dcerpc/winreg/enum_value_response_spec.rb
|
721
|
+
- spec/lib/ruby_smb/dcerpc/winreg/open_key_request_spec.rb
|
722
|
+
- spec/lib/ruby_smb/dcerpc/winreg/open_key_response_spec.rb
|
723
|
+
- spec/lib/ruby_smb/dcerpc/winreg/open_root_key_request_spec.rb
|
724
|
+
- spec/lib/ruby_smb/dcerpc/winreg/open_root_key_response_spec.rb
|
725
|
+
- spec/lib/ruby_smb/dcerpc/winreg/query_info_key_request_spec.rb
|
726
|
+
- spec/lib/ruby_smb/dcerpc/winreg/query_info_key_response_spec.rb
|
727
|
+
- spec/lib/ruby_smb/dcerpc/winreg/query_value_request_spec.rb
|
728
|
+
- spec/lib/ruby_smb/dcerpc/winreg/query_value_response_spec.rb
|
729
|
+
- spec/lib/ruby_smb/dcerpc/winreg/regsam_spec.rb
|
730
|
+
- spec/lib/ruby_smb/dcerpc/winreg_spec.rb
|
731
|
+
- spec/lib/ruby_smb/dcerpc_spec.rb
|
629
732
|
- spec/lib/ruby_smb/dispatcher/base_spec.rb
|
630
733
|
- spec/lib/ruby_smb/dispatcher/socket_spec.rb
|
734
|
+
- spec/lib/ruby_smb/error_spec.rb
|
631
735
|
- spec/lib/ruby_smb/field/extended_attribute_flag_spec.rb
|
632
736
|
- spec/lib/ruby_smb/field/file_time_spec.rb
|
633
737
|
- spec/lib/ruby_smb/field/nt_status_spec.rb
|
@@ -682,7 +786,7 @@ test_files:
|
|
682
786
|
- spec/lib/ruby_smb/smb1/packet/close_response_spec.rb
|
683
787
|
- spec/lib/ruby_smb/smb1/packet/echo_request_spec.rb
|
684
788
|
- spec/lib/ruby_smb/smb1/packet/echo_response_spec.rb
|
685
|
-
- spec/lib/ruby_smb/smb1/packet/
|
789
|
+
- spec/lib/ruby_smb/smb1/packet/empty_packet_spec.rb
|
686
790
|
- spec/lib/ruby_smb/smb1/packet/logoff_request_spec.rb
|
687
791
|
- spec/lib/ruby_smb/smb1/packet/logoff_response_spec.rb
|
688
792
|
- spec/lib/ruby_smb/smb1/packet/negotiate_request_spec.rb
|
@@ -739,12 +843,15 @@ test_files:
|
|
739
843
|
- spec/lib/ruby_smb/smb2/bit_field/smb_secruity_mode_spec.rb
|
740
844
|
- spec/lib/ruby_smb/smb2/create_context_spec.rb
|
741
845
|
- spec/lib/ruby_smb/smb2/file_spec.rb
|
846
|
+
- spec/lib/ruby_smb/smb2/negotiate_context_spec.rb
|
742
847
|
- spec/lib/ruby_smb/smb2/packet/close_request_spec.rb
|
743
848
|
- spec/lib/ruby_smb/smb2/packet/close_response_spec.rb
|
849
|
+
- spec/lib/ruby_smb/smb2/packet/compression_transform_header_spec.rb
|
744
850
|
- spec/lib/ruby_smb/smb2/packet/create_request_spec.rb
|
745
851
|
- spec/lib/ruby_smb/smb2/packet/create_response_spec.rb
|
746
852
|
- spec/lib/ruby_smb/smb2/packet/echo_request_spec.rb
|
747
853
|
- spec/lib/ruby_smb/smb2/packet/echo_response_spec.rb
|
854
|
+
- spec/lib/ruby_smb/smb2/packet/error_packet_spec.rb
|
748
855
|
- spec/lib/ruby_smb/smb2/packet/ioctl_request_spec.rb
|
749
856
|
- spec/lib/ruby_smb/smb2/packet/logoff_request_spec.rb
|
750
857
|
- spec/lib/ruby_smb/smb2/packet/logoff_response_spec.rb
|
@@ -758,6 +865,7 @@ test_files:
|
|
758
865
|
- spec/lib/ruby_smb/smb2/packet/session_setup_response_spec.rb
|
759
866
|
- spec/lib/ruby_smb/smb2/packet/set_info_request_spec.rb
|
760
867
|
- spec/lib/ruby_smb/smb2/packet/set_info_response_spec.rb
|
868
|
+
- spec/lib/ruby_smb/smb2/packet/transform_header_spec.rb
|
761
869
|
- spec/lib/ruby_smb/smb2/packet/tree_connect_request_spec.rb
|
762
870
|
- spec/lib/ruby_smb/smb2/packet/tree_connect_response_spec.rb
|
763
871
|
- spec/lib/ruby_smb/smb2/packet/tree_disconnect_request_spec.rb
|