ruby_smb 2.0.9 → 2.0.13
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/.github/workflows/verify.yml +5 -15
- data/examples/auth_capture.rb +71 -0
- data/examples/dump_secrets_from_sid.rb +207 -0
- data/examples/enum_domain_users.rb +75 -0
- data/examples/get_computer_info.rb +42 -0
- data/examples/query_service_status.rb +42 -4
- data/lib/ruby_smb/client/negotiation.rb +1 -1
- data/lib/ruby_smb/client.rb +10 -20
- data/lib/ruby_smb/dcerpc/bind.rb +28 -20
- data/lib/ruby_smb/dcerpc/bind_ack.rb +29 -28
- data/lib/ruby_smb/dcerpc/client.rb +542 -0
- data/lib/ruby_smb/dcerpc/drsr/drs_bind_request.rb +24 -0
- data/lib/ruby_smb/dcerpc/drsr/drs_bind_response.rb +26 -0
- data/lib/ruby_smb/dcerpc/drsr/drs_crack_names_request.rb +57 -0
- data/lib/ruby_smb/dcerpc/drsr/drs_crack_names_response.rb +76 -0
- data/lib/ruby_smb/dcerpc/drsr/drs_domain_controller_info_request.rb +46 -0
- data/lib/ruby_smb/dcerpc/drsr/drs_domain_controller_info_response.rb +168 -0
- data/lib/ruby_smb/dcerpc/drsr/drs_extensions.rb +56 -0
- data/lib/ruby_smb/dcerpc/drsr/drs_get_nc_changes_request.rb +121 -0
- data/lib/ruby_smb/dcerpc/drsr/drs_get_nc_changes_response.rb +118 -0
- data/lib/ruby_smb/dcerpc/drsr/drs_unbind_request.rb +24 -0
- data/lib/ruby_smb/dcerpc/drsr/drs_unbind_response.rb +26 -0
- data/lib/ruby_smb/dcerpc/drsr.rb +909 -0
- data/lib/ruby_smb/dcerpc/epm/epm_ept_map_request.rb +26 -0
- data/lib/ruby_smb/dcerpc/epm/epm_ept_map_response.rb +25 -0
- data/lib/ruby_smb/dcerpc/epm/epm_twrt.rb +211 -0
- data/lib/ruby_smb/dcerpc/epm.rb +75 -0
- data/lib/ruby_smb/dcerpc/error.rb +17 -0
- data/lib/ruby_smb/dcerpc/ndr.rb +1159 -297
- data/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_request.rb +3 -13
- data/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_response.rb +3 -3
- data/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_request.rb +3 -13
- data/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_response.rb +1 -1
- data/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_request.rb +3 -11
- data/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_response.rb +1 -1
- data/lib/ruby_smb/dcerpc/netlogon.rb +5 -4
- data/lib/ruby_smb/dcerpc/p_syntax_id_t.rb +4 -3
- data/lib/ruby_smb/dcerpc/pdu_header.rb +7 -7
- data/lib/ruby_smb/dcerpc/ptypes.rb +1 -0
- data/lib/ruby_smb/dcerpc/request.rb +79 -32
- data/lib/ruby_smb/dcerpc/response.rb +45 -10
- data/lib/ruby_smb/dcerpc/rpc_auth3.rb +28 -0
- data/lib/ruby_smb/dcerpc/rpc_security_attributes.rb +11 -11
- data/lib/ruby_smb/dcerpc/rrp_rpc_unicode_string.rb +118 -0
- data/lib/ruby_smb/dcerpc/samr/rpc_sid.rb +150 -0
- data/lib/ruby_smb/dcerpc/samr/samr_close_handle_request.rb +23 -0
- data/lib/ruby_smb/dcerpc/samr/samr_close_handle_response.rb +24 -0
- data/lib/ruby_smb/dcerpc/samr/samr_connect_request.rb +32 -0
- data/lib/ruby_smb/dcerpc/samr/samr_connect_response.rb +23 -0
- data/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_request.rb +26 -0
- data/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_response.rb +55 -0
- data/lib/ruby_smb/dcerpc/samr/samr_get_alias_membership_request.rb +48 -0
- data/lib/ruby_smb/dcerpc/samr/samr_get_alias_membership_response.rb +38 -0
- data/lib/ruby_smb/dcerpc/samr/samr_get_groups_for_user_request.rb +23 -0
- data/lib/ruby_smb/dcerpc/samr/samr_get_groups_for_user_response.rb +48 -0
- data/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_request.rb +24 -0
- data/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_response.rb +25 -0
- data/lib/ruby_smb/dcerpc/samr/samr_open_domain_request.rb +27 -0
- data/lib/ruby_smb/dcerpc/samr/samr_open_domain_response.rb +24 -0
- data/lib/ruby_smb/dcerpc/samr/samr_open_user_request.rb +26 -0
- data/lib/ruby_smb/dcerpc/samr/samr_open_user_response.rb +24 -0
- data/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_request.rb +23 -0
- data/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_response.rb +23 -0
- data/lib/ruby_smb/dcerpc/samr.rb +613 -0
- data/lib/ruby_smb/dcerpc/sec_trailer.rb +26 -0
- data/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all.rb +56 -79
- data/lib/ruby_smb/dcerpc/srvsvc.rb +27 -4
- data/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_request.rb +13 -25
- data/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_response.rb +2 -2
- data/lib/ruby_smb/dcerpc/svcctl/close_service_handle_response.rb +1 -1
- data/lib/ruby_smb/dcerpc/svcctl/control_service_request.rb +1 -1
- data/lib/ruby_smb/dcerpc/svcctl/control_service_response.rb +1 -1
- data/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_request.rb +4 -14
- data/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_response.rb +1 -1
- data/lib/ruby_smb/dcerpc/svcctl/open_service_w_request.rb +3 -11
- data/lib/ruby_smb/dcerpc/svcctl/open_service_w_response.rb +1 -1
- data/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_request.rb +1 -1
- data/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_response.rb +12 -11
- data/lib/ruby_smb/dcerpc/svcctl/query_service_status_response.rb +1 -1
- data/lib/ruby_smb/dcerpc/svcctl/service_status.rb +9 -8
- data/lib/ruby_smb/dcerpc/svcctl/start_service_w_request.rb +3 -3
- data/lib/ruby_smb/dcerpc/svcctl/start_service_w_response.rb +1 -1
- data/lib/ruby_smb/dcerpc/svcctl.rb +1 -3
- data/lib/ruby_smb/dcerpc/uuid.rb +3 -0
- data/lib/ruby_smb/dcerpc/winreg/close_key_response.rb +2 -2
- data/lib/ruby_smb/dcerpc/winreg/create_key_request.rb +2 -13
- data/lib/ruby_smb/dcerpc/winreg/create_key_response.rb +3 -3
- data/lib/ruby_smb/dcerpc/winreg/enum_key_request.rb +3 -20
- data/lib/ruby_smb/dcerpc/winreg/enum_key_response.rb +3 -20
- data/lib/ruby_smb/dcerpc/winreg/enum_value_request.rb +5 -14
- data/lib/ruby_smb/dcerpc/winreg/enum_value_response.rb +5 -14
- data/lib/ruby_smb/dcerpc/winreg/open_key_request.rb +1 -9
- data/lib/ruby_smb/dcerpc/winreg/open_key_response.rb +4 -3
- data/lib/ruby_smb/dcerpc/winreg/open_root_key_request.rb +5 -6
- data/lib/ruby_smb/dcerpc/winreg/open_root_key_response.rb +2 -2
- data/lib/ruby_smb/dcerpc/winreg/query_info_key_response.rb +9 -18
- data/lib/ruby_smb/dcerpc/winreg/query_value_request.rb +4 -14
- data/lib/ruby_smb/dcerpc/winreg/query_value_response.rb +7 -15
- data/lib/ruby_smb/dcerpc/winreg/regsam.rb +3 -1
- data/lib/ruby_smb/dcerpc/winreg/save_key_request.rb +0 -9
- data/lib/ruby_smb/dcerpc/winreg/save_key_response.rb +1 -1
- data/lib/ruby_smb/dcerpc/winreg.rb +10 -14
- data/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_request.rb +26 -0
- data/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_response.rb +88 -0
- data/lib/ruby_smb/dcerpc/wkssvc.rb +65 -0
- data/lib/ruby_smb/dcerpc.rb +41 -11
- data/lib/ruby_smb/dialect.rb +45 -0
- data/lib/ruby_smb/dispatcher/base.rb +1 -1
- data/lib/ruby_smb/field/file_time.rb +1 -1
- data/lib/ruby_smb/field/string16.rb +5 -1
- data/lib/ruby_smb/gss/provider/authenticator.rb +42 -0
- data/lib/ruby_smb/gss/provider/ntlm.rb +303 -0
- data/lib/ruby_smb/gss/provider.rb +35 -0
- data/lib/ruby_smb/gss.rb +56 -63
- data/lib/ruby_smb/ntlm.rb +61 -0
- data/lib/ruby_smb/server/server_client/negotiation.rb +156 -0
- data/lib/ruby_smb/server/server_client/session_setup.rb +82 -0
- data/lib/ruby_smb/server/server_client.rb +162 -0
- data/lib/ruby_smb/server.rb +54 -0
- data/lib/ruby_smb/signing.rb +59 -0
- data/lib/ruby_smb/smb1/packet/negotiate_response.rb +11 -11
- data/lib/ruby_smb/smb1/packet/negotiate_response_extended.rb +1 -1
- data/lib/ruby_smb/smb1/packet/session_setup_request.rb +1 -1
- data/lib/ruby_smb/smb1/pipe.rb +4 -0
- data/lib/ruby_smb/smb1/tree.rb +1 -1
- data/lib/ruby_smb/smb2/negotiate_context.rb +18 -2
- data/lib/ruby_smb/smb2/packet/negotiate_request.rb +9 -0
- data/lib/ruby_smb/smb2/packet/negotiate_response.rb +0 -1
- data/lib/ruby_smb/smb2/packet/session_setup_response.rb +2 -2
- data/lib/ruby_smb/smb2/packet/tree_connect_request.rb +1 -1
- data/lib/ruby_smb/smb2/pipe.rb +4 -0
- data/lib/ruby_smb/smb2/tree.rb +1 -1
- data/lib/ruby_smb/smb2.rb +3 -1
- data/lib/ruby_smb/version.rb +1 -1
- data/lib/ruby_smb.rb +2 -1
- data/spec/lib/ruby_smb/client_spec.rb +8 -11
- data/spec/lib/ruby_smb/dcerpc/bind_ack_spec.rb +69 -41
- data/spec/lib/ruby_smb/dcerpc/bind_spec.rb +75 -21
- data/spec/lib/ruby_smb/dcerpc/client_spec.rb +714 -0
- data/spec/lib/ruby_smb/dcerpc/drsr_spec.rb +2169 -0
- data/spec/lib/ruby_smb/dcerpc/ndr_spec.rb +3792 -1373
- data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_request_spec.rb +4 -4
- data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_request_spec.rb +4 -4
- data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_request_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_response_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/p_syntax_id_t_spec.rb +18 -4
- data/spec/lib/ruby_smb/dcerpc/pdu_header_spec.rb +27 -1
- data/spec/lib/ruby_smb/dcerpc/request_spec.rb +76 -11
- data/spec/lib/ruby_smb/dcerpc/response_spec.rb +99 -9
- data/spec/lib/ruby_smb/dcerpc/rpc_auth3_spec.rb +75 -0
- data/spec/lib/ruby_smb/dcerpc/rpc_security_attributes_spec.rb +29 -28
- data/spec/lib/ruby_smb/dcerpc/rrp_rpc_unicode_string_spec.rb +340 -0
- data/spec/lib/ruby_smb/dcerpc/samr/rpc_sid_spec.rb +116 -0
- data/spec/lib/ruby_smb/dcerpc/samr/samr_close_handle_request_spec.rb +40 -0
- data/spec/lib/ruby_smb/dcerpc/samr/samr_close_handle_response_spec.rb +48 -0
- data/spec/lib/ruby_smb/dcerpc/samr/samr_connect_request_spec.rb +56 -0
- data/spec/lib/ruby_smb/dcerpc/samr/samr_connect_response_spec.rb +47 -0
- data/spec/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_request_spec.rb +63 -0
- data/spec/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_response_spec.rb +265 -0
- data/spec/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_request_spec.rb +52 -0
- data/spec/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_response_spec.rb +36 -0
- data/spec/lib/ruby_smb/dcerpc/samr/samr_open_domain_request_spec.rb +56 -0
- data/spec/lib/ruby_smb/dcerpc/samr/samr_open_domain_response_spec.rb +48 -0
- data/spec/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_request_spec.rb +48 -0
- data/spec/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_response_spec.rb +42 -0
- data/spec/lib/ruby_smb/dcerpc/samr_spec.rb +420 -0
- data/spec/lib/ruby_smb/dcerpc/sec_trailer_spec.rb +92 -0
- data/spec/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all_spec.rb +149 -110
- data/spec/lib/ruby_smb/dcerpc/srvsvc_spec.rb +21 -17
- data/spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_request_spec.rb +56 -79
- data/spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_response_spec.rb +4 -4
- data/spec/lib/ruby_smb/dcerpc/svcctl/close_service_handle_response_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/svcctl/control_service_request_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/svcctl/control_service_response_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_request_spec.rb +19 -29
- data/spec/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_response_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/svcctl/open_service_w_request_spec.rb +9 -15
- data/spec/lib/ruby_smb/dcerpc/svcctl/open_service_w_response_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_request_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_response_spec.rb +22 -22
- data/spec/lib/ruby_smb/dcerpc/svcctl/query_service_status_response_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/svcctl/service_status_spec.rb +18 -14
- data/spec/lib/ruby_smb/dcerpc/svcctl/start_service_w_request_spec.rb +5 -4
- data/spec/lib/ruby_smb/dcerpc/svcctl/start_service_w_response_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/svcctl_spec.rb +1 -5
- data/spec/lib/ruby_smb/dcerpc/uuid_spec.rb +15 -23
- data/spec/lib/ruby_smb/dcerpc/winreg/close_key_response_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/winreg/create_key_request_spec.rb +4 -41
- data/spec/lib/ruby_smb/dcerpc/winreg/create_key_response_spec.rb +4 -4
- data/spec/lib/ruby_smb/dcerpc/winreg/enum_key_request_spec.rb +4 -52
- data/spec/lib/ruby_smb/dcerpc/winreg/enum_key_response_spec.rb +4 -56
- data/spec/lib/ruby_smb/dcerpc/winreg/enum_value_request_spec.rb +10 -34
- data/spec/lib/ruby_smb/dcerpc/winreg/enum_value_response_spec.rb +10 -34
- data/spec/lib/ruby_smb/dcerpc/winreg/open_key_request_spec.rb +2 -26
- data/spec/lib/ruby_smb/dcerpc/winreg/open_key_response_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/winreg/open_root_key_request_spec.rb +17 -25
- data/spec/lib/ruby_smb/dcerpc/winreg/open_root_key_response_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/winreg/query_info_key_response_spec.rb +20 -44
- data/spec/lib/ruby_smb/dcerpc/winreg/query_value_request_spec.rb +8 -32
- data/spec/lib/ruby_smb/dcerpc/winreg/query_value_response_spec.rb +10 -22
- data/spec/lib/ruby_smb/dcerpc/winreg/regsam_spec.rb +4 -0
- data/spec/lib/ruby_smb/dcerpc/winreg/save_key_request_spec.rb +0 -12
- data/spec/lib/ruby_smb/dcerpc/winreg/save_key_response_spec.rb +2 -2
- data/spec/lib/ruby_smb/dcerpc/winreg_spec.rb +18 -47
- data/spec/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_request_spec.rb +43 -0
- data/spec/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_response_spec.rb +410 -0
- data/spec/lib/ruby_smb/dcerpc/wkssvc_spec.rb +70 -0
- data/spec/lib/ruby_smb/field/string16_spec.rb +22 -0
- data/spec/lib/ruby_smb/gss/provider/ntlm/account_spec.rb +32 -0
- data/spec/lib/ruby_smb/gss/provider/ntlm/authenticator_spec.rb +101 -0
- data/spec/lib/ruby_smb/gss/provider/ntlm/os_version_spec.rb +32 -0
- data/spec/lib/ruby_smb/gss/provider/ntlm_spec.rb +113 -0
- data/spec/lib/ruby_smb/server/server_client_spec.rb +156 -0
- data/spec/lib/ruby_smb/server_spec.rb +32 -0
- data/spec/lib/ruby_smb/smb1/pipe_spec.rb +18 -37
- data/spec/lib/ruby_smb/smb1/tree_spec.rb +4 -4
- data/spec/lib/ruby_smb/smb2/negotiate_context_spec.rb +2 -2
- data/spec/lib/ruby_smb/smb2/pipe_spec.rb +18 -16
- data/spec/lib/ruby_smb/smb2/tree_spec.rb +5 -5
- data/spec/support/bin_helper.rb +9 -0
- data.tar.gz.sig +2 -1
- metadata +119 -6
- metadata.gz.sig +0 -0
- data/lib/ruby_smb/client/signing.rb +0 -64
- data/lib/ruby_smb/dcerpc/rrp_unicode_string.rb +0 -38
- data/spec/lib/ruby_smb/dcerpc/rrp_unicode_string_spec.rb +0 -135
@@ -1,189 +1,228 @@
|
|
1
|
-
RSpec.describe RubySMB::Dcerpc::Srvsvc::
|
2
|
-
subject(:packet) { described_class.new
|
3
|
-
|
4
|
-
it { is_expected.to respond_to :
|
5
|
-
it { is_expected.to respond_to :
|
6
|
-
it { is_expected.to respond_to :
|
7
|
-
it { is_expected.to respond_to :actual_count }
|
8
|
-
it { is_expected.to respond_to :server_unc }
|
9
|
-
it { is_expected.to respond_to :pad }
|
10
|
-
it { is_expected.to respond_to :level }
|
11
|
-
it { is_expected.to respond_to :ctr }
|
12
|
-
it { is_expected.to respond_to :ctr_referent_id }
|
13
|
-
it { is_expected.to respond_to :ctr_count }
|
14
|
-
it { is_expected.to respond_to :pointer_to_array }
|
15
|
-
it { is_expected.to respond_to :max_buffer }
|
16
|
-
it { is_expected.to respond_to :resume_referent_id }
|
1
|
+
RSpec.describe RubySMB::Dcerpc::Srvsvc::NetShareEnumAllRequest do
|
2
|
+
subject(:packet) { described_class.new }
|
3
|
+
|
4
|
+
it { is_expected.to respond_to :server_name }
|
5
|
+
it { is_expected.to respond_to :info_struct }
|
6
|
+
it { is_expected.to respond_to :prefered_maximum_length }
|
17
7
|
it { is_expected.to respond_to :resume_handle }
|
18
|
-
it { is_expected.to respond_to :opnum }
|
19
8
|
|
20
9
|
it 'is little endian' do
|
21
10
|
expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
|
22
11
|
end
|
23
12
|
|
24
|
-
|
25
|
-
it '
|
26
|
-
expect
|
13
|
+
describe '#server_name' do
|
14
|
+
it 'is a SrvsvcHandle' do
|
15
|
+
expect(packet.server_name).to be_a RubySMB::Dcerpc::Srvsvc::SrvsvcHandle
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#info_struct' do
|
20
|
+
it 'is a LpshareEnumStruct' do
|
21
|
+
expect(packet.info_struct).to be_a RubySMB::Dcerpc::Srvsvc::LpshareEnumStruct
|
27
22
|
end
|
28
23
|
end
|
29
24
|
|
30
|
-
describe '#
|
31
|
-
it '
|
32
|
-
expect(packet.
|
25
|
+
describe '#prefered_maximum_length' do
|
26
|
+
it 'is a NdrUint32' do
|
27
|
+
expect(packet.prefered_maximum_length).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
33
28
|
end
|
34
29
|
|
35
|
-
it '
|
36
|
-
expect(packet.
|
30
|
+
it 'has a default value of 0xFFFFFFFF' do
|
31
|
+
expect(packet.prefered_maximum_length).to eq(0xFFFFFFFF)
|
37
32
|
end
|
38
33
|
end
|
39
34
|
|
40
|
-
describe '#
|
41
|
-
it '
|
42
|
-
expect(packet.
|
35
|
+
describe '#resume_handle' do
|
36
|
+
it 'is a NdrUint32Ptr' do
|
37
|
+
expect(packet.resume_handle).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
|
43
38
|
end
|
44
39
|
|
45
|
-
it '
|
46
|
-
expect(packet.
|
40
|
+
it 'has a default value of 0' do
|
41
|
+
expect(packet.resume_handle).to eq(0)
|
47
42
|
end
|
48
43
|
end
|
49
44
|
|
50
|
-
describe '#
|
51
|
-
it '
|
52
|
-
expect(packet.
|
45
|
+
describe '#initialize_instance' do
|
46
|
+
it 'sets #opnum to NET_SHARE_ENUM_ALL constant' do
|
47
|
+
expect(packet.opnum).to eq(RubySMB::Dcerpc::Srvsvc::NET_SHARE_ENUM_ALL)
|
53
48
|
end
|
49
|
+
end
|
50
|
+
end
|
54
51
|
|
55
|
-
|
56
|
-
|
57
|
-
|
52
|
+
RSpec.describe RubySMB::Dcerpc::Srvsvc::NetShareEnumAllResponse do
|
53
|
+
subject(:packet) { described_class.new }
|
54
|
+
|
55
|
+
it { is_expected.to respond_to :info_struct }
|
56
|
+
it { is_expected.to respond_to :total_entries }
|
57
|
+
it { is_expected.to respond_to :resume_handle }
|
58
|
+
it { is_expected.to respond_to :error_status }
|
59
|
+
|
60
|
+
it 'is little endian' do
|
61
|
+
expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
|
58
62
|
end
|
59
63
|
|
60
|
-
describe '#
|
61
|
-
it '
|
62
|
-
expect(packet.
|
64
|
+
describe '#info_struct' do
|
65
|
+
it 'is a LpshareEnumStruct' do
|
66
|
+
expect(packet.info_struct).to be_a RubySMB::Dcerpc::Srvsvc::LpshareEnumStruct
|
63
67
|
end
|
68
|
+
end
|
64
69
|
|
65
|
-
|
66
|
-
|
70
|
+
describe '#total_entries' do
|
71
|
+
it 'is a NdrUint32' do
|
72
|
+
expect(packet.total_entries).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
67
73
|
end
|
68
74
|
end
|
69
75
|
|
70
|
-
describe '#
|
71
|
-
it 'is a
|
72
|
-
expect(packet.
|
76
|
+
describe '#resume_handle' do
|
77
|
+
it 'is a NdrUint32Ptr' do
|
78
|
+
expect(packet.resume_handle).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
|
73
79
|
end
|
80
|
+
end
|
74
81
|
|
75
|
-
|
76
|
-
|
82
|
+
describe '#error_status' do
|
83
|
+
it 'is a NdrUint32' do
|
84
|
+
expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
77
85
|
end
|
78
86
|
end
|
79
87
|
|
80
|
-
describe '#
|
81
|
-
it '
|
82
|
-
expect(packet.
|
88
|
+
describe '#initialize_instance' do
|
89
|
+
it 'sets #opnum to NET_SHARE_ENUM_ALL constant' do
|
90
|
+
expect(packet.opnum).to eq(RubySMB::Dcerpc::Srvsvc::NET_SHARE_ENUM_ALL)
|
83
91
|
end
|
84
92
|
end
|
93
|
+
end
|
94
|
+
|
95
|
+
RSpec.describe RubySMB::Dcerpc::Srvsvc::LpshareEnumStruct do
|
96
|
+
it 'is a NdrStruct' do
|
97
|
+
expect(described_class).to be < RubySMB::Dcerpc::Ndr::NdrStruct
|
98
|
+
end
|
99
|
+
|
100
|
+
subject(:packet) { described_class.new }
|
101
|
+
|
102
|
+
it { is_expected.to respond_to :level }
|
103
|
+
it { is_expected.to respond_to :switch_value }
|
104
|
+
it { is_expected.to respond_to :share_info }
|
85
105
|
|
86
106
|
describe '#level' do
|
87
|
-
it '
|
88
|
-
expect(packet.level).to be_a
|
107
|
+
it 'is a NdrUint32' do
|
108
|
+
expect(packet.level).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
89
109
|
end
|
90
110
|
|
91
|
-
it '
|
111
|
+
it 'has a default value of 1' do
|
92
112
|
expect(packet.level).to eq 1
|
93
113
|
end
|
94
114
|
end
|
95
115
|
|
96
|
-
describe '#
|
97
|
-
it '
|
98
|
-
expect(packet.
|
116
|
+
describe '#switch_value' do
|
117
|
+
it 'is a NdrUint32' do
|
118
|
+
expect(packet.switch_value).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
99
119
|
end
|
100
120
|
|
101
|
-
it '
|
102
|
-
expect(packet.
|
121
|
+
it 'has a default value set to the #level value' do
|
122
|
+
expect(packet.switch_value).to eq packet.level
|
103
123
|
end
|
104
|
-
end
|
105
124
|
|
106
|
-
|
107
|
-
|
108
|
-
expect(packet.ctr_referent_id).to be_a BinData::Uint32le
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'should have a default value of 1' do
|
112
|
-
expect(packet.ctr_referent_id).to eq 1
|
125
|
+
it 'is an hidden field' do
|
126
|
+
expect(packet.snapshot).to_not have_key(:switch_value)
|
113
127
|
end
|
114
128
|
end
|
115
129
|
|
116
|
-
describe '#
|
117
|
-
it '
|
118
|
-
expect(packet.
|
130
|
+
describe '#share_info' do
|
131
|
+
it 'is a BinData::Choice' do
|
132
|
+
expect(packet.share_info).to be_a BinData::Choice
|
119
133
|
end
|
120
134
|
|
121
|
-
it '
|
122
|
-
expect(packet.
|
135
|
+
it 'selects a structure according to :level value and set the default value' do
|
136
|
+
expect(packet.share_info.snapshot).to eq({ entries_read: 0, buffer: :null })
|
137
|
+
# Trying to with a non existing enum value, since only Level 1 is implemented so far
|
138
|
+
packet.level = 0
|
139
|
+
expect { packet.share_info.snapshot }.to raise_error(IndexError)
|
123
140
|
end
|
124
141
|
end
|
142
|
+
end
|
125
143
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
144
|
+
RSpec.describe RubySMB::Dcerpc::Srvsvc::LpshareInfo1Container do
|
145
|
+
it 'is a ShareInfo1Container' do
|
146
|
+
expect(described_class).to be < RubySMB::Dcerpc::Srvsvc::ShareInfo1Container
|
147
|
+
end
|
148
|
+
it 'is a NDR pointer' do
|
149
|
+
expect(described_class.new).to be_a RubySMB::Dcerpc::Ndr::PointerPlugin
|
150
|
+
end
|
151
|
+
end
|
130
152
|
|
131
|
-
|
132
|
-
|
133
|
-
|
153
|
+
RSpec.describe RubySMB::Dcerpc::Srvsvc::ShareInfo1Container do
|
154
|
+
it 'is a NdrStruct' do
|
155
|
+
expect(described_class).to be < RubySMB::Dcerpc::Ndr::NdrStruct
|
134
156
|
end
|
135
157
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
158
|
+
subject(:packet) { described_class.new }
|
159
|
+
|
160
|
+
it { is_expected.to respond_to :entries_read }
|
161
|
+
it { is_expected.to respond_to :buffer }
|
140
162
|
|
141
|
-
|
142
|
-
|
163
|
+
describe '#entries_read' do
|
164
|
+
it 'is a NdrUint32' do
|
165
|
+
expect(packet.entries_read).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
143
166
|
end
|
144
167
|
end
|
145
168
|
|
146
|
-
describe '#
|
147
|
-
it '
|
148
|
-
expect(packet.
|
169
|
+
describe '#buffer' do
|
170
|
+
it 'is a LpshareInfo1' do
|
171
|
+
expect(packet.buffer).to be_a RubySMB::Dcerpc::Srvsvc::LpshareInfo1
|
149
172
|
end
|
173
|
+
end
|
174
|
+
end
|
150
175
|
|
151
|
-
|
152
|
-
|
153
|
-
|
176
|
+
RSpec.describe RubySMB::Dcerpc::Srvsvc::LpshareInfo1 do
|
177
|
+
it 'is a ShareInfo1' do
|
178
|
+
expect(described_class).to be < RubySMB::Dcerpc::Srvsvc::ShareInfo1
|
179
|
+
end
|
180
|
+
it 'is a NDR pointer' do
|
181
|
+
expect(described_class.new).to be_a RubySMB::Dcerpc::Ndr::PointerPlugin
|
154
182
|
end
|
183
|
+
end
|
155
184
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
185
|
+
RSpec.describe RubySMB::Dcerpc::Srvsvc::ShareInfo1 do
|
186
|
+
it 'is a NdrConfArray' do
|
187
|
+
expect(described_class.new).to be_a RubySMB::Dcerpc::Ndr::NdrConfArray
|
188
|
+
end
|
189
|
+
it 'contains element of type ShareInfo1Element' do
|
190
|
+
expect(described_class.default_parameters[:type]).to eq(:share_info1_element)
|
191
|
+
end
|
192
|
+
end
|
160
193
|
|
161
|
-
|
162
|
-
|
163
|
-
|
194
|
+
RSpec.describe RubySMB::Dcerpc::Srvsvc::ShareInfo1Element do
|
195
|
+
it 'is a NdrStruct' do
|
196
|
+
expect(described_class).to be < RubySMB::Dcerpc::Ndr::NdrStruct
|
164
197
|
end
|
165
198
|
|
166
|
-
|
167
|
-
|
168
|
-
|
199
|
+
subject(:packet) { described_class.new }
|
200
|
+
|
201
|
+
it { is_expected.to respond_to :shi1_netname }
|
202
|
+
it { is_expected.to respond_to :shi1_type }
|
203
|
+
it { is_expected.to respond_to :shi1_remark }
|
204
|
+
|
205
|
+
describe '#shi1_netname' do
|
206
|
+
it 'is a NdrConfVarWideStringz' do
|
207
|
+
expect(packet.shi1_netname).to be_a RubySMB::Dcerpc::Ndr::NdrConfVarWideStringz
|
169
208
|
end
|
170
209
|
end
|
171
210
|
|
172
|
-
describe '#
|
173
|
-
it '
|
174
|
-
expect(packet.
|
211
|
+
describe '#shi1_type' do
|
212
|
+
it 'is a NdrUint32' do
|
213
|
+
expect(packet.shi1_type).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
175
214
|
end
|
215
|
+
end
|
176
216
|
|
177
|
-
|
178
|
-
|
179
|
-
expect(packet.
|
217
|
+
describe '#shi1_remark' do
|
218
|
+
it 'is a NdrConfVarWideStringz' do
|
219
|
+
expect(packet.shi1_remark).to be_a RubySMB::Dcerpc::Ndr::NdrConfVarWideStringz
|
180
220
|
end
|
181
221
|
end
|
222
|
+
end
|
182
223
|
|
183
|
-
|
184
|
-
|
185
|
-
|
224
|
+
RSpec.describe RubySMB::Dcerpc::Srvsvc::SrvsvcHandle do
|
225
|
+
it 'is a NdrWideStringzPtr' do
|
226
|
+
expect(described_class).to be < RubySMB::Dcerpc::Ndr::NdrWideStringzPtr
|
186
227
|
end
|
187
228
|
end
|
188
|
-
|
189
|
-
|
@@ -11,20 +11,30 @@ RSpec.describe RubySMB::Dcerpc::Srvsvc do
|
|
11
11
|
let(:host) { '1.2.3.4' }
|
12
12
|
let(:request_packet) { double('NetShareEnumAll request packet') }
|
13
13
|
let(:dcerpc_response) { double('DCERPC response') }
|
14
|
+
let(:response) { double('NetShareEnumAllResponse') }
|
14
15
|
let(:shares) do
|
15
16
|
[
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
RubySMB::Dcerpc::Srvsvc::ShareInfo1Element.new({:shi1_netname=>'C$', :shi1_type=>0, :shi1_remark=>'Default share'}),
|
18
|
+
RubySMB::Dcerpc::Srvsvc::ShareInfo1Element.new({:shi1_netname=>'Shared', :shi1_type=>0, :shi1_remark=>''}),
|
19
|
+
RubySMB::Dcerpc::Srvsvc::ShareInfo1Element.new({:shi1_netname=>'IPC$', :shi1_type=>2147483651, :shi1_remark=>'Remote IPC'}),
|
20
|
+
RubySMB::Dcerpc::Srvsvc::ShareInfo1Element.new({:shi1_netname=>'ADMIN$', :shi1_type=>2147483648, :shi1_remark=>'Remote Admin'})
|
21
|
+
]
|
22
|
+
end
|
23
|
+
let(:result) do
|
24
|
+
[
|
25
|
+
{name: 'C$', type: 'DISK', comment: 'Default share'},
|
26
|
+
{name: 'Shared', type: 'DISK', comment: ''},
|
27
|
+
{name: 'IPC$', type: 'IPC|SPECIAL', comment: 'Remote IPC'},
|
28
|
+
{name: 'ADMIN$', type: 'DISK|SPECIAL', comment: 'Remote Admin'}
|
20
29
|
]
|
21
30
|
end
|
22
31
|
|
23
32
|
before :example do
|
24
33
|
allow(srvsvc).to receive(:bind)
|
25
|
-
allow(RubySMB::Dcerpc::Srvsvc::
|
34
|
+
allow(RubySMB::Dcerpc::Srvsvc::NetShareEnumAllRequest).to receive(:new).and_return(request_packet)
|
26
35
|
allow(srvsvc).to receive(:dcerpc_request).and_return(dcerpc_response)
|
27
|
-
allow(RubySMB::Dcerpc::Srvsvc::
|
36
|
+
allow(RubySMB::Dcerpc::Srvsvc::NetShareEnumAllResponse).to receive(:read).and_return(response)
|
37
|
+
allow(response).to receive_message_chain(:info_struct, :share_info, :buffer).and_return(shares)
|
28
38
|
end
|
29
39
|
|
30
40
|
it 'calls #bind with the expected arguments' do
|
@@ -32,9 +42,9 @@ RSpec.describe RubySMB::Dcerpc::Srvsvc do
|
|
32
42
|
expect(srvsvc).to have_received(:bind).with(endpoint: RubySMB::Dcerpc::Srvsvc)
|
33
43
|
end
|
34
44
|
|
35
|
-
it 'creates the expected
|
45
|
+
it 'creates the expected NetShareEnumAllRequest packet' do
|
36
46
|
srvsvc.net_share_enum_all(host)
|
37
|
-
expect(RubySMB::Dcerpc::Srvsvc::
|
47
|
+
expect(RubySMB::Dcerpc::Srvsvc::NetShareEnumAllRequest).to have_received(:new).with(server_name: "\\\\#{host}")
|
38
48
|
end
|
39
49
|
|
40
50
|
it 'calls #request with the expected arguments' do
|
@@ -42,19 +52,13 @@ RSpec.describe RubySMB::Dcerpc::Srvsvc do
|
|
42
52
|
expect(srvsvc).to have_received(:dcerpc_request).with(request_packet)
|
43
53
|
end
|
44
54
|
|
45
|
-
it 'parse the response with
|
55
|
+
it 'parse the response with NetShareEnumAllResponse' do
|
46
56
|
srvsvc.net_share_enum_all(host)
|
47
|
-
expect(RubySMB::Dcerpc::Srvsvc::
|
57
|
+
expect(RubySMB::Dcerpc::Srvsvc::NetShareEnumAllResponse).to have_received(:read).with(dcerpc_response)
|
48
58
|
end
|
49
59
|
|
50
60
|
it 'returns the remote shares' do
|
51
|
-
|
52
|
-
{:name=>"C$", :type=>"DISK", :comment=>"Default share"},
|
53
|
-
{:name=>"Shared", :type=>"DISK", :comment=>""},
|
54
|
-
{:name=>"IPC$", :type=>"IPC", :comment=>"Remote IPC"},
|
55
|
-
{:name=>"ADMIN$", :type=>"DISK", :comment=>"Remote Admin"},
|
56
|
-
]
|
57
|
-
expect(srvsvc.net_share_enum_all(host)).to eq(output)
|
61
|
+
expect(srvsvc.net_share_enum_all(host)).to eq(result)
|
58
62
|
end
|
59
63
|
end
|
60
64
|
end
|
@@ -6,17 +6,12 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::ChangeServiceConfigWRequest do
|
|
6
6
|
it { is_expected.to respond_to :dw_start_type }
|
7
7
|
it { is_expected.to respond_to :dw_error_control }
|
8
8
|
it { is_expected.to respond_to :lp_binary_path_name }
|
9
|
-
it { is_expected.to respond_to :pad1 }
|
10
9
|
it { is_expected.to respond_to :lp_load_order_group }
|
11
|
-
it { is_expected.to respond_to :pad2 }
|
12
10
|
it { is_expected.to respond_to :dw_tag_id }
|
13
11
|
it { is_expected.to respond_to :lp_dependencies }
|
14
|
-
it { is_expected.to respond_to :pad3 }
|
15
12
|
it { is_expected.to respond_to :dw_depend_size }
|
16
13
|
it { is_expected.to respond_to :lp_service_start_name }
|
17
|
-
it { is_expected.to respond_to :pad4 }
|
18
14
|
it { is_expected.to respond_to :lp_password }
|
19
|
-
it { is_expected.to respond_to :pad5 }
|
20
15
|
it { is_expected.to respond_to :dw_pw_size }
|
21
16
|
it { is_expected.to respond_to :lp_display_name }
|
22
17
|
|
@@ -31,134 +26,116 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::ChangeServiceConfigWRequest do
|
|
31
26
|
end
|
32
27
|
|
33
28
|
describe '#dw_service_type' do
|
34
|
-
it 'is a
|
35
|
-
expect(packet.dw_service_type).to be_a
|
29
|
+
it 'is a NdrUint32' do
|
30
|
+
expect(packet.dw_service_type).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
36
31
|
end
|
37
32
|
end
|
38
33
|
|
39
34
|
describe '#dw_start_type' do
|
40
|
-
it 'is a
|
41
|
-
expect(packet.dw_start_type).to be_a
|
35
|
+
it 'is a NdrUint32' do
|
36
|
+
expect(packet.dw_start_type).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
42
37
|
end
|
43
38
|
end
|
44
39
|
|
45
40
|
describe '#dw_start_type' do
|
46
|
-
it 'is a
|
47
|
-
expect(packet.dw_start_type).to be_a
|
41
|
+
it 'is a NdrUint32' do
|
42
|
+
expect(packet.dw_start_type).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
48
43
|
end
|
49
44
|
end
|
50
45
|
|
51
46
|
describe '#lp_binary_path_name' do
|
52
|
-
it 'is a
|
53
|
-
expect(packet.lp_binary_path_name).to be_a RubySMB::Dcerpc::Ndr::
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe '#pad1' do
|
58
|
-
it 'is a string' do
|
59
|
-
expect(packet.pad1).to be_a BinData::String
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'should keep #lp_load_order_group 4-byte aligned' do
|
63
|
-
packet.lp_binary_path_name = "test"
|
64
|
-
expect(packet.lp_load_order_group.abs_offset % 4).to eq 0
|
47
|
+
it 'is a NdrWideStringPtr structure' do
|
48
|
+
expect(packet.lp_binary_path_name).to be_a RubySMB::Dcerpc::Ndr::NdrWideStringPtr
|
65
49
|
end
|
66
50
|
end
|
67
51
|
|
68
52
|
describe '#lp_load_order_group' do
|
69
|
-
it 'is a
|
70
|
-
expect(packet.lp_load_order_group).to be_a RubySMB::Dcerpc::Ndr::
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe '#pad2' do
|
75
|
-
it 'is a string' do
|
76
|
-
expect(packet.pad1).to be_a BinData::String
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'should keep #dw_tag_id 4-byte aligned' do
|
80
|
-
packet.lp_load_order_group = "test"
|
81
|
-
expect(packet.dw_tag_id.abs_offset % 4).to eq 0
|
53
|
+
it 'is a NdrWideStringPtr structure' do
|
54
|
+
expect(packet.lp_load_order_group).to be_a RubySMB::Dcerpc::Ndr::NdrWideStringPtr
|
82
55
|
end
|
83
56
|
end
|
84
57
|
|
85
58
|
describe '#dw_tag_id' do
|
86
|
-
it 'is a
|
87
|
-
expect(packet.dw_tag_id).to be_a RubySMB::Dcerpc::Ndr::
|
59
|
+
it 'is a NdrUint32Ptr structure' do
|
60
|
+
expect(packet.dw_tag_id).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
|
88
61
|
end
|
89
62
|
end
|
90
63
|
|
91
64
|
describe '#lp_dependencies' do
|
92
|
-
it 'is a
|
93
|
-
expect(packet.lp_dependencies).to be_a RubySMB::Dcerpc::Ndr::
|
65
|
+
it 'is a Ndr::NdrConfArray of Uint8 elements' do
|
66
|
+
expect(packet.lp_dependencies).to be_a RubySMB::Dcerpc::Ndr::NdrConfArray
|
67
|
+
expect(packet.lp_dependencies[0]).to be_a BinData::Uint8
|
94
68
|
end
|
95
69
|
end
|
96
70
|
|
97
|
-
describe '#
|
98
|
-
it 'is a
|
99
|
-
expect(packet.
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'should keep #dw_depend_size 4-byte aligned' do
|
103
|
-
packet.lp_dependencies = [1, 2, 3, 4]
|
104
|
-
expect(packet.dw_depend_size.abs_offset % 4).to eq 0
|
71
|
+
describe '#dw_depend_size' do
|
72
|
+
it 'is a NdrUint32' do
|
73
|
+
expect(packet.dw_depend_size).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
105
74
|
end
|
106
75
|
end
|
107
76
|
|
108
|
-
describe '#
|
109
|
-
it 'is a
|
110
|
-
expect(packet.
|
77
|
+
describe '#lp_service_start_name' do
|
78
|
+
it 'is a NdrWideStringPtr structure' do
|
79
|
+
expect(packet.lp_service_start_name).to be_a RubySMB::Dcerpc::Ndr::NdrWideStringPtr
|
111
80
|
end
|
112
81
|
end
|
113
82
|
|
114
|
-
describe '#
|
115
|
-
it 'is a
|
116
|
-
expect(packet.
|
83
|
+
describe '#lp_password' do
|
84
|
+
it 'is a Ndr::NdrConfArray of Uint8 elements' do
|
85
|
+
expect(packet.lp_password).to be_a RubySMB::Dcerpc::Ndr::NdrConfArray
|
86
|
+
expect(packet.lp_password[0]).to be_a BinData::Uint8
|
117
87
|
end
|
118
88
|
end
|
119
89
|
|
120
|
-
describe '#
|
121
|
-
it 'is a
|
122
|
-
expect(packet.
|
90
|
+
describe '#dw_pw_size' do
|
91
|
+
it 'is a NdrUint32' do
|
92
|
+
expect(packet.dw_pw_size).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
123
93
|
end
|
124
94
|
|
125
|
-
it '
|
126
|
-
packet.
|
127
|
-
expect(packet.
|
95
|
+
it 'is set to the number of elements in #lp_password array' do
|
96
|
+
packet.lp_password = [1, 2, 3, 4, 5]
|
97
|
+
expect(packet.dw_pw_size).to eq(5)
|
128
98
|
end
|
129
99
|
end
|
130
100
|
|
131
|
-
describe '#
|
132
|
-
it 'is a
|
133
|
-
expect(packet.
|
101
|
+
describe '#lp_display_name' do
|
102
|
+
it 'is a NdrWideStringPtr structure' do
|
103
|
+
expect(packet.lp_display_name).to be_a RubySMB::Dcerpc::Ndr::NdrWideStringPtr
|
134
104
|
end
|
135
105
|
end
|
136
106
|
|
137
|
-
|
138
|
-
|
139
|
-
|
107
|
+
it 'should keep #lp_load_order_group 4-byte aligned' do
|
108
|
+
5.times do |i|
|
109
|
+
packet.lp_binary_path_name = "A" * i
|
110
|
+
expect(packet.lp_load_order_group.abs_offset % 4).to eq 0
|
140
111
|
end
|
112
|
+
end
|
141
113
|
|
142
|
-
|
143
|
-
|
144
|
-
|
114
|
+
it 'should keep #dw_tag_id 4-byte aligned' do
|
115
|
+
5.times do |i|
|
116
|
+
packet.lp_load_order_group = "A" * i
|
117
|
+
expect(packet.dw_tag_id.abs_offset % 4).to eq 0
|
145
118
|
end
|
146
119
|
end
|
147
120
|
|
148
|
-
|
149
|
-
|
150
|
-
|
121
|
+
it 'should keep #dw_depend_size 4-byte aligned' do
|
122
|
+
5.times do |i|
|
123
|
+
packet.lp_dependencies = [1] * i
|
124
|
+
expect(packet.dw_depend_size.abs_offset % 4).to eq 0
|
151
125
|
end
|
126
|
+
end
|
152
127
|
|
153
|
-
|
154
|
-
|
155
|
-
|
128
|
+
it 'should keep #lp_password 4-byte aligned' do
|
129
|
+
5.times do |i|
|
130
|
+
packet.lp_service_start_name = "A" * i
|
131
|
+
expect(packet.lp_password.abs_offset % 4).to eq 0
|
156
132
|
end
|
157
133
|
end
|
158
134
|
|
159
|
-
|
160
|
-
|
161
|
-
|
135
|
+
it 'should keep #dw_pw_size 4-byte aligned' do
|
136
|
+
5.times do |i|
|
137
|
+
packet.lp_password = [1] * i
|
138
|
+
expect(packet.dw_pw_size.abs_offset % 4).to eq 0
|
162
139
|
end
|
163
140
|
end
|
164
141
|
|
@@ -9,14 +9,14 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::ChangeServiceConfigWResponse do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
describe '#dw_tag_id' do
|
12
|
-
it 'is a
|
13
|
-
expect(packet.dw_tag_id).to be_a RubySMB::Dcerpc::Ndr::
|
12
|
+
it 'is a NdrUint32Ptr structure' do
|
13
|
+
expect(packet.dw_tag_id).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe '#error_status' do
|
18
|
-
it 'is a
|
19
|
-
expect(packet.error_status).to be_a
|
18
|
+
it 'is a NdrUint32' do
|
19
|
+
expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -15,8 +15,8 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::CloseServiceHandleResponse do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
describe '#error_status' do
|
18
|
-
it 'is a
|
19
|
-
expect(packet.error_status).to be_a
|
18
|
+
it 'is a NdrUint32' do
|
19
|
+
expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|