ruby_smb 3.2.1 → 3.2.2

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: 7b1e12b49f282f15459e21c5f16c6a6fc0f1074b107b97d85395d75a8531df1c
4
- data.tar.gz: bccbfe2ef2823c390974786165e822eaa2fb7d1e1a96e8171daabbe871c6b324
3
+ metadata.gz: 20c59ae356835caa5149193af377ecb8aaf5f1e635f34d8f660d9da1df6a94d5
4
+ data.tar.gz: dbb749afb04c0a9909af9667e0b602ebf43cf00770a7a1d2a4df0e0a520db897
5
5
  SHA512:
6
- metadata.gz: fc4ba500076138ce97e1dc369733675600c4892669d9b5db815b4d09c1dc1b47efd0068da6cb7530fafdcdfc326d00b42b91937e44ed5fe2fdb9b4e5b37ffd9a
7
- data.tar.gz: b851e6cc8f2846b7b6f7c36b01b14adb089c5d75257315940a282793bb62cce5bdf1f944c7ca3c95f75464914e26753f4ce1577ac446deea2c42c5a84986f82e
6
+ metadata.gz: 0d826659151d98a13517cb5026dde99852ec2feaaeb6af17559782c2147026ae8cebc5ba0c19a576fb4e87e1c0950e33a3f9c9026fe8752d6503fe263796fdaf
7
+ data.tar.gz: 057f902a9540bdf4b312ec3000441fcdba9a930021a15ca12935c2b486647edae85475991c0837876e1f3b365d9c791aeecb11533970f9a63e4d9df6fe13d48a
checksums.yaml.gz.sig CHANGED
Binary file
@@ -33,15 +33,16 @@ jobs:
33
33
  fail-fast: true
34
34
  matrix:
35
35
  ruby:
36
- - 2.7
37
- - 3.0
38
- - 3.1
36
+ - '2.7'
37
+ - '3.0'
38
+ - '3.1'
39
+ - '3.2'
39
40
  os:
40
41
  - ubuntu-20.04
41
42
  - ubuntu-latest
42
43
  exclude:
43
- - { os: ubuntu-latest, ruby: 2.7 }
44
- - { os: ubuntu-latest, ruby: 3.0 }
44
+ - { os: ubuntu-latest, ruby: '2.7' }
45
+ - { os: ubuntu-latest, ruby: '3.0' }
45
46
  test_cmd:
46
47
  - bundle exec rspec
47
48
 
data/README.md CHANGED
@@ -184,6 +184,7 @@ Example:
184
184
  2.3.3 :013 > packet.to_binary_s
185
185
  => "\xFFSMB+\x00\x00\x00\x00\x98\x01`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00"
186
186
  ```
187
+
187
188
  ### Using the Client
188
189
 
189
190
  Sitting on top of the packet layer in RubySMB is the RubySMB::Client class. This is the abstraction that most users of RubySMB will interact with. It provides simple convenience methods for performing SMB actions. It handles the creation, sending and receiving of packets for the user, providing reasonable defaults in many cases.
@@ -51,6 +51,7 @@ module RubySMB
51
51
  end
52
52
 
53
53
  ret = {
54
+ certificate: nil,
54
55
  disposition: cert_server_request_response.pdw_disposition.value,
55
56
  disposition_message: cert_server_request_response.pctb_disposition_message.buffer.chomp("\x00\x00").force_encoding('utf-16le').encode,
56
57
  status: {
@@ -72,7 +73,7 @@ module RubySMB
72
73
  status_code: status_code
73
74
  )
74
75
  end
75
- else
76
+ elsif !cert_server_request_response.pctb_encoded_cert.buffer.empty?
76
77
  ret[:certificate] = OpenSSL::X509::Certificate.new(cert_server_request_response.pctb_encoded_cert.buffer)
77
78
  end
78
79
 
@@ -24,7 +24,7 @@ module RubySMB
24
24
  end
25
25
 
26
26
  # @param host [String] passed to TCPSocket.new
27
- # @param port [Fixnum] passed to TCPSocket.new
27
+ # @param port [Integer] passed to TCPSocket.new
28
28
  def self.connect(host, port: 445, socket: TCPSocket.new(host, port))
29
29
  new(socket)
30
30
  end
@@ -18,12 +18,12 @@ module RubySMB
18
18
  val
19
19
  end
20
20
 
21
- # Sets the value of the field from a DateTime,Time,Fixnum, or object
21
+ # Sets the value of the field from a DateTime,Time,Integer, or object
22
22
  # that can be converted to an integer. Datetime and Time objects get
23
23
  # converted to account for the Windows/Unix Epoch difference. Any other
24
24
  # parameter passed in will be assumed to already be correct.
25
25
  #
26
- # @param value [DateTime,Time,Fixnum,#to_i] the value to set
26
+ # @param value [DateTime,Time,Integer,#to_i] the value to set
27
27
  # @return
28
28
  def set(value)
29
29
  case value
@@ -16,11 +16,11 @@ module RubySMB
16
16
  val
17
17
  end
18
18
 
19
- # Sets the value of the field from a DateTime,Time,Fixnum, or object
19
+ # Sets the value of the field from a DateTime,Time,Integer, or object
20
20
  # that can be converted to an integer. Any other
21
21
  # parameter passed in will be assumed to already be correct.
22
22
  #
23
- # @param value [DateTime,Time,Fixnum,#to_i] the value to set
23
+ # @param value [DateTime,Time,Integer,#to_i] the value to set
24
24
  # @return
25
25
  def set(value)
26
26
  case value
@@ -129,7 +129,7 @@ module RubySMB
129
129
  # string representation.
130
130
  #
131
131
  # @param field [Hash] the hash representing the field
132
- # @param depth [Fixnum] the recursive depth level to track indentation
132
+ # @param depth [Integer] the recursive depth level to track indentation
133
133
  # @return [String] the formatted string representation of the field
134
134
  def self.format_field(field, depth = 0)
135
135
  name = field[:name].to_s
@@ -181,7 +181,7 @@ module RubySMB
181
181
  # into a string representing the contents of that field.
182
182
  #
183
183
  # @param field [Hash] hash representation of the field to display
184
- # @param depth [Fixnum] the recursion depth for setting indent levels
184
+ # @param depth [Integer] the recursion depth for setting indent levels
185
185
  # @param parents [Array<Symbol>] the name of the parent field, if any, of this field
186
186
  # @return [String] a formatted string representing the field and it's current contents
187
187
  def display_field(field, depth = 0, parents = [])
@@ -11,7 +11,7 @@ module RubySMB
11
11
  # Class method to stub byte count calculation during
12
12
  # lazy evaluation.
13
13
  #
14
- # @return [Fixnum] will always return 0
14
+ # @return [Integer] will always return 0
15
15
  def self.calculate_byte_count
16
16
  0
17
17
  end
@@ -28,7 +28,7 @@ module RubySMB
28
28
  # Calculates the size of the other fields in the DataBlock
29
29
  # in Bytes.
30
30
  #
31
- # @return [Fixnum] The size of the DataBlock in Words
31
+ # @return [Integer] The size of the DataBlock in Words
32
32
  def calculate_byte_count
33
33
  total_count = 0
34
34
  self.class.data_fields.each do |field_name|
@@ -11,7 +11,7 @@ module RubySMB
11
11
  # Class method to stub word count calculation during
12
12
  # lazy evaluation.
13
13
  #
14
- # @param [Fixnum] will always return 0
14
+ # @param [Integer] will always return 0
15
15
  def self.calculate_word_count
16
16
  0
17
17
  end
@@ -28,7 +28,7 @@ module RubySMB
28
28
  # Calculates the size of the other fields in the ParameterBlock
29
29
  # in Words.
30
30
  #
31
- # @return [Fixnum] The size of the ParameterBlock in Words
31
+ # @return [Integer] The size of the ParameterBlock in Words
32
32
  def calculate_word_count
33
33
  total_count = 0
34
34
  self.class.parameter_fields.each do |field_name|
@@ -28,8 +28,8 @@ module RubySMB
28
28
 
29
29
  # Adds a dialect to the Dialects array
30
30
  #
31
- # @param [Fixnum] the numeric code for the dialect you wish to add
32
- # @return [Array<Fixnum>] the array of all currently selected dialects
31
+ # @param [Integer] the numeric code for the dialect you wish to add
32
+ # @return [Array<Integer>] the array of all currently selected dialects
33
33
  # @raise [ArgumentError] if the dialect is not an Integer
34
34
  def add_dialect(dialect)
35
35
  raise ArgumentError, 'Must be a number' unless dialect.is_a? Integer
@@ -40,8 +40,8 @@ module RubySMB
40
40
  # the dialect_count field appropriately. Will erase any previously set
41
41
  # dialects.
42
42
  #
43
- # @param [Array<Fixnum>] the array of dialects to set
44
- # @return [Array<Fixnum>] the current value of the dialects array
43
+ # @param [Array<Integer>] the array of dialects to set
44
+ # @return [Array<Integer>] the current value of the dialects array
45
45
  def set_dialects(add_dialects = [])
46
46
  self.dialects = []
47
47
  add_dialects.each do |dialect|
@@ -53,7 +53,7 @@ module RubySMB
53
53
  # Adds a Negotiate Context to the #negotiate_context_list
54
54
  #
55
55
  # @param [NegotiateContext] the Negotiate Context structure you wish to add
56
- # @return [Array<Fixnum>] the array of all currently added Negotiate Contexts
56
+ # @return [Array<Integer>] the array of all currently added Negotiate Contexts
57
57
  # @raise [ArgumentError] if the dialect is not a NegotiateContext structure
58
58
  def add_negotiate_context(nc)
59
59
  raise ArgumentError, 'Must be a NegotiateContext' unless nc.is_a? NegotiateContext
@@ -48,7 +48,7 @@ module RubySMB
48
48
  # Adds a Negotiate Context to the #negotiate_context_list
49
49
  #
50
50
  # @param [NegotiateContext] the Negotiate Context structure you wish to add
51
- # @return [Array<Fixnum>] the array of all currently added Negotiate Contexts
51
+ # @return [Array<Integer>] the array of all currently added Negotiate Contexts
52
52
  # @raise [ArgumentError] if the dialect is not a NegotiateContext structure
53
53
  def add_negotiate_context(nc)
54
54
  raise ArgumentError, 'Must be a NegotiateContext' unless nc.is_a? NegotiateContext
@@ -1,3 +1,3 @@
1
1
  module RubySMB
2
- VERSION = '3.2.1'.freeze
2
+ VERSION = '3.2.2'.freeze
3
3
  end
@@ -2701,7 +2701,7 @@ RSpec.describe RubySMB::Client do
2701
2701
  session_key,
2702
2702
  "SMB2AESCCM\x00",
2703
2703
  "ServerIn \x00",
2704
- {length: 128}
2704
+ length: 128
2705
2705
  ).and_call_original
2706
2706
  client.smb3_encrypt(data)
2707
2707
  end
@@ -2717,7 +2717,7 @@ RSpec.describe RubySMB::Client do
2717
2717
  session_key,
2718
2718
  "SMBC2SCipherKey\x00",
2719
2719
  '',
2720
- {length: 128}
2720
+ length: 128
2721
2721
  ).and_call_original
2722
2722
  client.smb3_encrypt(data)
2723
2723
  end
@@ -2791,7 +2791,7 @@ RSpec.describe RubySMB::Client do
2791
2791
  session_key,
2792
2792
  "SMB2AESCCM\x00",
2793
2793
  "ServerOut\x00",
2794
- {length: 128}
2794
+ length: 128
2795
2795
  ).and_call_original
2796
2796
  client.smb3_decrypt(transform_packet)
2797
2797
  end
@@ -2807,7 +2807,7 @@ RSpec.describe RubySMB::Client do
2807
2807
  session_key,
2808
2808
  "SMBS2CCipherKey\x00",
2809
2809
  '',
2810
- {length: 128}
2810
+ length: 128
2811
2811
  ).and_call_original
2812
2812
  client.smb3_decrypt(transform_packet)
2813
2813
  end
@@ -631,7 +631,7 @@ RSpec.describe RubySMB::Dcerpc::Winreg do
631
631
 
632
632
  it 'calls #enum_key the expected number of times' do
633
633
  winreg.enum_registry_key(key)
634
- expect(winreg).to have_received(:enum_key).with(subkey_handle, instance_of(Fixnum)).twice
634
+ expect(winreg).to have_received(:enum_key).with(subkey_handle, instance_of(Integer)).twice
635
635
  end
636
636
 
637
637
  it 'closes the key' do
@@ -710,7 +710,7 @@ RSpec.describe RubySMB::Dcerpc::Winreg do
710
710
 
711
711
  it 'calls #enum_key the expected number of times' do
712
712
  winreg.enum_registry_values(key)
713
- expect(winreg).to have_received(:enum_value).with(subkey_handle, instance_of(Fixnum)).twice
713
+ expect(winreg).to have_received(:enum_value).with(subkey_handle, instance_of(Integer)).twice
714
714
  end
715
715
 
716
716
  it 'closes the key' do
@@ -112,7 +112,7 @@ RSpec.describe RubySMB::SMB1::Packet::ReadAndxRequest do
112
112
  expect { packet.set_read_from_named_pipe('true') }.to raise_error(ArgumentError)
113
113
  end
114
114
 
115
- it 'raises an exception when the value is a Numeric' do
115
+ it 'raises an exception when the value is a Integer' do
116
116
  expect { packet.set_read_from_named_pipe(1) }.to raise_error(ArgumentError)
117
117
  end
118
118
 
@@ -138,7 +138,7 @@ RSpec.describe RubySMB::SMB1::Packet::ReadAndxRequest do
138
138
  expect { packet.set_64_bit_offset('true') }.to raise_error(ArgumentError)
139
139
  end
140
140
 
141
- it 'raises an exception when the value is a Numeric' do
141
+ it 'raises an exception when the value is a Integer' do
142
142
  expect { packet.set_64_bit_offset(1) }.to raise_error(ArgumentError)
143
143
  end
144
144
 
@@ -137,7 +137,7 @@ RSpec.describe RubySMB::SMB1::Packet::WriteAndxRequest do
137
137
  expect { packet.set_64_bit_offset('true') }.to raise_error(ArgumentError)
138
138
  end
139
139
 
140
- it 'raises an exception when the value is a Numeric' do
140
+ it 'raises an exception when the value is a Integer' do
141
141
  expect { packet.set_64_bit_offset(1) }.to raise_error(ArgumentError)
142
142
  end
143
143
 
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.1
4
+ version: 3.2.2
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-11-17 00:00:00.000000000 Z
100
+ date: 2023-01-18 00:00:00.000000000 Z
101
101
  dependencies:
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: redcarpet
@@ -1001,8 +1001,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1001
1001
  - !ruby/object:Gem::Version
1002
1002
  version: '0'
1003
1003
  requirements: []
1004
- rubyforge_project:
1005
- rubygems_version: 2.7.10
1004
+ rubygems_version: 3.3.26
1006
1005
  signing_key:
1007
1006
  specification_version: 4
1008
1007
  summary: A pure Ruby implementation of the SMB Protocol Family
metadata.gz.sig CHANGED
Binary file