ruby_smb 1.0.3 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
metadata.gz.sig
CHANGED
Binary file
|
data/lib/ruby_smb/smb1/dcerpc.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
module RubySMB
|
2
|
-
module SMB1
|
3
|
-
module Dcerpc
|
4
|
-
|
5
|
-
def net_share_enum_all(host)
|
6
|
-
bind(endpoint: RubySMB::Dcerpc::Srvsvc)
|
7
|
-
|
8
|
-
response = request(RubySMB::Dcerpc::Srvsvc::NET_SHARE_ENUM_ALL, host: host)
|
9
|
-
|
10
|
-
shares = RubySMB::Dcerpc::Srvsvc::NetShareEnumAll.parse_response(response.stub.to_binary_s)
|
11
|
-
shares.map{|s|{name: s[0], type: s[1], comment: s[2]}}
|
12
|
-
end
|
13
|
-
|
14
|
-
def bind(options={})
|
15
|
-
bind_req = RubySMB::Dcerpc::Bind.new(options)
|
16
|
-
write(data: bind_req.to_binary_s)
|
17
|
-
@size = 1024
|
18
|
-
dcerpc_raw_response = read()
|
19
|
-
begin
|
20
|
-
dcerpc_response = RubySMB::Dcerpc::BindAck.read(dcerpc_raw_response)
|
21
|
-
rescue IOError
|
22
|
-
raise RubySMB::Dcerpc::Error::InvalidPacket, "Error reading the DCERPC response"
|
23
|
-
end
|
24
|
-
unless dcerpc_response.pdu_header.ptype == RubySMB::Dcerpc::PTypes::BIND_ACK
|
25
|
-
raise RubySMB::Dcerpc::Error::BindError, "Not a BindAck packet"
|
26
|
-
end
|
27
|
-
|
28
|
-
res_list = dcerpc_response.p_result_list
|
29
|
-
if res_list.n_results == 0 ||
|
30
|
-
res_list.p_results[0].result != RubySMB::Dcerpc::BindAck::ACCEPTANCE
|
31
|
-
raise RubySMB::Dcerpc::Error::BindError,
|
32
|
-
"Bind Failed (Result: #{res_list.p_results[0].result}, Reason: #{res_list.p_results[0].reason})"
|
33
|
-
end
|
34
|
-
dcerpc_response
|
35
|
-
end
|
36
|
-
|
37
|
-
def request(opnum, options={})
|
38
|
-
dcerpc_request = RubySMB::Dcerpc::Request.new({ :opnum => opnum }, options)
|
39
|
-
request = RubySMB::SMB1::Packet::Trans::TransactNmpipeRequest.new(options)
|
40
|
-
@tree.set_header_fields(request)
|
41
|
-
request.set_fid(@fid)
|
42
|
-
request.data_block.trans_data.write_data = dcerpc_request.to_binary_s
|
43
|
-
|
44
|
-
trans_nmpipe_raw_response = @tree.client.send_recv(request)
|
45
|
-
trans_nmpipe_response = RubySMB::SMB1::Packet::Trans::TransactNmpipeResponse.read(trans_nmpipe_raw_response)
|
46
|
-
unless trans_nmpipe_response.smb_header.command == RubySMB::SMB1::Commands::SMB_COM_TRANSACTION
|
47
|
-
raise RubySMB::Error::InvalidPacket, 'Not a Trans packet'
|
48
|
-
end
|
49
|
-
unless trans_nmpipe_response.status_code == WindowsError::NTStatus::STATUS_SUCCESS
|
50
|
-
raise RubySMB::Error::UnexpectedStatusCode, trans_nmpipe_response.status_code.name
|
51
|
-
end
|
52
|
-
|
53
|
-
begin
|
54
|
-
dcerpc_response = RubySMB::Dcerpc::Response.read(trans_nmpipe_response.data_block.trans_data.read_data)
|
55
|
-
rescue IOError
|
56
|
-
raise RubySMB::Dcerpc::Error::InvalidPacket, "Error reading the DCERPC response"
|
57
|
-
end
|
58
|
-
unless dcerpc_response.pdu_header.ptype == RubySMB::Dcerpc::PTypes::RESPONSE
|
59
|
-
raise RubySMB::Dcerpc::Error::InvalidPacket, "Not a Response packet"
|
60
|
-
end
|
61
|
-
dcerpc_response
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
data/lib/ruby_smb/smb2/dcerpc.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
module RubySMB
|
2
|
-
module SMB2
|
3
|
-
module Dcerpc
|
4
|
-
|
5
|
-
def net_share_enum_all(host)
|
6
|
-
bind(endpoint: RubySMB::Dcerpc::Srvsvc)
|
7
|
-
|
8
|
-
response = request(RubySMB::Dcerpc::Srvsvc::NET_SHARE_ENUM_ALL, host: host)
|
9
|
-
|
10
|
-
shares = RubySMB::Dcerpc::Srvsvc::NetShareEnumAll.parse_response(response.stub.to_binary_s)
|
11
|
-
shares.map{|s|{name: s[0], type: s[1], comment: s[2]}}
|
12
|
-
end
|
13
|
-
|
14
|
-
def bind(options={})
|
15
|
-
bind_req = RubySMB::Dcerpc::Bind.new(options)
|
16
|
-
write(data: bind_req.to_binary_s)
|
17
|
-
@size = 1024
|
18
|
-
dcerpc_raw_response = read()
|
19
|
-
begin
|
20
|
-
dcerpc_response = RubySMB::Dcerpc::BindAck.read(dcerpc_raw_response)
|
21
|
-
rescue IOError
|
22
|
-
raise RubySMB::Dcerpc::Error::InvalidPacket, "Error reading the DCERPC response"
|
23
|
-
end
|
24
|
-
unless dcerpc_response.pdu_header.ptype == RubySMB::Dcerpc::PTypes::BIND_ACK
|
25
|
-
raise RubySMB::Dcerpc::Error::BindError, "Not a BindAck packet"
|
26
|
-
end
|
27
|
-
|
28
|
-
res_list = dcerpc_response.p_result_list
|
29
|
-
if res_list.n_results == 0 ||
|
30
|
-
res_list.p_results[0].result != RubySMB::Dcerpc::BindAck::ACCEPTANCE
|
31
|
-
raise RubySMB::Dcerpc::Error::BindError,
|
32
|
-
"Bind Failed (Result: #{res_list.p_results[0].result}, Reason: #{res_list.p_results[0].reason})"
|
33
|
-
end
|
34
|
-
dcerpc_response
|
35
|
-
end
|
36
|
-
|
37
|
-
def request(opnum, options={})
|
38
|
-
dcerpc_request = RubySMB::Dcerpc::Request.new({ :opnum => opnum }, options)
|
39
|
-
ioctl_response = ioctl_send_recv(dcerpc_request, options)
|
40
|
-
begin
|
41
|
-
dcerpc_response = RubySMB::Dcerpc::Response.read(ioctl_response.output_data)
|
42
|
-
rescue IOError
|
43
|
-
raise RubySMB::Dcerpc::Error::InvalidPacket, "Error reading the DCERPC response"
|
44
|
-
end
|
45
|
-
unless dcerpc_response.pdu_header.ptype == RubySMB::Dcerpc::PTypes::RESPONSE
|
46
|
-
raise RubySMB::Dcerpc::Error::InvalidPacket, "Not a Response packet"
|
47
|
-
end
|
48
|
-
dcerpc_response
|
49
|
-
end
|
50
|
-
|
51
|
-
def ioctl_send_recv(action, options={})
|
52
|
-
request = set_header_fields(RubySMB::SMB2::Packet::IoctlRequest.new(options))
|
53
|
-
request.ctl_code = 0x0011C017
|
54
|
-
request.flags.is_fsctl = 0x00000001
|
55
|
-
request.buffer = action.to_binary_s
|
56
|
-
ioctl_raw_response = @tree.client.send_recv(request)
|
57
|
-
ioctl_response = RubySMB::SMB2::Packet::IoctlResponse.read(ioctl_raw_response)
|
58
|
-
unless ioctl_response.smb2_header.command == RubySMB::SMB2::Commands::IOCTL
|
59
|
-
raise RubySMB::Error::InvalidPacket, 'Not a IoctlResponse packet'
|
60
|
-
end
|
61
|
-
unless ioctl_response.status_code == WindowsError::NTStatus::STATUS_SUCCESS
|
62
|
-
raise RubySMB::Error::UnexpectedStatusCode, ioctl_response.status_code.name
|
63
|
-
end
|
64
|
-
ioctl_response
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe RubySMB::SMB1::Packet::EmptyPacket do
|
4
|
-
subject(:packet) { described_class.new }
|
5
|
-
|
6
|
-
describe '#smb_header' do
|
7
|
-
subject(:header) { packet.smb_header }
|
8
|
-
|
9
|
-
it 'is a standard SMB Header' do
|
10
|
-
expect(header).to be_a RubySMB::SMB1::SMBHeader
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '#parameter_block' do
|
15
|
-
subject(:parameter_block) { packet.parameter_block }
|
16
|
-
|
17
|
-
it 'is a standard ParameterBlock' do
|
18
|
-
expect(parameter_block).to be_a RubySMB::SMB1::ParameterBlock
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'should be empty' do
|
22
|
-
expect(parameter_block.to_binary_s).to eq "\x00"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#data_block' do
|
27
|
-
subject(:data_block) { packet.data_block }
|
28
|
-
|
29
|
-
it 'is a standard DataBlock' do
|
30
|
-
expect(data_block).to be_a RubySMB::SMB1::DataBlock
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'should be empty' do
|
34
|
-
expect(data_block.to_binary_s).to eq "\x00\x00"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|