ruby_smb 2.0.12 → 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 +1 -1
- 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.rb +3 -14
- 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/field/file_time.rb +1 -1
- data/lib/ruby_smb/field/string16.rb +5 -1
- data/lib/ruby_smb/ntlm.rb +18 -2
- data/lib/ruby_smb/smb1/pipe.rb +4 -0
- data/lib/ruby_smb/smb2/pipe.rb +4 -0
- data/lib/ruby_smb/version.rb +1 -1
- data/spec/lib/ruby_smb/client_spec.rb +1 -2
- 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/os_version_spec.rb +1 -1
- data/spec/lib/ruby_smb/smb1/pipe_spec.rb +18 -37
- data/spec/lib/ruby_smb/smb2/pipe_spec.rb +18 -16
- data/spec/support/bin_helper.rb +9 -0
- data.tar.gz.sig +0 -0
- metadata +96 -5
- metadata.gz.sig +0 -0
- data/lib/ruby_smb/dcerpc/rrp_unicode_string.rb +0 -38
- data/spec/lib/ruby_smb/dcerpc/rrp_unicode_string_spec.rb +0 -135
@@ -16,8 +16,8 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::ControlServiceRequest do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
describe '#dw_control' do
|
19
|
-
it 'is a
|
20
|
-
expect(packet.dw_control).to be_a
|
19
|
+
it 'is a NdrUint32' do
|
20
|
+
expect(packet.dw_control).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -15,8 +15,8 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::ControlServiceResponse 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
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
RSpec.describe RubySMB::Dcerpc::Svcctl::SvcctlHandleW do
|
2
2
|
subject(:packet) { described_class.new }
|
3
3
|
|
4
|
-
it 'is
|
5
|
-
expect(described_class).to be < RubySMB::Dcerpc::Ndr::
|
4
|
+
it 'is Ndr::NdrWideStringzPtr subclass' do
|
5
|
+
expect(described_class).to be < RubySMB::Dcerpc::Ndr::NdrWideStringzPtr
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -10,9 +10,7 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::OpenSCManagerWRequest do
|
|
10
10
|
subject(:packet) { described_class.new }
|
11
11
|
|
12
12
|
it { is_expected.to respond_to :lp_machine_name }
|
13
|
-
it { is_expected.to respond_to :pad1 }
|
14
13
|
it { is_expected.to respond_to :lp_database_name }
|
15
|
-
it { is_expected.to respond_to :pad2 }
|
16
14
|
it { is_expected.to respond_to :dw_desired_access }
|
17
15
|
|
18
16
|
it 'is little endian' do
|
@@ -25,43 +23,35 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::OpenSCManagerWRequest do
|
|
25
23
|
end
|
26
24
|
end
|
27
25
|
|
28
|
-
describe '#pad1' do
|
29
|
-
it 'is a string' do
|
30
|
-
expect(packet.pad1).to be_a BinData::String
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'should keep #lp_database_name 4-byte aligned' do
|
34
|
-
packet.lp_machine_name = "test"
|
35
|
-
expect(packet.lp_database_name.abs_offset % 4).to eq 0
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
26
|
describe '#lp_database_name' do
|
40
|
-
it 'is a
|
41
|
-
expect(packet.lp_database_name).to be_a RubySMB::Dcerpc::Ndr::
|
27
|
+
it 'is a Ndr::NdrWideStringzPtr structure' do
|
28
|
+
expect(packet.lp_database_name).to be_a RubySMB::Dcerpc::Ndr::NdrWideStringzPtr
|
42
29
|
end
|
43
30
|
end
|
44
31
|
|
45
|
-
describe '#
|
46
|
-
it 'is a
|
47
|
-
expect(packet.
|
32
|
+
describe '#dw_desired_access' do
|
33
|
+
it 'is a NdrUint32' do
|
34
|
+
expect(packet.dw_desired_access).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
48
35
|
end
|
36
|
+
end
|
49
37
|
|
50
|
-
|
51
|
-
|
52
|
-
expect(packet.
|
38
|
+
describe '#initialize_instance' do
|
39
|
+
it 'sets #opnum to OPEN_SC_MANAGER_W constant' do
|
40
|
+
expect(packet.opnum).to eq(RubySMB::Dcerpc::Svcctl::OPEN_SC_MANAGER_W)
|
53
41
|
end
|
54
42
|
end
|
55
43
|
|
56
|
-
|
57
|
-
|
58
|
-
|
44
|
+
it 'should keep #lp_database_name 4-byte aligned' do
|
45
|
+
5.times do |i|
|
46
|
+
packet.lp_machine_name = "A" * i
|
47
|
+
expect(packet.lp_database_name.abs_offset % 4).to eq 0
|
59
48
|
end
|
60
49
|
end
|
61
50
|
|
62
|
-
|
63
|
-
|
64
|
-
|
51
|
+
it 'should keep #dw_desired_access 4-byte aligned' do
|
52
|
+
5.times do |i|
|
53
|
+
packet.lp_database_name = "A" * i
|
54
|
+
expect(packet.dw_desired_access.abs_offset % 4).to eq 0
|
65
55
|
end
|
66
56
|
end
|
67
57
|
|
@@ -15,8 +15,8 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::OpenSCManagerWResponse 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
|
|
@@ -3,7 +3,6 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::OpenServiceWRequest do
|
|
3
3
|
|
4
4
|
it { is_expected.to respond_to :lp_sc_handle }
|
5
5
|
it { is_expected.to respond_to :lp_service_name }
|
6
|
-
it { is_expected.to respond_to :pad }
|
7
6
|
it { is_expected.to respond_to :dw_desired_access }
|
8
7
|
|
9
8
|
it 'is little endian' do
|
@@ -18,28 +17,23 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::OpenServiceWRequest do
|
|
18
17
|
end
|
19
18
|
|
20
19
|
describe '#lp_service_name' do
|
21
|
-
it 'is a
|
22
|
-
expect(packet.lp_service_name).to be_a RubySMB::Dcerpc::Ndr::
|
20
|
+
it 'is a NdrConfVarWideStringz structure' do
|
21
|
+
expect(packet.lp_service_name).to be_a RubySMB::Dcerpc::Ndr::NdrConfVarWideStringz
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
26
|
-
describe '#
|
27
|
-
it 'is a
|
28
|
-
expect(packet.
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should keep #dw_desired_access 4-byte aligned' do
|
32
|
-
packet.lp_service_name = "test"
|
33
|
-
expect(packet.dw_desired_access.abs_offset % 4).to eq 0
|
25
|
+
describe '#dw_desired_access' do
|
26
|
+
it 'is a NdrUint32' do
|
27
|
+
expect(packet.dw_desired_access).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
34
28
|
end
|
35
29
|
end
|
36
30
|
|
37
|
-
|
38
|
-
|
39
|
-
|
31
|
+
it 'should keep #dw_desired_access 4-byte aligned' do
|
32
|
+
5.times do |i|
|
33
|
+
packet.lp_service_name = "A" * i
|
34
|
+
expect(packet.dw_desired_access.abs_offset % 4).to eq 0
|
40
35
|
end
|
41
36
|
end
|
42
|
-
|
43
37
|
describe '#initialize_instance' do
|
44
38
|
it 'sets #opnum to OPEN_SERVICE_W constant' do
|
45
39
|
expect(packet.opnum).to eq(RubySMB::Dcerpc::Svcctl::OPEN_SERVICE_W)
|
@@ -15,8 +15,8 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::OpenServiceWResponse 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
|
|
@@ -15,8 +15,8 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::QueryServiceConfigWRequest do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
describe '#cb_buf_size' do
|
18
|
-
it 'is a
|
19
|
-
expect(packet.cb_buf_size).to be_a
|
18
|
+
it 'is a NdrUint32' do
|
19
|
+
expect(packet.cb_buf_size).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
RSpec.describe RubySMB::Dcerpc::Svcctl::LpBoundedDword8k do
|
2
2
|
subject(:packet) { described_class.new }
|
3
3
|
|
4
|
-
it 'is
|
5
|
-
expect(described_class).to be <
|
4
|
+
it 'is NdrUint32 subclass' do
|
5
|
+
expect(described_class).to be < RubySMB::Dcerpc::Ndr::NdrUint32
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -24,56 +24,56 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::QueryServiceConfigW do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
describe '#dw_service_type' do
|
27
|
-
it 'is a
|
28
|
-
expect(packet.dw_service_type).to be_a
|
27
|
+
it 'is a NdrUint32' do
|
28
|
+
expect(packet.dw_service_type).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe '#dw_start_type' do
|
33
|
-
it 'is a
|
34
|
-
expect(packet.dw_start_type).to be_a
|
33
|
+
it 'is a NdrUint32' do
|
34
|
+
expect(packet.dw_start_type).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
describe '#dw_error_control' do
|
39
|
-
it 'is a
|
40
|
-
expect(packet.dw_error_control).to be_a
|
39
|
+
it 'is a NdrUint32' do
|
40
|
+
expect(packet.dw_error_control).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
describe '#lp_binary_path_name' do
|
45
|
-
it 'is a
|
46
|
-
expect(packet.lp_binary_path_name).to be_a RubySMB::Dcerpc::Ndr::
|
45
|
+
it 'is a NdrWideStringPtr structure' do
|
46
|
+
expect(packet.lp_binary_path_name).to be_a RubySMB::Dcerpc::Ndr::NdrWideStringPtr
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
describe '#lp_load_order_group' do
|
51
|
-
it 'is a
|
52
|
-
expect(packet.lp_load_order_group).to be_a RubySMB::Dcerpc::Ndr::
|
51
|
+
it 'is a NdrWideStringPtr structure' do
|
52
|
+
expect(packet.lp_load_order_group).to be_a RubySMB::Dcerpc::Ndr::NdrWideStringPtr
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
describe '#dw_tag_id' do
|
57
|
-
it 'is a
|
58
|
-
expect(packet.dw_tag_id).to be_a
|
57
|
+
it 'is a NdrUint32' do
|
58
|
+
expect(packet.dw_tag_id).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
describe '#lp_dependencies' do
|
63
|
-
it 'is a
|
64
|
-
expect(packet.lp_dependencies).to be_a RubySMB::Dcerpc::Ndr::
|
63
|
+
it 'is a NdrWideStringPtr structure' do
|
64
|
+
expect(packet.lp_dependencies).to be_a RubySMB::Dcerpc::Ndr::NdrWideStringPtr
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
68
|
describe '#lp_service_start_name' do
|
69
|
-
it 'is a
|
70
|
-
expect(packet.lp_service_start_name).to be_a RubySMB::Dcerpc::Ndr::
|
69
|
+
it 'is a NdrWideStringPtr structure' do
|
70
|
+
expect(packet.lp_service_start_name).to be_a RubySMB::Dcerpc::Ndr::NdrWideStringPtr
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
describe '#lp_display_name' do
|
75
|
-
it 'is a
|
76
|
-
expect(packet.lp_display_name).to be_a RubySMB::Dcerpc::Ndr::
|
75
|
+
it 'is a NdrWideStringPtr structure' do
|
76
|
+
expect(packet.lp_display_name).to be_a RubySMB::Dcerpc::Ndr::NdrWideStringPtr
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -118,8 +118,8 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::QueryServiceConfigWResponse do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
describe '#error_status' do
|
121
|
-
it 'is a
|
122
|
-
expect(packet.error_status).to be_a
|
121
|
+
it 'is a NdrUint32' do
|
122
|
+
expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -15,8 +15,8 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::QueryServiceStatusResponse 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
|
|
@@ -1,4 +1,8 @@
|
|
1
1
|
RSpec.describe RubySMB::Dcerpc::Svcctl::ServiceStatus do
|
2
|
+
it 'is a NdrStruct' do
|
3
|
+
expect(described_class).to be < RubySMB::Dcerpc::Ndr::NdrStruct
|
4
|
+
end
|
5
|
+
|
2
6
|
subject(:packet) { described_class.new }
|
3
7
|
|
4
8
|
it { is_expected.to respond_to :dw_service_type }
|
@@ -14,44 +18,44 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::ServiceStatus do
|
|
14
18
|
end
|
15
19
|
|
16
20
|
describe '#dw_service_type' do
|
17
|
-
it 'is a
|
18
|
-
expect(packet.dw_service_type).to be_a
|
21
|
+
it 'is a NdrUint32' do
|
22
|
+
expect(packet.dw_service_type).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
19
23
|
end
|
20
24
|
end
|
21
25
|
|
22
26
|
describe '#dw_current_state' do
|
23
|
-
it 'is a
|
24
|
-
expect(packet.dw_current_state).to be_a
|
27
|
+
it 'is a NdrUint32' do
|
28
|
+
expect(packet.dw_current_state).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
25
29
|
end
|
26
30
|
end
|
27
31
|
|
28
32
|
describe '#dw_controls_accepted' do
|
29
|
-
it 'is a
|
30
|
-
expect(packet.dw_controls_accepted).to be_a
|
33
|
+
it 'is a NdrUint32' do
|
34
|
+
expect(packet.dw_controls_accepted).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
31
35
|
end
|
32
36
|
end
|
33
37
|
|
34
38
|
describe '#dw_win32_exit_code' do
|
35
|
-
it 'is a
|
36
|
-
expect(packet.dw_win32_exit_code).to be_a
|
39
|
+
it 'is a NdrUint32' do
|
40
|
+
expect(packet.dw_win32_exit_code).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
37
41
|
end
|
38
42
|
end
|
39
43
|
|
40
44
|
describe '#dw_service_specific_exit_code' do
|
41
|
-
it 'is a
|
42
|
-
expect(packet.dw_service_specific_exit_code).to be_a
|
45
|
+
it 'is a NdrUint32' do
|
46
|
+
expect(packet.dw_service_specific_exit_code).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
46
50
|
describe '#dw_check_point' do
|
47
|
-
it 'is a
|
48
|
-
expect(packet.dw_check_point).to be_a
|
51
|
+
it 'is a NdrUint32' do
|
52
|
+
expect(packet.dw_check_point).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
49
53
|
end
|
50
54
|
end
|
51
55
|
|
52
56
|
describe '#dw_wait_hint' do
|
53
|
-
it 'is a
|
54
|
-
expect(packet.dw_wait_hint).to be_a
|
57
|
+
it 'is a NdrUint32' do
|
58
|
+
expect(packet.dw_wait_hint).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
55
59
|
end
|
56
60
|
end
|
57
61
|
|
@@ -16,14 +16,15 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::StartServiceWRequest do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
describe '#argc' do
|
19
|
-
it 'is a
|
20
|
-
expect(packet.argc).to be_a
|
19
|
+
it 'is a NdrUint32' do
|
20
|
+
expect(packet.argc).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
describe '#argv' do
|
25
|
-
it 'is a
|
26
|
-
expect(packet.argv).to be_a RubySMB::Dcerpc::Ndr::
|
25
|
+
it 'is a Ndr::NdrConfArray of Ndr::NdrWideStringPtr elements' do
|
26
|
+
expect(packet.argv).to be_a RubySMB::Dcerpc::Ndr::NdrConfArray
|
27
|
+
expect(packet.argv[0]).to be_a RubySMB::Dcerpc::Ndr::NdrWideStringPtr
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
@@ -8,8 +8,8 @@ RSpec.describe RubySMB::Dcerpc::Svcctl::StartServiceWResponse do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
describe '#error_status' do
|
11
|
-
it 'is a
|
12
|
-
expect(packet.error_status).to be_a
|
11
|
+
it 'is a NdrUint32' do
|
12
|
+
expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -6,9 +6,6 @@ RSpec.describe RubySMB::Dcerpc::Svcctl do
|
|
6
6
|
name: 'svcctl'
|
7
7
|
)
|
8
8
|
end
|
9
|
-
it 'fail' do
|
10
|
-
expect(true).to be true
|
11
|
-
end
|
12
9
|
|
13
10
|
describe '#open_sc_manager_w' do
|
14
11
|
let(:rhost) { '1.2.3.4' }
|
@@ -390,10 +387,9 @@ RSpec.describe RubySMB::Dcerpc::Svcctl do
|
|
390
387
|
|
391
388
|
it 'sets the provided Service start arguments' do
|
392
389
|
argv = ['my', 'arguments', 'to', 'test']
|
393
|
-
ndr_string_ptrsw = RubySMB::Dcerpc::Ndr::NdrStringPtrsw.new(elements: argv)
|
394
390
|
svcctl.start_service_w(svc_handle, argv)
|
395
391
|
expect(start_service_w_request).to have_received(:argc=).with(argv.size)
|
396
|
-
expect(start_service_w_request).to have_received(:argv=).with(
|
392
|
+
expect(start_service_w_request).to have_received(:argv=).with(argv)
|
397
393
|
end
|
398
394
|
|
399
395
|
it 'sends the expected dcerpc request' do
|
@@ -12,6 +12,10 @@ RSpec.describe RubySMB::Dcerpc::Uuid do
|
|
12
12
|
expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
|
13
13
|
end
|
14
14
|
|
15
|
+
it 'is 4-byte aligned' do
|
16
|
+
expect(packet.eval_parameter(:byte_align)).to eq(4)
|
17
|
+
end
|
18
|
+
|
15
19
|
describe '#time_low' do
|
16
20
|
it 'should be a 32-bit unsigned integer' do
|
17
21
|
expect(packet.time_low).to be_a BinData::Uint32le
|
@@ -78,31 +82,19 @@ RSpec.describe RubySMB::Dcerpc::Uuid do
|
|
78
82
|
expect(packet.clock_seq_low).to eq 0xE8
|
79
83
|
expect(packet.node).to eq [0x08, 0x00, 0x2B, 0x10, 0x48, 0x60]
|
80
84
|
end
|
85
|
+
|
86
|
+
it 'removes surrounding curly brackets' do
|
87
|
+
packet.set("{#{uuid_string}}")
|
88
|
+
expect(packet).to eq(uuid_string)
|
89
|
+
end
|
81
90
|
end
|
82
91
|
end
|
83
92
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
RSpec.describe RubySMB::Dcerpc::Uuid do
|
100
|
-
let(:uuid_string){'8a885d04-1ceb-11c9-9fe8-08002b104860'}
|
101
|
-
let(:uuid){RubySMB::Dcerpc::Uuid.new(initial_value: uuid_string)}
|
102
|
-
|
103
|
-
describe '#initialize' do
|
104
|
-
it 'should create a 16 byte struct' do
|
105
|
-
expect(uuid.do_num_bytes).to be 16
|
106
|
-
end
|
93
|
+
it 'reads its own binary representation and output the same packet' do
|
94
|
+
packet = described_class.new('8a885d04-1ceb-11c9-9fe8-08002b104860')
|
95
|
+
binary = packet.to_binary_s
|
96
|
+
expect(described_class.read(binary)).to eq(packet)
|
107
97
|
end
|
98
|
+
|
108
99
|
end
|
100
|
+
|
@@ -22,8 +22,8 @@ RSpec.describe RubySMB::Dcerpc::Winreg::CloseKeyResponse do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
describe '#error_status' do
|
25
|
-
it 'is a
|
26
|
-
expect(packet.error_status).to be_a
|
25
|
+
it 'is a NdrUint32' do
|
26
|
+
expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -16,13 +16,10 @@ RSpec.describe RubySMB::Dcerpc::Winreg::CreateKeyRequest do
|
|
16
16
|
|
17
17
|
it { is_expected.to respond_to :hkey }
|
18
18
|
it { is_expected.to respond_to :lp_sub_key }
|
19
|
-
it { is_expected.to respond_to :pad1 }
|
20
19
|
it { is_expected.to respond_to :lp_class }
|
21
|
-
it { is_expected.to respond_to :pad2 }
|
22
20
|
it { is_expected.to respond_to :dw_options }
|
23
21
|
it { is_expected.to respond_to :sam_desired }
|
24
22
|
it { is_expected.to respond_to :lp_security_attributes }
|
25
|
-
it { is_expected.to respond_to :pad3 }
|
26
23
|
it { is_expected.to respond_to :lpdw_disposition }
|
27
24
|
|
28
25
|
describe '#hkey' do
|
@@ -37,37 +34,15 @@ RSpec.describe RubySMB::Dcerpc::Winreg::CreateKeyRequest do
|
|
37
34
|
end
|
38
35
|
end
|
39
36
|
|
40
|
-
describe '#pad1' do
|
41
|
-
it 'is a string' do
|
42
|
-
expect(packet.pad1).to be_a BinData::String
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'should keep #lp_class 4-byte aligned' do
|
46
|
-
packet.lp_sub_key = "test"
|
47
|
-
expect(packet.lp_class.abs_offset % 4).to eq 0
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
37
|
describe '#lp_class' do
|
52
38
|
it 'is a RrpUnicodeString structure' do
|
53
39
|
expect(packet.lp_class).to be_a RubySMB::Dcerpc::RrpUnicodeString
|
54
40
|
end
|
55
41
|
end
|
56
42
|
|
57
|
-
describe '#pad2' do
|
58
|
-
it 'is a string' do
|
59
|
-
expect(packet.pad1).to be_a BinData::String
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'should keep #dw_options 4-byte aligned' do
|
63
|
-
packet.lp_class = "test"
|
64
|
-
expect(packet.dw_options.abs_offset % 4).to eq 0
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
43
|
describe '#dw_options' do
|
69
|
-
it 'is a
|
70
|
-
expect(packet.dw_options).to be_a
|
44
|
+
it 'is a NdrUint32' do
|
45
|
+
expect(packet.dw_options).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
71
46
|
end
|
72
47
|
end
|
73
48
|
|
@@ -83,21 +58,9 @@ RSpec.describe RubySMB::Dcerpc::Winreg::CreateKeyRequest do
|
|
83
58
|
end
|
84
59
|
end
|
85
60
|
|
86
|
-
describe '#pad3' do
|
87
|
-
it 'is a string' do
|
88
|
-
expect(packet.pad1).to be_a BinData::String
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'should keep #lpdw_disposition 4-byte aligned' do
|
92
|
-
sc = RubySMB::Dcerpc::RpcSecurityDescriptor.new(lp_security_descriptor: [1,2,3,4])
|
93
|
-
packet.lp_security_attributes = RubySMB::Dcerpc::RpcSecurityAttributes.new(rpc_security_descriptor: sc)
|
94
|
-
expect(packet.lpdw_disposition.abs_offset % 4).to eq 0
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
61
|
describe '#lpdw_disposition' do
|
99
|
-
it 'is a
|
100
|
-
expect(packet.lpdw_disposition).to be_a RubySMB::Dcerpc::Ndr::
|
62
|
+
it 'is a NdrUint32Ptr structure' do
|
63
|
+
expect(packet.lpdw_disposition).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
|
101
64
|
end
|
102
65
|
end
|
103
66
|
|
@@ -24,14 +24,14 @@ RSpec.describe RubySMB::Dcerpc::Winreg::CreateKeyResponse do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
describe '#lpdw_disposition' do
|
27
|
-
it 'is a
|
28
|
-
expect(packet.lpdw_disposition).to be_a RubySMB::Dcerpc::Ndr::
|
27
|
+
it 'is a Ndr::NdrUint32Ptr structure' do
|
28
|
+
expect(packet.lpdw_disposition).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe '#error_status' do
|
33
|
-
it 'is a
|
34
|
-
expect(packet.error_status).to be_a
|
33
|
+
it 'is a NdrUint32' do
|
34
|
+
expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|