ruby_smb 3.2.8 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4ddd94d3c783b3091a37c946c5069da85350c23294b33ddabcdc0476f828ec4
4
- data.tar.gz: 990ad64d98bd60dd957c1b8b6fcf1abdbd6e8a52d408e0e6c03d3694354cb4ad
3
+ metadata.gz: 2f696c845250348795f67d3d5b163c65b432acdbcd01bc86d0a6cd81ddcbfc67
4
+ data.tar.gz: b43dcb4fa6ff4497e61329b8b5a17049a6b445fcdf5c3df61dc380960ea02b9c
5
5
  SHA512:
6
- metadata.gz: bc7b1921009d55e8263ecfe3aa282bd4df35636a5055f5126ffa1866ed8140283bbfa14f341a4d791e30a7f51e0df631676ef211961c9712e457e0939983a6c7
7
- data.tar.gz: 11982c6c2b2fb653756140c7024ccff301c72ee9b5ac44f85a5071f1d2a27dbdcf31b5936bc3ea646ef7219e3c917b5466ec3e6b26bbba116fc7552169244a4a
6
+ metadata.gz: 8368cf1844e47161a57051d7b8dfa807b665c898153636b1baedb2211acd4685ef67c5ba167581ce84a9ec7c8c17e812d1f876bb70f34b647bb075bb94861349
7
+ data.tar.gz: 3b33a185fb3b981147b005e13793aa1f8a09e11c2e5e0dc9b75469ef980ec019bc2dd5e9bef187910f9b5be012d7ca710799b45aa0bdf79547ae3d48de8e22e7
checksums.yaml.gz.sig CHANGED
Binary file
@@ -85,6 +85,7 @@ module RubySMB
85
85
  # @raise [RubySMB::Error::InvalidPacket] if the response is not a QueryDirectoryResponse packet
86
86
  def list(directory: nil, pattern: '*', type: RubySMB::Fscc::FileInformation::FileIdFullDirectoryInformation)
87
87
  create_response = open_directory(directory: directory)
88
+ opened_directory = RubySMB::SMB2::File.new(tree: self, response: create_response, name: directory)
88
89
  file_id = create_response.file_id
89
90
 
90
91
  directory_request = RubySMB::SMB2::Packet::QueryDirectoryRequest.new
@@ -127,8 +128,9 @@ module RubySMB
127
128
  # Reset the message id so the client can update appropriately.
128
129
  directory_request.smb2_header.message_id = 0
129
130
  end
130
-
131
131
  files
132
+ ensure
133
+ opened_directory.close if opened_directory
132
134
  end
133
135
 
134
136
  # 'Opens' a directory file on the remote end, using a CreateRequest. This
@@ -1,3 +1,3 @@
1
1
  module RubySMB
2
- VERSION = '3.2.8'.freeze
2
+ VERSION = '3.3.0'.freeze
3
3
  end
@@ -131,7 +131,7 @@ RSpec.describe RubySMB::Dcerpc::Response do
131
131
  end
132
132
 
133
133
  describe '#stub_length' do
134
- let(:stub_length) { rand(0xFF) }
134
+ let(:stub_length) { rand(1..0xFF) }
135
135
  before :example do
136
136
  packet.stub = 'A' * stub_length
137
137
  end
@@ -142,7 +142,7 @@ RSpec.describe RubySMB::Dcerpc::Response do
142
142
 
143
143
  context 'with auth verifier' do
144
144
  it 'returns the correct stub length' do
145
- auth_size = rand(0xFF)
145
+ auth_size = rand(1..0xFF)
146
146
  packet.pdu_header.auth_length = auth_size
147
147
  packet.auth_value = 'B' * auth_size
148
148
  expect(packet.stub_length).to eq(stub_length + packet.auth_pad.num_bytes)
@@ -152,8 +152,8 @@ RSpec.describe RubySMB::Dcerpc::Response do
152
152
 
153
153
  describe '#read' do
154
154
  let(:response) { described_class.new }
155
- let(:auth_size) { rand(0xFF) }
156
- let(:stub_size) { rand(0xFF) }
155
+ let(:auth_size) { rand(1..0xFF) }
156
+ let(:stub_size) { rand(1..0xFF) }
157
157
  before :example do
158
158
  response.pdu_header.auth_length = auth_size
159
159
  response.stub = 'A' * stub_size
@@ -176,5 +176,3 @@ RSpec.describe RubySMB::Dcerpc::Response do
176
176
  expect(described_class.read(binary)).to eq(packet)
177
177
  end
178
178
  end
179
-
180
-
@@ -166,10 +166,14 @@ RSpec.describe RubySMB::SMB2::Tree do
166
166
  let(:create_res) { double('create response') }
167
167
  let(:query_dir_req) { RubySMB::SMB2::Packet::QueryDirectoryRequest.new }
168
168
  let(:query_dir_res) { RubySMB::SMB2::Packet::QueryDirectoryResponse.new }
169
+ let(:open_dir) { instance_double(RubySMB::SMB2::File) }
169
170
 
170
171
  before :example do
171
172
  allow(tree).to receive(:open_directory).and_return(create_res)
172
173
  allow(create_res).to receive(:file_id)
174
+ allow(RubySMB::SMB2::File).to receive(:new).and_return(open_dir)
175
+ allow(open_dir).to receive(:close)
176
+ allow(create_res).to receive(:file_attributes)
173
177
  allow(RubySMB::SMB2::Packet::QueryDirectoryRequest).to receive(:new).and_return(query_dir_req)
174
178
  allow(client).to receive(:send_recv)
175
179
  allow(RubySMB::SMB2::Packet::QueryDirectoryResponse).to receive(:read).and_return(query_dir_res)
@@ -180,6 +184,7 @@ RSpec.describe RubySMB::SMB2::Tree do
180
184
  dir = '/dir'
181
185
  expect(tree).to receive(:open_directory).with(directory: dir).and_return(create_res)
182
186
  tree.list(directory: dir)
187
+ expect(open_dir).to have_received(:close)
183
188
  end
184
189
 
185
190
  it 'uses the File ID from the create response' do
data.tar.gz.sig CHANGED
Binary file
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: 3.2.8
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
@@ -38,7 +38,7 @@ cert_chain:
38
38
  DgscAao7wB3xW2BWEp1KnaDWkf1x9ttgoBEYyuYwU7uatB67kBQG1PKvLt79wHvz
39
39
  Dxs+KOjGbBRfMnPgVGYkORKVrZIwlaboHbDKxcVW5xv+oZc7KYXWGg==
40
40
  -----END CERTIFICATE-----
41
- date: 2023-11-13 00:00:00.000000000 Z
41
+ date: 2023-12-11 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: redcarpet
metadata.gz.sig CHANGED
Binary file