ruby_smb 3.0.4 → 3.0.5

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: a5143b8e8c62f4e51a00da4db3379ee8060a6f650bc91c0b5476f7587df3a513
4
- data.tar.gz: 5005cf21af243f8925ddd7fc221b39589ec036df3b57a03af8e26a29cf8bf03a
3
+ metadata.gz: 3a4881649381520e25f5f014f66baac4130dd8a58d4eadd3476198fec3fc9e8d
4
+ data.tar.gz: 809b581025c19ab7ca1162a7b73d342d63b24edd77835744191a0d7c930425fd
5
5
  SHA512:
6
- metadata.gz: a69b666d6a0199e0efa5df505ef03c312a9701cec10cc0774b4bed4e006c2c63ff461c1a0472060191dea0737ed483229bd7e78057f950d40c81fa02a5754683
7
- data.tar.gz: cb87a7b4cef92975dac1ddc4e9edc72e170b6066a30f2cd9c321ef0f3e25557eae862dd2fe46b147a1ecd8c192ee81782f024858625e0a064c9ab9156084b715
6
+ metadata.gz: 4e340189b0ae87ec98e7ca6bde9d4c30c1eb3a0d3e1f69383869e4803bf3d3d9bbc502cef143a83bad9f91dc1de10ca3bcd4132a8d518a1bb2121a7d4490309d
7
+ data.tar.gz: 0c7198d84416da8b995e50c17f7826abba21affa03cc1c2404e2e2ecaac1322178f76c356d8d026c4a75b7e9d356bd134f1a0df12fe327eca1240b87afaeee0d
checksums.yaml.gz.sig CHANGED
Binary file
@@ -251,7 +251,7 @@ module RubySMB
251
251
  raise ArgumentError, 'Must be an array of strings' unless dialect.is_a? String
252
252
  packet.add_dialect(dialect.to_i(16))
253
253
  end
254
- packet.capabilities.encryption = 1
254
+ packet.capabilities.encryption = @session_encrypt_data ? 1 : 0
255
255
 
256
256
  if packet.dialects.include?(0x0311)
257
257
  nc = RubySMB::SMB2::NegotiateContext.new(
@@ -29,10 +29,26 @@ module RubySMB
29
29
  # It indicates that the server implements SMB 2.1 or future dialect revisions
30
30
  # Note that this must be used for SMB3
31
31
  SMB1_DIALECT_SMB2_WILDCARD = 'SMB 2.???'.freeze
32
+
33
+ SMB2_DIALECT_0202 = '0x0202'.freeze
34
+ SMB2_DIALECT_0210 = '0x0210'.freeze
35
+ SMB2_DIALECT_0300 = '0x0300'.freeze
36
+ SMB2_DIALECT_0302 = '0x0302'.freeze
37
+ SMB2_DIALECT_0311 = '0x0311'.freeze
38
+
32
39
  # Dialect values for SMB2
33
- SMB2_DIALECT_DEFAULT = ['0x0202', '0x0210']
40
+ SMB2_DIALECT_DEFAULT = [
41
+ SMB2_DIALECT_0202,
42
+ SMB2_DIALECT_0210,
43
+ ].freeze
44
+
34
45
  # Dialect values for SMB3
35
- SMB3_DIALECT_DEFAULT = ['0x0300', '0x0302', '0x0311']
46
+ SMB3_DIALECT_DEFAULT = [
47
+ SMB2_DIALECT_0300,
48
+ SMB2_DIALECT_0302,
49
+ SMB2_DIALECT_0311
50
+ ].freeze
51
+
36
52
  # The default maximum size of a SMB message that the Client accepts (in bytes)
37
53
  MAX_BUFFER_SIZE = 64512
38
54
  # The default maximum size of a SMB message that the Server accepts (in bytes)
@@ -13,6 +13,7 @@ module RubySMB
13
13
  @user_id = user_id
14
14
  @state = state
15
15
  @signing_required = false
16
+ @metadata = {}
16
17
  # tree id => provider processor instance
17
18
  @tree_connect_table = {}
18
19
  @creation_time = Time.now
@@ -62,6 +63,11 @@ module RubySMB
62
63
  # @return [Hash]
63
64
  attr_accessor :tree_connect_table
64
65
 
66
+ # Untyped hash for storing additional arbitrary metadata about the current session
67
+ # @!attribute [rw] metadaa
68
+ # @return [Hash]
69
+ attr_accessor :metadata
70
+
65
71
  # The time at which this session was created.
66
72
  # @!attribute [r] creation_time
67
73
  # @return [Time]
@@ -18,6 +18,17 @@ module RubySMB
18
18
  uint64 :previous_session_id, label: 'Previous Session ID'
19
19
  string :buffer, label: 'Security Buffer', length: -> { security_buffer_length }
20
20
 
21
+ # Takes the specified security buffer string and inserts it into the {RubySMB::SMB2::Packet::SessionSetupRequest#buffer}
22
+ # as well as updating the {RubySMB::SMB2::Packet::SessionSetupRequest#security_buffer_length}
23
+ # This method DOES NOT wrap the security buffer in any way.
24
+ #
25
+ # @param buffer [String] the security buffer
26
+ # @return [void]
27
+ def set_security_buffer(buffer)
28
+ self.security_buffer_length = buffer.length
29
+ self.buffer = buffer
30
+ end
31
+
21
32
  # Takes a serialized NTLM Type 1 message and wraps it in the GSS ASN1 encoding
22
33
  # and inserts it into the {RubySMB::SMB2::Packet::SessionSetupRequest#buffer}
23
34
  # as well as updating the {RubySMB::SMB2::Packet::SessionSetupRequest#security_buffer_length}
@@ -1,3 +1,3 @@
1
1
  module RubySMB
2
- VERSION = '3.0.4'.freeze
2
+ VERSION = '3.0.5'.freeze
3
3
  end
@@ -118,6 +118,11 @@ RSpec.describe RubySMB::SMB1::Tree do
118
118
  end
119
119
  tree.open_file(filename: unicode_filename.chop)
120
120
  end
121
+
122
+ it 'removes the leading \\ from the filename if needed' do
123
+ expect(tree).to receive(:_open).with(filename: filename)
124
+ tree.open_file(filename: '\\' + filename)
125
+ end
121
126
  end
122
127
 
123
128
  describe 'flags' do
@@ -348,6 +348,11 @@ RSpec.describe RubySMB::SMB2::Tree do
348
348
  end
349
349
  tree.open_file(filename: filename)
350
350
  end
351
+
352
+ it 'removes the leading \\ from the filename if needed' do
353
+ expect(tree).to receive(:_open).with(filename: filename)
354
+ tree.open_file(filename: "\\".encode('UTF-16LE') + filename)
355
+ end
351
356
  end
352
357
 
353
358
  describe 'attributes' do
@@ -544,7 +549,7 @@ RSpec.describe RubySMB::SMB2::Tree do
544
549
  tree.open_pipe(**opts)
545
550
  end
546
551
 
547
- it 'remove the leading \\ from the filename if needed' do
552
+ it 'removes the leading \\ from the filename if needed' do
548
553
  expect(tree).to receive(:_open).with(filename: 'test', write: true)
549
554
  tree.open_pipe(**opts)
550
555
  end
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.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
@@ -97,7 +97,7 @@ cert_chain:
97
97
  EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
98
98
  9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
99
99
  -----END CERTIFICATE-----
100
- date: 2022-02-15 00:00:00.000000000 Z
100
+ date: 2022-03-01 00:00:00.000000000 Z
101
101
  dependencies:
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: redcarpet
metadata.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- 5Ф\y�Q.�n��g�Ho�{F �Y����E��g99�)��.�i~0-�1휡�Sθ�� ��Q��P
2
- ��X.���&�k��na����k���&SP
1
+ �F�K��Y3]*����$��')rp2��Uxj�z �N�D
2
+ ��(wT���B���J#߽dü�F�Q�nA�39B5�s�� ���<�Iy�{#���(� )��Q���2O0��`����@���(뿅���Zw�^�L��;:�h�0m���a7Щ�c9$\m��:{}�� !)V.���t�� g6^S���.˃?!c5n��5��%���s=WD���x�ۘ� k�_���HnMm�%'�Z�R��@���