ruby_smb 1.0.3 → 2.0.1
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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.travis.yml +3 -2
- data/Gemfile +6 -2
- data/README.md +35 -47
- data/examples/enum_registry_key.rb +28 -0
- data/examples/enum_registry_values.rb +30 -0
- data/examples/negotiate.rb +51 -8
- data/examples/pipes.rb +2 -1
- data/examples/read_file_encryption.rb +56 -0
- data/examples/read_registry_key_value.rb +32 -0
- data/lib/ruby_smb.rb +4 -1
- data/lib/ruby_smb/client.rb +233 -22
- data/lib/ruby_smb/client/authentication.rb +70 -33
- data/lib/ruby_smb/client/echo.rb +20 -2
- data/lib/ruby_smb/client/encryption.rb +62 -0
- data/lib/ruby_smb/client/negotiation.rb +172 -24
- data/lib/ruby_smb/client/signing.rb +19 -0
- data/lib/ruby_smb/client/tree_connect.rb +24 -18
- data/lib/ruby_smb/client/utils.rb +8 -7
- data/lib/ruby_smb/client/winreg.rb +46 -0
- data/lib/ruby_smb/crypto.rb +30 -0
- data/lib/ruby_smb/dcerpc.rb +38 -0
- data/lib/ruby_smb/dcerpc/bind.rb +2 -2
- data/lib/ruby_smb/dcerpc/bind_ack.rb +2 -2
- data/lib/ruby_smb/dcerpc/error.rb +3 -0
- data/lib/ruby_smb/dcerpc/ndr.rb +95 -16
- data/lib/ruby_smb/dcerpc/pdu_header.rb +1 -1
- data/lib/ruby_smb/dcerpc/request.rb +28 -9
- data/lib/ruby_smb/dcerpc/rrp_unicode_string.rb +35 -0
- data/lib/ruby_smb/dcerpc/srvsvc.rb +10 -0
- data/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all.rb +9 -0
- data/lib/ruby_smb/dcerpc/winreg.rb +340 -0
- data/lib/ruby_smb/dcerpc/winreg/close_key_request.rb +24 -0
- data/lib/ruby_smb/dcerpc/winreg/close_key_response.rb +27 -0
- data/lib/ruby_smb/dcerpc/winreg/enum_key_request.rb +45 -0
- data/lib/ruby_smb/dcerpc/winreg/enum_key_response.rb +42 -0
- data/lib/ruby_smb/dcerpc/winreg/enum_value_request.rb +39 -0
- data/lib/ruby_smb/dcerpc/winreg/enum_value_response.rb +36 -0
- data/lib/ruby_smb/dcerpc/winreg/open_key_request.rb +34 -0
- data/lib/ruby_smb/dcerpc/winreg/open_key_response.rb +25 -0
- data/lib/ruby_smb/dcerpc/winreg/open_root_key_request.rb +43 -0
- data/lib/ruby_smb/dcerpc/winreg/open_root_key_response.rb +35 -0
- data/lib/ruby_smb/dcerpc/winreg/query_info_key_request.rb +27 -0
- data/lib/ruby_smb/dcerpc/winreg/query_info_key_response.rb +40 -0
- data/lib/ruby_smb/dcerpc/winreg/query_value_request.rb +39 -0
- data/lib/ruby_smb/dcerpc/winreg/query_value_response.rb +57 -0
- data/lib/ruby_smb/dcerpc/winreg/regsam.rb +40 -0
- data/lib/ruby_smb/dispatcher/socket.rb +4 -3
- data/lib/ruby_smb/error.rb +68 -2
- data/lib/ruby_smb/generic_packet.rb +33 -4
- data/lib/ruby_smb/smb1/commands.rb +1 -1
- data/lib/ruby_smb/smb1/file.rb +66 -15
- data/lib/ruby_smb/smb1/packet/close_request.rb +2 -5
- data/lib/ruby_smb/smb1/packet/close_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/echo_request.rb +2 -4
- data/lib/ruby_smb/smb1/packet/echo_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/empty_packet.rb +10 -1
- data/lib/ruby_smb/smb1/packet/logoff_request.rb +2 -4
- data/lib/ruby_smb/smb1/packet/logoff_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/negotiate_request.rb +2 -5
- data/lib/ruby_smb/smb1/packet/negotiate_response.rb +3 -7
- data/lib/ruby_smb/smb1/packet/negotiate_response_extended.rb +4 -4
- data/lib/ruby_smb/smb1/packet/nt_create_andx_request.rb +2 -4
- data/lib/ruby_smb/smb1/packet/nt_create_andx_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/nt_trans/create_request.rb +2 -1
- data/lib/ruby_smb/smb1/packet/nt_trans/create_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/nt_trans/request.rb +2 -4
- data/lib/ruby_smb/smb1/packet/nt_trans/response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/read_andx_request.rb +2 -5
- data/lib/ruby_smb/smb1/packet/read_andx_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/session_setup_legacy_request.rb +2 -1
- data/lib/ruby_smb/smb1/packet/session_setup_legacy_response.rb +3 -2
- data/lib/ruby_smb/smb1/packet/session_setup_request.rb +2 -5
- data/lib/ruby_smb/smb1/packet/session_setup_response.rb +3 -2
- data/lib/ruby_smb/smb1/packet/trans/peek_nmpipe_request.rb +0 -1
- data/lib/ruby_smb/smb1/packet/trans/peek_nmpipe_response.rb +3 -2
- data/lib/ruby_smb/smb1/packet/trans/request.rb +2 -5
- data/lib/ruby_smb/smb1/packet/trans/response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/trans/transact_nmpipe_request.rb +1 -1
- data/lib/ruby_smb/smb1/packet/trans/transact_nmpipe_response.rb +1 -1
- data/lib/ruby_smb/smb1/packet/trans2/find_first2_request.rb +2 -1
- data/lib/ruby_smb/smb1/packet/trans2/find_first2_response.rb +8 -2
- data/lib/ruby_smb/smb1/packet/trans2/find_next2_request.rb +2 -1
- data/lib/ruby_smb/smb1/packet/trans2/find_next2_response.rb +8 -2
- data/lib/ruby_smb/smb1/packet/trans2/open2_request.rb +2 -1
- data/lib/ruby_smb/smb1/packet/trans2/open2_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/trans2/request.rb +2 -4
- data/lib/ruby_smb/smb1/packet/trans2/request_secondary.rb +2 -4
- data/lib/ruby_smb/smb1/packet/trans2/response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/trans2/set_file_information_request.rb +2 -1
- data/lib/ruby_smb/smb1/packet/trans2/set_file_information_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/tree_connect_request.rb +2 -4
- data/lib/ruby_smb/smb1/packet/tree_connect_response.rb +13 -3
- data/lib/ruby_smb/smb1/packet/tree_disconnect_request.rb +2 -4
- data/lib/ruby_smb/smb1/packet/tree_disconnect_response.rb +2 -1
- data/lib/ruby_smb/smb1/packet/write_andx_request.rb +3 -6
- data/lib/ruby_smb/smb1/packet/write_andx_response.rb +2 -1
- data/lib/ruby_smb/smb1/pipe.rb +87 -6
- data/lib/ruby_smb/smb1/tree.rb +50 -3
- data/lib/ruby_smb/smb2/bit_field/session_flags.rb +2 -1
- data/lib/ruby_smb/smb2/bit_field/share_flags.rb +6 -4
- data/lib/ruby_smb/smb2/file.rb +103 -25
- data/lib/ruby_smb/smb2/negotiate_context.rb +108 -0
- data/lib/ruby_smb/smb2/packet.rb +2 -0
- data/lib/ruby_smb/smb2/packet/close_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/close_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/compression_transform_header.rb +41 -0
- data/lib/ruby_smb/smb2/packet/create_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/create_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/echo_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/echo_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/error_packet.rb +15 -3
- data/lib/ruby_smb/smb2/packet/ioctl_request.rb +2 -5
- data/lib/ruby_smb/smb2/packet/ioctl_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/logoff_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/logoff_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/negotiate_request.rb +51 -17
- data/lib/ruby_smb/smb2/packet/negotiate_response.rb +52 -5
- data/lib/ruby_smb/smb2/packet/query_directory_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/query_directory_response.rb +8 -2
- data/lib/ruby_smb/smb2/packet/read_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/read_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/session_setup_request.rb +2 -5
- data/lib/ruby_smb/smb2/packet/session_setup_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/set_info_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/set_info_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/transform_header.rb +84 -0
- data/lib/ruby_smb/smb2/packet/tree_connect_request.rb +93 -10
- data/lib/ruby_smb/smb2/packet/tree_connect_response.rb +10 -22
- data/lib/ruby_smb/smb2/packet/tree_disconnect_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/tree_disconnect_response.rb +2 -1
- data/lib/ruby_smb/smb2/packet/write_request.rb +2 -4
- data/lib/ruby_smb/smb2/packet/write_response.rb +2 -1
- data/lib/ruby_smb/smb2/pipe.rb +86 -12
- data/lib/ruby_smb/smb2/smb2_header.rb +1 -1
- data/lib/ruby_smb/smb2/tree.rb +65 -21
- data/lib/ruby_smb/version.rb +1 -1
- data/ruby_smb.gemspec +5 -3
- data/spec/lib/ruby_smb/client_spec.rb +1612 -108
- data/spec/lib/ruby_smb/crypto_spec.rb +25 -0
- data/spec/lib/ruby_smb/dcerpc/bind_ack_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/bind_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/ndr_spec.rb +410 -0
- data/spec/lib/ruby_smb/dcerpc/request_spec.rb +50 -7
- data/spec/lib/ruby_smb/dcerpc/rrp_unicode_string_spec.rb +98 -0
- data/spec/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all_spec.rb +13 -0
- data/spec/lib/ruby_smb/dcerpc/srvsvc_spec.rb +60 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/close_key_request_spec.rb +28 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/close_key_response_spec.rb +36 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/enum_key_request_spec.rb +108 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/enum_key_response_spec.rb +97 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/enum_value_request_spec.rb +94 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/enum_value_response_spec.rb +82 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/open_key_request_spec.rb +74 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/open_key_response_spec.rb +35 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/open_root_key_request_spec.rb +90 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/open_root_key_response_spec.rb +38 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/query_info_key_request_spec.rb +39 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/query_info_key_response_spec.rb +113 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/query_value_request_spec.rb +88 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/query_value_response_spec.rb +150 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/regsam_spec.rb +32 -0
- data/spec/lib/ruby_smb/dcerpc/winreg_spec.rb +710 -0
- data/spec/lib/ruby_smb/dcerpc_spec.rb +81 -0
- data/spec/lib/ruby_smb/dispatcher/socket_spec.rb +2 -2
- data/spec/lib/ruby_smb/error_spec.rb +59 -0
- data/spec/lib/ruby_smb/generic_packet_spec.rb +52 -4
- data/spec/lib/ruby_smb/smb1/file_spec.rb +191 -2
- data/spec/lib/ruby_smb/smb1/packet/empty_packet_spec.rb +68 -0
- data/spec/lib/ruby_smb/smb1/packet/session_setup_legacy_request_spec.rb +2 -2
- data/spec/lib/ruby_smb/smb1/packet/session_setup_legacy_response_spec.rb +2 -2
- data/spec/lib/ruby_smb/smb1/packet/session_setup_request_spec.rb +2 -2
- data/spec/lib/ruby_smb/smb1/packet/session_setup_response_spec.rb +1 -1
- data/spec/lib/ruby_smb/smb1/packet/trans2/find_first2_response_spec.rb +11 -2
- data/spec/lib/ruby_smb/smb1/packet/trans2/find_next2_response_spec.rb +11 -2
- data/spec/lib/ruby_smb/smb1/packet/tree_connect_response_spec.rb +40 -0
- data/spec/lib/ruby_smb/smb1/pipe_spec.rb +272 -149
- data/spec/lib/ruby_smb/smb1/tree_spec.rb +44 -7
- data/spec/lib/ruby_smb/smb2/bit_field/session_flags_spec.rb +9 -0
- data/spec/lib/ruby_smb/smb2/bit_field/share_flags_spec.rb +27 -0
- data/spec/lib/ruby_smb/smb2/file_spec.rb +323 -6
- data/spec/lib/ruby_smb/smb2/negotiate_context_spec.rb +332 -0
- data/spec/lib/ruby_smb/smb2/packet/compression_transform_header_spec.rb +108 -0
- data/spec/lib/ruby_smb/smb2/packet/error_packet_spec.rb +78 -0
- data/spec/lib/ruby_smb/smb2/packet/negotiate_request_spec.rb +138 -3
- data/spec/lib/ruby_smb/smb2/packet/negotiate_response_spec.rb +120 -2
- data/spec/lib/ruby_smb/smb2/packet/query_directory_response_spec.rb +8 -0
- data/spec/lib/ruby_smb/smb2/packet/transform_header_spec.rb +220 -0
- data/spec/lib/ruby_smb/smb2/packet/tree_connect_request_spec.rb +339 -9
- data/spec/lib/ruby_smb/smb2/packet/tree_connect_response_spec.rb +3 -22
- data/spec/lib/ruby_smb/smb2/pipe_spec.rb +286 -149
- data/spec/lib/ruby_smb/smb2/smb2_header_spec.rb +2 -2
- data/spec/lib/ruby_smb/smb2/tree_spec.rb +261 -2
- metadata +191 -83
- metadata.gz.sig +0 -0
- data/lib/ruby_smb/smb1/dcerpc.rb +0 -67
- data/lib/ruby_smb/smb2/dcerpc.rb +0 -70
- data/spec/lib/ruby_smb/smb1/packet/error_packet_spec.rb +0 -37
@@ -4,6 +4,8 @@ module RubySMB
|
|
4
4
|
# This class represents an SMB1 LOGOFF Request Packet as defined in
|
5
5
|
# [2.2.4.54.1 Request](https://msdn.microsoft.com/en-us/library/ee442167.aspx)
|
6
6
|
class LogoffRequest < RubySMB::GenericPacket
|
7
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_LOGOFF
|
8
|
+
|
7
9
|
# The Parameter Block for this packet is empty save the Word Count and ANDX Block
|
8
10
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
9
11
|
and_x_block :andx_block
|
@@ -17,10 +19,6 @@ module RubySMB
|
|
17
19
|
parameter_block :parameter_block
|
18
20
|
data_block :data_block
|
19
21
|
|
20
|
-
def initialize_instance
|
21
|
-
super
|
22
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_LOGOFF
|
23
|
-
end
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|
@@ -4,6 +4,8 @@ module RubySMB
|
|
4
4
|
# This class represents an SMB1 LOGOFF Response Packet as defined in
|
5
5
|
# [2.2.4.54.2 Response](https://msdn.microsoft.com/en-us/library/ee441488.aspx)
|
6
6
|
class LogoffResponse < RubySMB::GenericPacket
|
7
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_LOGOFF
|
8
|
+
|
7
9
|
# The Parameter Block for this packet is empty save the Word Count and ANDX Block
|
8
10
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
9
11
|
and_x_block :andx_block
|
@@ -19,7 +21,6 @@ module RubySMB
|
|
19
21
|
|
20
22
|
def initialize_instance
|
21
23
|
super
|
22
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_LOGOFF
|
23
24
|
smb_header.flags.reply = 1
|
24
25
|
end
|
25
26
|
end
|
@@ -4,6 +4,8 @@ module RubySMB
|
|
4
4
|
# A SMB1 SMB_COM_NEGOTIATE Request Packet as defined in
|
5
5
|
# [2.2.4.52.1](https://msdn.microsoft.com/en-us/library/ee441572.aspx)
|
6
6
|
class NegotiateRequest < RubySMB::GenericPacket
|
7
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_NEGOTIATE
|
8
|
+
|
7
9
|
# Represents the specific layout of the DataBlock for a NegotiateRequest Packet.
|
8
10
|
class DataBlock < RubySMB::SMB1::DataBlock
|
9
11
|
array :dialects, label: 'Dialects', type: :dialect, read_until: :eof
|
@@ -13,11 +15,6 @@ module RubySMB
|
|
13
15
|
parameter_block :parameter_block
|
14
16
|
data_block :data_block
|
15
17
|
|
16
|
-
def initialize_instance
|
17
|
-
super
|
18
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_NEGOTIATE
|
19
|
-
end
|
20
|
-
|
21
18
|
# Add an individual Dialect string to the list of
|
22
19
|
# Dialects in the packet.
|
23
20
|
#
|
@@ -4,6 +4,8 @@ module RubySMB
|
|
4
4
|
# A SMB1 SMB_COM_NEGOTIATE Non-Extended Security Response Packet as defined in
|
5
5
|
# [2.2.4.5.2.2 Non-Extended Security Response](https://msdn.microsoft.com/en-us/library/cc246327.aspx)
|
6
6
|
class NegotiateResponse < RubySMB::GenericPacket
|
7
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_NEGOTIATE
|
8
|
+
|
7
9
|
# An SMB_Parameters Block as defined by the {NegotiateResponse}.
|
8
10
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
9
11
|
uint16 :dialect_index, label: 'Dialect Index'
|
@@ -32,13 +34,7 @@ module RubySMB
|
|
32
34
|
|
33
35
|
def initialize_instance
|
34
36
|
super
|
35
|
-
|
36
|
-
header.command = RubySMB::SMB1::Commands::SMB_COM_NEGOTIATE
|
37
|
-
header.flags.reply = 1
|
38
|
-
end
|
39
|
-
|
40
|
-
def valid?
|
41
|
-
smb_header.command == RubySMB::SMB1::Commands::SMB_COM_NEGOTIATE
|
37
|
+
smb_header.flags.reply = 1
|
42
38
|
end
|
43
39
|
|
44
40
|
# Stores the list of {RubySMB::SMB1::Dialect} that were sent to the
|
@@ -4,6 +4,8 @@ module RubySMB
|
|
4
4
|
# A SMB1 SMB_COM_NEGOTIATE Extended Security Response Packet as defined in
|
5
5
|
# [2.2.4.5.2.1 Extended Security Response](https://msdn.microsoft.com/en-us/library/cc246326.aspx)
|
6
6
|
class NegotiateResponseExtended < RubySMB::GenericPacket
|
7
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_NEGOTIATE
|
8
|
+
|
7
9
|
# An SMB_Parameters Block as defined by the {NegotiateResponseExtended}.
|
8
10
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
9
11
|
uint16 :dialect_index, label: 'Dialect Index'
|
@@ -31,13 +33,11 @@ module RubySMB
|
|
31
33
|
|
32
34
|
def initialize_instance
|
33
35
|
super
|
34
|
-
|
35
|
-
header.command = RubySMB::SMB1::Commands::SMB_COM_NEGOTIATE
|
36
|
-
header.flags.reply = 1
|
36
|
+
smb_header.flags.reply = 1
|
37
37
|
end
|
38
38
|
|
39
39
|
def valid?
|
40
|
-
return false unless
|
40
|
+
return false unless super
|
41
41
|
return false unless parameter_block.capabilities.extended_security == 1
|
42
42
|
true
|
43
43
|
end
|
@@ -5,6 +5,8 @@ module RubySMB
|
|
5
5
|
# [2.2.4.64.1 Request](https://msdn.microsoft.com/en-us/library/ee442175.aspx) and
|
6
6
|
# [2.2.4.9.1 Client Request Extensions](https://msdn.microsoft.com/en-us/library/cc246332.aspx)
|
7
7
|
class NtCreateAndxRequest < RubySMB::GenericPacket
|
8
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_NT_CREATE_ANDX
|
9
|
+
|
8
10
|
# A SMB1 Parameter Block as defined by the {NtCreateAndxRequest}
|
9
11
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
10
12
|
endian :little
|
@@ -52,10 +54,6 @@ module RubySMB
|
|
52
54
|
parameter_block :parameter_block
|
53
55
|
data_block :data_block
|
54
56
|
|
55
|
-
def initialize_instance
|
56
|
-
super
|
57
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_NT_CREATE_ANDX
|
58
|
-
end
|
59
57
|
end
|
60
58
|
end
|
61
59
|
end
|
@@ -5,6 +5,8 @@ module RubySMB
|
|
5
5
|
# [2.2.4.64.2 Response](https://msdn.microsoft.com/en-us/library/ee441612.aspx) and
|
6
6
|
# [2.2.4.9.2 Server Response Extensions](https://msdn.microsoft.com/en-us/library/cc246334.aspx)
|
7
7
|
class NtCreateAndxResponse < RubySMB::GenericPacket
|
8
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_NT_CREATE_ANDX
|
9
|
+
|
8
10
|
# A SMB1 Parameter Block as defined by the {NtCreateAndxResponse}
|
9
11
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
10
12
|
endian :little
|
@@ -57,7 +59,6 @@ module RubySMB
|
|
57
59
|
|
58
60
|
def initialize_instance
|
59
61
|
super
|
60
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_NT_CREATE_ANDX
|
61
62
|
smb_header.flags.reply = 1
|
62
63
|
end
|
63
64
|
end
|
@@ -5,6 +5,8 @@ module RubySMB
|
|
5
5
|
# Class representing a generic NT Transaction request packet as defined in
|
6
6
|
# [2.2.4.62.1 Request](https://msdn.microsoft.com/en-us/library/ee441534.aspx)
|
7
7
|
class CreateRequest < RubySMB::GenericPacket
|
8
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_NT_TRANSACT
|
9
|
+
|
8
10
|
class ParameterBlock < RubySMB::SMB1::Packet::NtTrans::Request::ParameterBlock
|
9
11
|
end
|
10
12
|
|
@@ -81,7 +83,6 @@ module RubySMB
|
|
81
83
|
|
82
84
|
def initialize_instance
|
83
85
|
super
|
84
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_NT_TRANSACT
|
85
86
|
parameter_block.function = RubySMB::SMB1::Packet::NtTrans::Subcommands::CREATE
|
86
87
|
end
|
87
88
|
end
|
@@ -5,6 +5,8 @@ module RubySMB
|
|
5
5
|
# Class representing a NT Transaction Create response packet as defined in
|
6
6
|
# [2.2.7.1.2 Response](https://msdn.microsoft.com/en-us/library/ee441961.aspx)
|
7
7
|
class CreateResponse < RubySMB::GenericPacket
|
8
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_NT_TRANSACT
|
9
|
+
|
8
10
|
class ParameterBlock < RubySMB::SMB1::Packet::NtTrans::Response::ParameterBlock
|
9
11
|
end
|
10
12
|
|
@@ -49,7 +51,6 @@ module RubySMB
|
|
49
51
|
|
50
52
|
def initialize_instance
|
51
53
|
super
|
52
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_NT_TRANSACT
|
53
54
|
smb_header.flags.reply = 1
|
54
55
|
end
|
55
56
|
end
|
@@ -5,6 +5,8 @@ module RubySMB
|
|
5
5
|
# Class representing a generic NT Transaction request packet as defined in
|
6
6
|
# [2.2.4.62.1 Request](https://msdn.microsoft.com/en-us/library/ee441534.aspx)
|
7
7
|
class Request < RubySMB::GenericPacket
|
8
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_NT_TRANSACT
|
9
|
+
|
8
10
|
# The {RubySMB::SMB1::ParameterBlock} specific to this packet type.
|
9
11
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
10
12
|
endian :little
|
@@ -36,10 +38,6 @@ module RubySMB
|
|
36
38
|
parameter_block :parameter_block
|
37
39
|
data_block :data_block
|
38
40
|
|
39
|
-
def initialize_instance
|
40
|
-
super
|
41
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_NT_TRANSACT
|
42
|
-
end
|
43
41
|
end
|
44
42
|
end
|
45
43
|
end
|
@@ -5,6 +5,8 @@ module RubySMB
|
|
5
5
|
# Class representing a generic NT Transaction response packet as defined in
|
6
6
|
# [2.2.4.62.2 Response](https://msdn.microsoft.com/en-us/library/ee442112.aspx)
|
7
7
|
class Response < RubySMB::GenericPacket
|
8
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_NT_TRANSACT
|
9
|
+
|
8
10
|
# The {RubySMB::SMB1::ParameterBlock} specific to this packet type.
|
9
11
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
10
12
|
endian :little
|
@@ -34,7 +36,6 @@ module RubySMB
|
|
34
36
|
|
35
37
|
def initialize_instance
|
36
38
|
super
|
37
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_NT_TRANSACT
|
38
39
|
smb_header.flags.reply = 1
|
39
40
|
end
|
40
41
|
end
|
@@ -5,6 +5,8 @@ module RubySMB
|
|
5
5
|
# [2.2.4.42.1 Request](https://msdn.microsoft.com/en-us/library/ee441839.aspx)
|
6
6
|
# [2.2.4.2.1 Client Request Extensions](https://msdn.microsoft.com/en-us/library/ff470250.aspx)
|
7
7
|
class ReadAndxRequest < RubySMB::GenericPacket
|
8
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_READ_ANDX
|
9
|
+
|
8
10
|
# A SMB1 Parameter Block as defined by the {ReadAndxRequest}
|
9
11
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
10
12
|
endian :little
|
@@ -54,11 +56,6 @@ module RubySMB
|
|
54
56
|
parameter_block :parameter_block
|
55
57
|
data_block :data_block
|
56
58
|
|
57
|
-
def initialize_instance
|
58
|
-
super
|
59
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_READ_ANDX
|
60
|
-
end
|
61
|
-
|
62
59
|
# Sets the read_from_named_pipe flag to `read_from_named_pipe` value (true or false).
|
63
60
|
# When reading from a named pipe, this flag needs to be set to true, which forces
|
64
61
|
# the use of Timeout field in Timeout_or_MaxCountHigh. When set to false (default),
|
@@ -5,6 +5,8 @@ module RubySMB
|
|
5
5
|
# [2.2.4.42.2 Response](https://msdn.microsoft.com/en-us/library/ee441872.aspx)
|
6
6
|
# [2.2.4.2.2 Server Response Extensions](https://msdn.microsoft.com/en-us/library/ff470017.aspx)
|
7
7
|
class ReadAndxResponse < RubySMB::GenericPacket
|
8
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_READ_ANDX
|
9
|
+
|
8
10
|
# A SMB1 Parameter Block as defined by the {ReadAndxResponse}
|
9
11
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
10
12
|
endian :little
|
@@ -38,7 +40,6 @@ module RubySMB
|
|
38
40
|
|
39
41
|
def initialize_instance
|
40
42
|
super
|
41
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_READ_ANDX
|
42
43
|
smb_header.flags.reply = 1
|
43
44
|
end
|
44
45
|
end
|
@@ -4,6 +4,8 @@ module RubySMB
|
|
4
4
|
# A SMB1 SMB_COM_SESSION_SETUP_ANDX Request Packet, without NTLMSSP as defined in
|
5
5
|
# [2.2.4.53.1 Request](https://msdn.microsoft.com/en-us/library/ee441849.aspx)
|
6
6
|
class SessionSetupLegacyRequest < RubySMB::GenericPacket
|
7
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_SESSION_SETUP_ANDX
|
8
|
+
|
7
9
|
# A SMB1 Parameter Block as defined by the {SessionSetupRequest}
|
8
10
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
9
11
|
and_x_block :andx_block
|
@@ -37,7 +39,6 @@ module RubySMB
|
|
37
39
|
|
38
40
|
def initialize_instance
|
39
41
|
super
|
40
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_SESSION_SETUP
|
41
42
|
parameter_block.capabilities.extended_security = 0
|
42
43
|
end
|
43
44
|
end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
module RubySMB
|
2
2
|
module SMB1
|
3
3
|
module Packet
|
4
|
-
# A SMB1
|
4
|
+
# A SMB1 SMB_COM_SESSION_SETUP_ANDX Legacy Response Packet as defined in
|
5
5
|
# [2.2.4.53.2 Response](https://msdn.microsoft.com/en-us/library/ee442143.aspx)
|
6
6
|
class SessionSetupLegacyResponse < RubySMB::GenericPacket
|
7
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_SESSION_SETUP_ANDX
|
8
|
+
|
7
9
|
# A SMB1 Parameter Block as defined by the {SessionSetupResponse}
|
8
10
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
9
11
|
and_x_block :andx_block
|
@@ -24,7 +26,6 @@ module RubySMB
|
|
24
26
|
|
25
27
|
def initialize_instance
|
26
28
|
super
|
27
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_SESSION_SETUP
|
28
29
|
smb_header.flags.reply = 1
|
29
30
|
end
|
30
31
|
end
|
@@ -4,6 +4,8 @@ module RubySMB
|
|
4
4
|
# A SMB1 SMB_COM_SESSION_SETUP_ANDX Request Packet as defined in
|
5
5
|
# [2.2.4.6.1](https://msdn.microsoft.com/en-us/library/cc246328.aspx)
|
6
6
|
class SessionSetupRequest < RubySMB::GenericPacket
|
7
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_SESSION_SETUP_ANDX
|
8
|
+
|
7
9
|
# A SMB1 Parameter Block as defined by the {SessionSetupRequest}
|
8
10
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
9
11
|
and_x_block :andx_block
|
@@ -30,11 +32,6 @@ module RubySMB
|
|
30
32
|
parameter_block :parameter_block
|
31
33
|
data_block :data_block
|
32
34
|
|
33
|
-
def initialize_instance
|
34
|
-
super
|
35
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_SESSION_SETUP
|
36
|
-
end
|
37
|
-
|
38
35
|
# Takes an NTLM Type 1 Message and creates the GSS Security Blob
|
39
36
|
# for it and sets it in the {RubySMB::SMB1::Packet::SessionSetupRequest::DataBlock#security_blob}
|
40
37
|
# field. It also automaticaly sets the length in
|
@@ -1,9 +1,11 @@
|
|
1
1
|
module RubySMB
|
2
2
|
module SMB1
|
3
3
|
module Packet
|
4
|
-
# A SMB1
|
4
|
+
# A SMB1 SMB_COM_SESSION_SETUP_ANDX Response Packet as defined in
|
5
5
|
# [2.2.4.6.2](https://msdn.microsoft.com/en-us/library/cc246329.aspx)
|
6
6
|
class SessionSetupResponse < RubySMB::GenericPacket
|
7
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_SESSION_SETUP_ANDX
|
8
|
+
|
7
9
|
# A SMB1 Parameter Block as defined by the {SessionSetupResponse}
|
8
10
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
9
11
|
and_x_block :andx_block
|
@@ -24,7 +26,6 @@ module RubySMB
|
|
24
26
|
|
25
27
|
def initialize_instance
|
26
28
|
super
|
27
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_SESSION_SETUP
|
28
29
|
smb_header.flags.reply = 1
|
29
30
|
end
|
30
31
|
|
@@ -12,7 +12,6 @@ module RubySMB
|
|
12
12
|
|
13
13
|
def initialize_instance
|
14
14
|
super
|
15
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_TRANSACTION
|
16
15
|
data_block.name = "\\PIPE\\"
|
17
16
|
parameter_block.setup << RubySMB::SMB1::Packet::Trans::Subcommands::PEEK_NMPIPE
|
18
17
|
parameter_block.setup_count = 2
|
@@ -5,6 +5,8 @@ module RubySMB
|
|
5
5
|
# This class represents an SMB1 Trans PeekNamedPipe Response Packet as defined in
|
6
6
|
# [2.2.5.5.2 Response](https://msdn.microsoft.com/en-us/library/ee441883.aspx)
|
7
7
|
class PeekNmpipeResponse < RubySMB::GenericPacket
|
8
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_TRANSACTION
|
9
|
+
|
8
10
|
class ParameterBlock < RubySMB::SMB1::Packet::Trans::Response::ParameterBlock
|
9
11
|
end
|
10
12
|
|
@@ -22,7 +24,7 @@ module RubySMB
|
|
22
24
|
do_num_bytes
|
23
25
|
end
|
24
26
|
end
|
25
|
-
|
27
|
+
|
26
28
|
class TransData < BinData::Record
|
27
29
|
string :read_data, label: 'Readable data', length: -> { parent.parameter_block.total_data_count }
|
28
30
|
|
@@ -48,7 +50,6 @@ module RubySMB
|
|
48
50
|
|
49
51
|
def initialize_instance
|
50
52
|
super
|
51
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_TRANSACTION
|
52
53
|
smb_header.flags.reply = 1
|
53
54
|
parameter_block.setup << RubySMB::SMB1::Packet::Trans::Subcommands::PEEK_NMPIPE
|
54
55
|
end
|
@@ -6,6 +6,8 @@ module RubySMB
|
|
6
6
|
# This class represents a generic SMB1 Trans Request Packet as defined in
|
7
7
|
# [2.2.4.33.1 Request](https://msdn.microsoft.com/en-us/library/ee441730.aspx)
|
8
8
|
class Request < RubySMB::GenericPacket
|
9
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_TRANSACTION
|
10
|
+
|
9
11
|
# A SMB1 Parameter Block
|
10
12
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
11
13
|
uint16 :total_parameter_count, label: 'Total Parameter Count(bytes)', initial_value: -> { parameter_count }
|
@@ -48,11 +50,6 @@ module RubySMB
|
|
48
50
|
parameter_block :parameter_block
|
49
51
|
data_block :data_block
|
50
52
|
|
51
|
-
def initialize_instance
|
52
|
-
super
|
53
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_TRANSACTION
|
54
|
-
end
|
55
|
-
|
56
53
|
end
|
57
54
|
end
|
58
55
|
end
|
@@ -6,6 +6,8 @@ module RubySMB
|
|
6
6
|
# This class represents a generic SMB1 Trans Response Packet as defined in
|
7
7
|
# [2.2.4.33.2 Response](https://msdn.microsoft.com/en-us/library/ee442061.aspx)
|
8
8
|
class Response < RubySMB::GenericPacket
|
9
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_TRANSACTION
|
10
|
+
|
9
11
|
# A SMB1 Parameter Block
|
10
12
|
class ParameterBlock < RubySMB::SMB1::ParameterBlock
|
11
13
|
uint16 :total_parameter_count, label: 'Total Parameter Count(bytes)', initial_value: -> { parameter_count }
|
@@ -35,7 +37,6 @@ module RubySMB
|
|
35
37
|
|
36
38
|
def initialize_instance
|
37
39
|
super
|
38
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_TRANSACTION
|
39
40
|
smb_header.flags.reply = 1
|
40
41
|
end
|
41
42
|
|
@@ -6,6 +6,7 @@ module RubySMB
|
|
6
6
|
# A Trans TRANSACT_NMPIPE Request Packet as defined in
|
7
7
|
# [2.2.5.6.1 Request](https://msdn.microsoft.com/en-us/library/ee441832.aspx)
|
8
8
|
class TransactNmpipeRequest < RubySMB::GenericPacket
|
9
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_TRANSACTION
|
9
10
|
|
10
11
|
class ParameterBlock < RubySMB::SMB1::Packet::Trans::Request::ParameterBlock
|
11
12
|
end
|
@@ -42,7 +43,6 @@ module RubySMB
|
|
42
43
|
|
43
44
|
def initialize_instance
|
44
45
|
super
|
45
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_TRANSACTION
|
46
46
|
parameter_block.max_parameter_count = 0x0000
|
47
47
|
parameter_block.max_setup_count = 0x00
|
48
48
|
parameter_block.setup << RubySMB::SMB1::Packet::Trans::Subcommands::TRANSACT_NMPIPE
|
@@ -6,6 +6,7 @@ module RubySMB
|
|
6
6
|
# A Trans TRANSACT_NMPIPE Response Packet as defined in
|
7
7
|
# [2.2.5.6.2 Response](https://msdn.microsoft.com/en-us/library/ee442003.aspx)
|
8
8
|
class TransactNmpipeResponse < RubySMB::GenericPacket
|
9
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_TRANSACTION
|
9
10
|
|
10
11
|
class ParameterBlock < RubySMB::SMB1::Packet::Trans::Response::ParameterBlock
|
11
12
|
end
|
@@ -33,7 +34,6 @@ module RubySMB
|
|
33
34
|
|
34
35
|
def initialize_instance
|
35
36
|
super
|
36
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_TRANSACTION
|
37
37
|
smb_header.flags.reply = 1
|
38
38
|
end
|
39
39
|
|
@@ -5,6 +5,8 @@ module RubySMB
|
|
5
5
|
# A Trans2 FIND_FIRST2 Request Packet as defined in
|
6
6
|
# [2.2.6.2.1](https://msdn.microsoft.com/en-us/library/ee441987.aspx)
|
7
7
|
class FindFirst2Request < RubySMB::GenericPacket
|
8
|
+
COMMAND = RubySMB::SMB1::Commands::SMB_COM_TRANSACTION2
|
9
|
+
|
8
10
|
class ParameterBlock < RubySMB::SMB1::Packet::Trans2::Request::ParameterBlock
|
9
11
|
end
|
10
12
|
|
@@ -67,7 +69,6 @@ module RubySMB
|
|
67
69
|
|
68
70
|
def initialize_instance
|
69
71
|
super
|
70
|
-
smb_header.command = RubySMB::SMB1::Commands::SMB_COM_TRANSACTION2
|
71
72
|
parameter_block.setup << RubySMB::SMB1::Packet::Trans2::Subcommands::FIND_FIRST2
|
72
73
|
end
|
73
74
|
end
|