ruby_smb 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/ruby_smb/client/echo.rb +1 -1
- data/lib/ruby_smb/field/file_full_ea_info.rb +2 -2
- data/lib/ruby_smb/field/security_descriptor.rb +4 -4
- data/lib/ruby_smb/field/smb_fea.rb +2 -2
- data/lib/ruby_smb/field/smb_fea_list.rb +1 -1
- data/lib/ruby_smb/smb1/bit_field/header_flags2.rb +1 -1
- data/lib/ruby_smb/smb1/data_block.rb +1 -1
- data/lib/ruby_smb/smb1/packet/nt_trans/create_request.rb +2 -2
- data/lib/ruby_smb/smb1/packet/nt_trans/request.rb +5 -5
- data/lib/ruby_smb/smb1/packet/nt_trans/response.rb +5 -5
- data/lib/ruby_smb/smb1/packet/session_setup_legacy_request.rb +2 -2
- data/lib/ruby_smb/smb1/packet/session_setup_request.rb +2 -2
- data/lib/ruby_smb/smb1/packet/trans2/data_block.rb +24 -6
- data/lib/ruby_smb/smb1/packet/trans2/open2_request.rb +1 -1
- data/lib/ruby_smb/smb1/packet/trans2/request.rb +8 -8
- data/lib/ruby_smb/smb1/packet/trans2/request_secondary.rb +4 -4
- data/lib/ruby_smb/smb1/packet/trans2/response.rb +7 -7
- data/lib/ruby_smb/smb1/parameter_block.rb +1 -1
- data/lib/ruby_smb/smb1/smb_header.rb +3 -3
- data/lib/ruby_smb/smb2/bit_field/session_flags.rb +2 -2
- data/lib/ruby_smb/smb2/bit_field/smb2_header_flags.rb +4 -4
- data/lib/ruby_smb/smb2/packet/negotiate_response.rb +1 -1
- data/lib/ruby_smb/smb2/packet/tree_connect_request.rb +1 -1
- data/lib/ruby_smb/version.rb +1 -1
- data/spec/lib/ruby_smb/client_spec.rb +1 -1
- data/spec/lib/ruby_smb/smb1/smb_header_spec.rb +3 -3
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d2fbdf3236d278f2f5aa3aaab501f54af77825a
|
4
|
+
data.tar.gz: 343846b15a2d19332d87f1d15e87285f922dea23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a413b93e68d6ba6b1c17e8f78d815265757c173a6420fcc6a1faab6871f7bd7d009b65a1304439cf7463ee088bc903c1ac8262bfbd84ea6010a025e6658369d
|
7
|
+
data.tar.gz: f8de75f184d0242dd36f0cec9fb0f0c23778eceba43ff5e91f06501d610380eb8f50ca3debcf495093ce6ea6e724c4c916338944e4f9a66fc389b2d57c1868d9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/ruby_smb/client/echo.rb
CHANGED
@@ -11,7 +11,7 @@ module RubySMB
|
|
11
11
|
# @param data [String] the data the server should echo back (ignored in SMB2)
|
12
12
|
# @return [RubySMB::SMB1::Packet::EchoResponse] the last Echo Response packet received
|
13
13
|
def smb1_echo(count: 1, data: '')
|
14
|
-
request = RubySMB::
|
14
|
+
request = RubySMB::SMB1::Packet::EchoRequest.new
|
15
15
|
request.parameter_block.echo_count = count
|
16
16
|
request.data_block.data = data
|
17
17
|
raw_response = send_recv(request)
|
@@ -6,8 +6,8 @@ module RubySMB
|
|
6
6
|
endian :little
|
7
7
|
uint32 :next_entry_offset, label: 'Next Entry Offset'
|
8
8
|
extended_attribute_flag :flags
|
9
|
-
uint8 :ea_name_length, label: 'EA Name Length',
|
10
|
-
uint8 :ea_value_length, label: 'EA Value Length',
|
9
|
+
uint8 :ea_name_length, label: 'EA Name Length', initial_value: lambda { ea_name.do_num_bytes }
|
10
|
+
uint8 :ea_value_length, label: 'EA Value Length', initial_value: lambda { ea_value.do_num_bytes }
|
11
11
|
string :ea_name, label: 'EA Name'
|
12
12
|
string :ea_value, label: 'EA Value'
|
13
13
|
end
|
@@ -28,10 +28,10 @@ module RubySMB
|
|
28
28
|
bit1 :dacl_trusted, label: 'DACL Trusted'
|
29
29
|
end
|
30
30
|
|
31
|
-
uint32 :offset_owner, label: 'Offset Owner',
|
32
|
-
uint32 :offset_group, label: 'Offset Group',
|
33
|
-
uint32 :offset_sacl, label: 'Offset SACL',
|
34
|
-
uint32 :offset_dacl, label: 'Offset DACL',
|
31
|
+
uint32 :offset_owner, label: 'Offset Owner', initial_value: lambda { owner_sid.rel_offset }
|
32
|
+
uint32 :offset_group, label: 'Offset Group', initial_value: lambda { group_sid.rel_offset }
|
33
|
+
uint32 :offset_sacl, label: 'Offset SACL', initial_value: lambda { sacl.rel_offset }
|
34
|
+
uint32 :offset_dacl, label: 'Offset DACL', initial_value: lambda { dacl.rel_offset }
|
35
35
|
|
36
36
|
string :owner_sid, label: 'Owner SID'
|
37
37
|
string :group_sid, label: 'Group SID'
|
@@ -5,8 +5,8 @@ module RubySMB
|
|
5
5
|
class SmbFea < BinData::Record
|
6
6
|
endian :little
|
7
7
|
extended_attribute_flag :ea_flag, label: 'Extended Attribute Flag'
|
8
|
-
uint8 :attribute_name_length, label: 'Attribute Name Length',
|
9
|
-
uint16 :attribute_value_length, label: 'Attribute Value Length',
|
8
|
+
uint8 :attribute_name_length, label: 'Attribute Name Length', initial_value: lambda { attribute_name.length}
|
9
|
+
uint16 :attribute_value_length, label: 'Attribute Value Length', initial_value: lambda { attribute_value.length}
|
10
10
|
string :attribute_name, label: 'Attribute Name'
|
11
11
|
string :attribute_value, label: 'Attribute Value'
|
12
12
|
end
|
@@ -4,7 +4,7 @@ module RubySMB
|
|
4
4
|
# [2.2.1.2.2.1 SMB_FEA_LIST](https://msdn.microsoft.com/en-us/library/ff359296.aspx)
|
5
5
|
class SmbFeaList < BinData::Record
|
6
6
|
endian :little
|
7
|
-
uint32 :size_of_list, label: 'Size of List in Bytes',
|
7
|
+
uint32 :size_of_list, label: 'Size of List in Bytes', initial_value: lambda { fea_list.do_num_bytes }
|
8
8
|
array :fea_list, initial_length: 0 do
|
9
9
|
smb_fea
|
10
10
|
end
|
@@ -18,7 +18,7 @@ module RubySMB
|
|
18
18
|
bit1 :nt_status, label: 'NTStatus Errors', initial_value: 1
|
19
19
|
bit1 :paging_io, label: 'Read if Execute', initial_value: 1
|
20
20
|
bit1 :dfs, label: 'Use DFS'
|
21
|
-
bit1 :extended_security, label: 'Extended Security'
|
21
|
+
bit1 :extended_security, label: 'Extended Security'
|
22
22
|
bit1 :reparse_path, label: '@GMT Token Required'
|
23
23
|
resume_byte_alignment
|
24
24
|
end
|
@@ -6,7 +6,7 @@ module RubySMB
|
|
6
6
|
class DataBlock < BinData::Record
|
7
7
|
endian :little
|
8
8
|
|
9
|
-
uint16 :byte_count, label: 'Byte Count',
|
9
|
+
uint16 :byte_count, label: 'Byte Count', initial_value: -> { calculate_byte_count }
|
10
10
|
|
11
11
|
# Class method to stub byte count calculation during
|
12
12
|
# lazy evaluation.
|
@@ -32,8 +32,8 @@ module RubySMB
|
|
32
32
|
share_access :share_access, label: 'Share Access'
|
33
33
|
uint32 :create_disposition, label: 'Create Disposition'
|
34
34
|
create_options :create_options
|
35
|
-
uint32 :security_descriptor_length, label: 'Security Descriptor Length',
|
36
|
-
uint32 :ea_length, label: 'Extended Attributes Length',
|
35
|
+
uint32 :security_descriptor_length, label: 'Security Descriptor Length', initial_value: lambda { self.parent.trans2_data.security_descriptor.length }
|
36
|
+
uint32 :ea_length, label: 'Extended Attributes Length', initial_value: lambda { self.parent.trans2_data.extended_attributes.length }
|
37
37
|
uint32 :impersonation_level, label: 'Impersonation Level'
|
38
38
|
|
39
39
|
struct :security_flags do
|
@@ -15,11 +15,11 @@ module RubySMB
|
|
15
15
|
uint32 :total_data_count, label: 'Total Data Count(bytes)'
|
16
16
|
uint32 :max_parameter_count, label: 'Max Parameter Count(bytes)'
|
17
17
|
uint32 :max_data_count, label: 'Max Data Count(bytes)'
|
18
|
-
uint32 :parameter_count, label: 'Parameter Count(bytes)',
|
19
|
-
uint32 :parameter_offset, label: 'Parameter Offset',
|
20
|
-
uint32 :data_count, label: 'Data Count(bytes)',
|
21
|
-
uint32 :data_offset, label: 'Data Offset',
|
22
|
-
uint8 :setup_count, label: 'Setup Count',
|
18
|
+
uint32 :parameter_count, label: 'Parameter Count(bytes)', initial_value: lambda {self.parent.data_block.trans2_parameters.length}
|
19
|
+
uint32 :parameter_offset, label: 'Parameter Offset', initial_value: lambda {self.parent.data_block.trans2_parameters.abs_offset}
|
20
|
+
uint32 :data_count, label: 'Data Count(bytes)', initial_value: lambda {self.parent.data_block.trans2_data.length}
|
21
|
+
uint32 :data_offset, label: 'Data Offset', initial_value: lambda {self.parent.data_block.trans2_data.abs_offset}
|
22
|
+
uint8 :setup_count, label: 'Setup Count', initial_value: lambda {setup.length}
|
23
23
|
uint16 :function, label: 'Function'
|
24
24
|
|
25
25
|
array :setup, type: :uint16, initial_length: 0
|
@@ -14,13 +14,13 @@ module RubySMB
|
|
14
14
|
|
15
15
|
uint32 :total_parameter_count, label: 'Total Parameter Count(bytes)'
|
16
16
|
uint32 :total_data_count, label: 'Total Data Count(bytes)'
|
17
|
-
uint32 :parameter_count, label: 'Parameter Count(bytes)',
|
18
|
-
uint32 :parameter_offset, label: 'Parameter Offset',
|
17
|
+
uint32 :parameter_count, label: 'Parameter Count(bytes)', initial_value: lambda {self.parent.data_block.trans2_parameters.length}
|
18
|
+
uint32 :parameter_offset, label: 'Parameter Offset', initial_value: lambda {self.parent.data_block.trans2_parameters.abs_offset}
|
19
19
|
uint32 :parameter_displacement, label: 'Parameter Displacement'
|
20
|
-
uint32 :data_count, label: 'Data Count(bytes)',
|
21
|
-
uint32 :data_offset, label: 'Data Offset',
|
20
|
+
uint32 :data_count, label: 'Data Count(bytes)', initial_value: lambda {self.parent.data_block.trans2_data.length}
|
21
|
+
uint32 :data_offset, label: 'Data Offset', initial_value: lambda {self.parent.data_block.trans2_data.abs_offset}
|
22
22
|
uint32 :data_displacement, label: 'Data Displacement'
|
23
|
-
uint8 :setup_count, label: 'Setup Count',
|
23
|
+
uint8 :setup_count, label: 'Setup Count', initial_value: lambda {setup.length}
|
24
24
|
|
25
25
|
array :setup, type: :uint16, initial_length: 0
|
26
26
|
end
|
@@ -13,8 +13,8 @@ module RubySMB
|
|
13
13
|
uint16 :max_mpx_count, label: 'Max Mpx Count'
|
14
14
|
uint16 :vc_number, label: 'VC Number'
|
15
15
|
uint32 :session_key, label: 'Session Key'
|
16
|
-
uint16 :oem_password_length, label: 'OEM Password Length',
|
17
|
-
uint16 :unicode_password_length, label: 'Unicored Password Length',
|
16
|
+
uint16 :oem_password_length, label: 'OEM Password Length', initial_value: lambda { self.parent.data_block.oem_password.length }
|
17
|
+
uint16 :unicode_password_length, label: 'Unicored Password Length', initial_value: lambda { self.parent.data_block.unicode_password.length }
|
18
18
|
uint32 :reserved
|
19
19
|
capabilities :capabilities
|
20
20
|
end
|
@@ -24,8 +24,8 @@ module RubySMB
|
|
24
24
|
# yourself if you set them away from their defaults.
|
25
25
|
class DataBlock < RubySMB::SMB1::DataBlock
|
26
26
|
string :security_blob, label: 'Security Blob (GSS-API)', length: lambda { self.parent.parameter_block.security_blob_length }
|
27
|
-
|
28
|
-
|
27
|
+
string :native_os, label: 'Native OS', initial_value: "Windows 7 Ultimate N 7601 Service Pack 1\x00"
|
28
|
+
string :native_lan_man, label: 'Native LAN Manager', initial_value: "Windows 7 Ultimate N 6.1\x00"
|
29
29
|
end
|
30
30
|
|
31
31
|
smb_header :smb_header
|
@@ -6,24 +6,42 @@ module RubySMB
|
|
6
6
|
# Extends the {RubySMB::SMB1::DataBlock} to include padding methods
|
7
7
|
# that all Trans2 DataBlocks will need to handle proper byte alignment.
|
8
8
|
class DataBlock < RubySMB::SMB1::DataBlock
|
9
|
+
# Controls whether the padding fields will be used
|
10
|
+
# @!attribute [rw] enable_padding
|
11
|
+
# @return [Boolean]
|
12
|
+
attr_accessor :enable_padding
|
13
|
+
|
14
|
+
def initialize_instance
|
15
|
+
super
|
16
|
+
@enable_padding = true
|
17
|
+
end
|
18
|
+
|
9
19
|
private
|
10
20
|
|
11
21
|
# Determines the correct length for the padding in front of
|
12
22
|
# #trans2_parameters. It should always force a 4-byte alignment.
|
13
23
|
def pad1_length
|
14
|
-
if
|
15
|
-
|
24
|
+
if enable_padding
|
25
|
+
if self.respond_to?(:name)
|
26
|
+
offset = (name.abs_offset + 1) % 4
|
27
|
+
else
|
28
|
+
offset = (byte_count.abs_offset + 2) % 4
|
29
|
+
end
|
30
|
+
(4 - offset) % 4
|
16
31
|
else
|
17
|
-
|
32
|
+
0
|
18
33
|
end
|
19
|
-
(4 - offset) % 4
|
20
34
|
end
|
21
35
|
|
22
36
|
# Determines the correct length for the padding in front of
|
23
37
|
# #trans2_data. It should always force a 4-byte alignment.
|
24
38
|
def pad2_length
|
25
|
-
|
26
|
-
|
39
|
+
if enable_padding
|
40
|
+
offset = (trans2_parameters.abs_offset + trans2_parameters.length) % 4
|
41
|
+
(4 - offset) % 4
|
42
|
+
else
|
43
|
+
0
|
44
|
+
end
|
27
45
|
end
|
28
46
|
end
|
29
47
|
end
|
@@ -20,7 +20,7 @@ module RubySMB
|
|
20
20
|
open2_open_mode :open_mode, label: 'Open Mode'
|
21
21
|
uint32 :allocation_size, label: 'Allocation Size'
|
22
22
|
array :reserved2, initial_length: 5 do
|
23
|
-
uint16
|
23
|
+
uint16 initial_value: 0x0000
|
24
24
|
end
|
25
25
|
stringz :filename, label: 'Filename'
|
26
26
|
|
@@ -13,16 +13,16 @@ module RubySMB
|
|
13
13
|
uint16 :max_parameter_count, label: 'Max Parameter Count(bytes)'
|
14
14
|
uint16 :max_data_count, label: 'Max Data Count(bytes)'
|
15
15
|
uint8 :max_setup_count, label: 'Max Setup Count'
|
16
|
-
uint8 :reserved, label: 'Reserved Space',
|
16
|
+
uint8 :reserved, label: 'Reserved Space', initial_value: 0x00
|
17
17
|
trans2_flags :flags
|
18
18
|
uint32 :timeout, label: 'Timeout', initial_value: 0x00000000
|
19
|
-
uint16 :reserved2, label: 'Reserved Space',
|
20
|
-
uint16 :parameter_count, label: 'Parameter Count(bytes)',
|
21
|
-
uint16 :parameter_offset, label: 'Parameter Offset',
|
22
|
-
uint16 :data_count, label: 'Data Count(bytes)',
|
23
|
-
uint16 :data_offset, label: 'Data Offset',
|
24
|
-
uint8 :setup_count, label: 'Setup Count',
|
25
|
-
uint8 :reserved3, label: 'Reserved Space',
|
19
|
+
uint16 :reserved2, label: 'Reserved Space', initial_value: 0x00
|
20
|
+
uint16 :parameter_count, label: 'Parameter Count(bytes)', initial_value: lambda {self.parent.data_block.trans2_parameters.length}
|
21
|
+
uint16 :parameter_offset, label: 'Parameter Offset', initial_value: lambda {self.parent.data_block.trans2_parameters.abs_offset}
|
22
|
+
uint16 :data_count, label: 'Data Count(bytes)', initial_value: lambda {self.parent.data_block.trans2_data.length}
|
23
|
+
uint16 :data_offset, label: 'Data Offset', initial_value: lambda {self.parent.data_block.trans2_data.abs_offset}
|
24
|
+
uint8 :setup_count, label: 'Setup Count', initial_value: lambda {setup.length}
|
25
|
+
uint8 :reserved3, label: 'Reserved Space', initial_value: 0x00
|
26
26
|
|
27
27
|
array :setup, type: :uint16, initial_length: 0
|
28
28
|
end
|
@@ -10,11 +10,11 @@ module RubySMB
|
|
10
10
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
11
11
|
uint16 :total_parameter_count, label: 'Total Parameter Count(bytes)'
|
12
12
|
uint16 :total_data_count, label: 'Total Data Count(bytes)'
|
13
|
-
uint16 :parameter_count, label: 'Parameter Count(bytes)',
|
14
|
-
uint16 :parameter_offset, label: 'Parameter Offset',
|
13
|
+
uint16 :parameter_count, label: 'Parameter Count(bytes)', initial_value: lambda {self.parent.data_block.trans2_parameters.length}
|
14
|
+
uint16 :parameter_offset, label: 'Parameter Offset', initial_value: lambda {self.parent.data_block.trans2_parameters.abs_offset}
|
15
15
|
uint16 :parameter_displacement, label: 'Parameter Displacement'
|
16
|
-
uint16 :data_count, label: 'Data Count(bytes)',
|
17
|
-
uint16 :data_offset, label: 'Data Offset',
|
16
|
+
uint16 :data_count, label: 'Data Count(bytes)', initial_value: lambda {self.parent.data_block.trans2_data.length}
|
17
|
+
uint16 :data_offset, label: 'Data Offset', initial_value: lambda {self.parent.data_block.trans2_data.abs_offset}
|
18
18
|
uint16 :data_displacement, label: 'Data Displacement'
|
19
19
|
uint16 :fid, label: 'FileID'
|
20
20
|
end
|
@@ -10,15 +10,15 @@ module RubySMB
|
|
10
10
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
11
11
|
uint16 :total_parameter_count, label: 'Total Parameter Count(bytes)'
|
12
12
|
uint16 :total_data_count, label: 'Total Data Count(bytes)'
|
13
|
-
uint16 :reserved, label: 'Reserved Space',
|
14
|
-
uint16 :parameter_count, label: 'Parameter Count(bytes)',
|
15
|
-
uint16 :parameter_offset, label: 'Parameter Offset',
|
13
|
+
uint16 :reserved, label: 'Reserved Space', initial_value: 0x00
|
14
|
+
uint16 :parameter_count, label: 'Parameter Count(bytes)', initial_value: lambda {self.parent.data_block.trans2_parameters.length}
|
15
|
+
uint16 :parameter_offset, label: 'Parameter Offset', initial_value: lambda {self.parent.data_block.trans2_parameters.abs_offset}
|
16
16
|
uint16 :parameter_displacement, label: 'Parameter Displacement'
|
17
|
-
uint16 :data_count, label: 'Data Count(bytes)',
|
18
|
-
uint16 :data_offset, label: 'Data Offset',
|
17
|
+
uint16 :data_count, label: 'Data Count(bytes)', initial_value: lambda {self.parent.data_block.trans2_data.length}
|
18
|
+
uint16 :data_offset, label: 'Data Offset', initial_value: lambda {self.parent.data_block.trans2_data.abs_offset}
|
19
19
|
uint16 :data_displacement, label: 'Data Displacement'
|
20
|
-
uint8 :setup_count, label: 'Setup Count',
|
21
|
-
uint8 :reserved2, label: 'Reserved Space',
|
20
|
+
uint8 :setup_count, label: 'Setup Count', initial_value: lambda {setup.length}
|
21
|
+
uint8 :reserved2, label: 'Reserved Space', initial_value: 0x00
|
22
22
|
|
23
23
|
array :setup, type: :uint16, initial_length: 0
|
24
24
|
end
|
@@ -6,7 +6,7 @@ module RubySMB
|
|
6
6
|
class ParameterBlock < BinData::Record
|
7
7
|
endian :little
|
8
8
|
|
9
|
-
uint8 :word_count, label: 'Word Count',
|
9
|
+
uint8 :word_count, label: 'Word Count', initial_value: -> { calculate_word_count }
|
10
10
|
|
11
11
|
# Class method to stub word count calculation during
|
12
12
|
# lazy evaluation.
|
@@ -9,13 +9,13 @@ module RubySMB
|
|
9
9
|
nt_status :nt_status, label: 'NTStatus Code'
|
10
10
|
header_flags :flags
|
11
11
|
header_flags2 :flags2
|
12
|
-
|
12
|
+
uint16 :pid_high, label: 'PID High Bytes'
|
13
13
|
string :security_features, label: 'Security Features', length: 8
|
14
14
|
bit16 :reserved, label: 'Reserved'
|
15
15
|
bit16 :tid, label: 'Tree ID'
|
16
|
-
|
16
|
+
uint16 :pid_low, label: 'PID Low Bytes'
|
17
17
|
bit16 :uid, label: 'User ID'
|
18
|
-
|
18
|
+
uint16 :mid, label: 'Multiplex ID'
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -4,12 +4,12 @@ module RubySMB
|
|
4
4
|
# The SessionsFlags bit-field for a {RubySMB::SMB2::Packet::SessionSetupResponse}
|
5
5
|
class SessionFlags < BinData::Record
|
6
6
|
endian :little
|
7
|
-
bit6 :reserved3, label: 'Reserved',
|
7
|
+
bit6 :reserved3, label: 'Reserved', initial_value: 0
|
8
8
|
bit1 :null, label: 'ASYNC Command', initial_value: 0
|
9
9
|
bit1 :guest, label: 'Is Guest?', initial_value: 0
|
10
10
|
resume_byte_alignment
|
11
11
|
# byte border
|
12
|
-
uint8 :reserved1, label: 'Reserved',
|
12
|
+
uint8 :reserved1, label: 'Reserved', initial_value: 0
|
13
13
|
|
14
14
|
end
|
15
15
|
end
|
@@ -5,15 +5,15 @@ module RubySMB
|
|
5
5
|
# [2.2.1.2 SMB2 Packet Header - SYNC](https://msdn.microsoft.com/en-us/library/cc246529.aspx)
|
6
6
|
class Smb2HeaderFlags < BinData::Record
|
7
7
|
endian :little
|
8
|
-
bit4 :reserved3, label: 'Reserved',
|
8
|
+
bit4 :reserved3, label: 'Reserved', initial_value: 0
|
9
9
|
bit1 :signed, label: 'Packet Signed'
|
10
10
|
bit1 :related_operations, label: 'Chained Request'
|
11
|
-
bit1 :async_command, label: 'ASYNC Command',
|
11
|
+
bit1 :async_command, label: 'ASYNC Command', initial_value: 0
|
12
12
|
bit1 :reply, label: 'Response'
|
13
13
|
# byte border
|
14
|
-
uint16 :reserved2, label: 'Reserved',
|
14
|
+
uint16 :reserved2, label: 'Reserved', initial_value: 0
|
15
15
|
# byte border
|
16
|
-
bit2 :reserved1, label: 'Reserved',
|
16
|
+
bit2 :reserved1, label: 'Reserved', initial_value: 0
|
17
17
|
bit1 :replay_operation, label: 'Replay Operation'
|
18
18
|
bit1 :dfs_operation, label: 'DFS Operation'
|
19
19
|
resume_byte_alignment
|
@@ -18,7 +18,7 @@ module RubySMB
|
|
18
18
|
file_time :system_time, label: 'Server System Time'
|
19
19
|
file_time :server_start_time, label: 'Server Start Time'
|
20
20
|
uint16 :security_buffer_offset, label: 'Offset to Security Buffer'
|
21
|
-
uint16 :security_buffer_length, label: 'Security Buffer Length',
|
21
|
+
uint16 :security_buffer_length, label: 'Security Buffer Length', initial_value: -> { security_buffer.length }
|
22
22
|
uint32 :negotiate_context_offset, label: 'Offset to Negotiate Context'
|
23
23
|
string :security_buffer, label: 'Security Buffer', read_length: :security_buffer_length
|
24
24
|
|
@@ -10,7 +10,7 @@ module RubySMB
|
|
10
10
|
uint16 :structure_size, label: 'Structure Size', initial_value: 9
|
11
11
|
uint16 :flags, label: 'Flags', initial_value: 0x00
|
12
12
|
uint16 :path_offset, label: 'Path Offset', initial_value: 0x48
|
13
|
-
uint16 :path_length, label: 'Path Length',
|
13
|
+
uint16 :path_length, label: 'Path Length', initial_value: lambda { self.path.length }
|
14
14
|
string :path, label: 'Path Buffer'
|
15
15
|
|
16
16
|
def initialize_instance
|
data/lib/ruby_smb/version.rb
CHANGED
@@ -666,7 +666,7 @@ RSpec.describe RubySMB::Client do
|
|
666
666
|
raw = request1.to_binary_s
|
667
667
|
adjusted_request = RubySMB::SMB1::Packet::SessionSetupRequest.read(raw)
|
668
668
|
adjusted_request.smb_header.security_features = [smb1_client.sequence_counter].pack('Q<')
|
669
|
-
expect(OpenSSL::Digest::MD5).to receive(:digest).
|
669
|
+
expect(OpenSSL::Digest::MD5).to receive(:digest).and_return(fake_sig)
|
670
670
|
expect(smb1_client.smb1_sign(request1).smb_header.security_features).to eq fake_sig
|
671
671
|
end
|
672
672
|
end
|
@@ -50,7 +50,7 @@ RSpec.describe RubySMB::SMB1::SMBHeader do
|
|
50
50
|
|
51
51
|
describe 'pid_high' do
|
52
52
|
it 'should be a 16-bit field per the SMB spec' do
|
53
|
-
expect(header.pid_high).to be_a BinData::
|
53
|
+
expect(header.pid_high).to be_a BinData::Uint16le
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -74,7 +74,7 @@ RSpec.describe RubySMB::SMB1::SMBHeader do
|
|
74
74
|
|
75
75
|
describe 'pid_low' do
|
76
76
|
it 'should be a 16-bit field per the SMB spec' do
|
77
|
-
expect(header.pid_low).to be_a BinData::
|
77
|
+
expect(header.pid_low).to be_a BinData::Uint16le
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -86,7 +86,7 @@ RSpec.describe RubySMB::SMB1::SMBHeader do
|
|
86
86
|
|
87
87
|
describe 'mid' do
|
88
88
|
it 'should be a 16-bit field per the SMB spec' do
|
89
|
-
expect(header.mid).to be_a BinData::
|
89
|
+
expect(header.mid).to be_a BinData::Uint16le
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
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: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Maloney
|
@@ -89,7 +89,7 @@ cert_chain:
|
|
89
89
|
G+Hmcg1v810agasPdoydE0RTVZgEOOMoQ07qu7JFXVWZ9ZQpHT7qJATWL/b2csFG
|
90
90
|
8mVuTXnyJOKRJA==
|
91
91
|
-----END CERTIFICATE-----
|
92
|
-
date: 2017-05-
|
92
|
+
date: 2017-05-30 00:00:00.000000000 Z
|
93
93
|
dependencies:
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: redcarpet
|
metadata.gz.sig
CHANGED
Binary file
|