ruby_smb 3.2.8 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - checksums.yaml.gz.sig +0 -0
 - data/lib/ruby_smb/smb2/tree.rb +3 -1
 - data/lib/ruby_smb/version.rb +1 -1
 - data/spec/lib/ruby_smb/dcerpc/response_spec.rb +4 -6
 - data/spec/lib/ruby_smb/smb2/tree_spec.rb +5 -0
 - data.tar.gz.sig +0 -0
 - metadata +2 -2
 - metadata.gz.sig +0 -0
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 2f696c845250348795f67d3d5b163c65b432acdbcd01bc86d0a6cd81ddcbfc67
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b43dcb4fa6ff4497e61329b8b5a17049a6b445fcdf5c3df61dc380960ea02b9c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 8368cf1844e47161a57051d7b8dfa807b665c898153636b1baedb2211acd4685ef67c5ba167581ce84a9ec7c8c17e812d1f876bb70f34b647bb075bb94861349
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 3b33a185fb3b981147b005e13793aa1f8a09e11c2e5e0dc9b75469ef980ec019bc2dd5e9bef187910f9b5be012d7ca710799b45aa0bdf79547ae3d48de8e22e7
         
     | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | 
         Binary file 
     | 
    
        data/lib/ruby_smb/smb2/tree.rb
    CHANGED
    
    | 
         @@ -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
         
     | 
    
        data/lib/ruby_smb/version.rb
    CHANGED
    
    
| 
         @@ -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. 
     | 
| 
      
 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 
     | 
| 
      
 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 
     |