ruby_smb 2.0.10 → 3.0.0
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 -16
- 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/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.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/smb2/negotiate_context_spec.rb +2 -2
- 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 +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
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_smb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Metasploit Hackers
|
@@ -97,7 +97,7 @@ cert_chain:
|
|
97
97
|
EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
|
98
98
|
9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
|
99
99
|
-----END CERTIFICATE-----
|
100
|
-
date:
|
100
|
+
date: 2022-01-05 00:00:00.000000000 Z
|
101
101
|
dependencies:
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: redcarpet
|
@@ -258,10 +258,14 @@ files:
|
|
258
258
|
- Rakefile
|
259
259
|
- examples/anonymous_auth.rb
|
260
260
|
- examples/append_file.rb
|
261
|
+
- examples/auth_capture.rb
|
261
262
|
- examples/authenticate.rb
|
262
263
|
- examples/delete_file.rb
|
264
|
+
- examples/dump_secrets_from_sid.rb
|
265
|
+
- examples/enum_domain_users.rb
|
263
266
|
- examples/enum_registry_key.rb
|
264
267
|
- examples/enum_registry_values.rb
|
268
|
+
- examples/get_computer_info.rb
|
265
269
|
- examples/list_directory.rb
|
266
270
|
- examples/negotiate.rb
|
267
271
|
- examples/negotiate_with_netbios_service.rb
|
@@ -280,7 +284,6 @@ files:
|
|
280
284
|
- lib/ruby_smb/client/echo.rb
|
281
285
|
- lib/ruby_smb/client/encryption.rb
|
282
286
|
- lib/ruby_smb/client/negotiation.rb
|
283
|
-
- lib/ruby_smb/client/signing.rb
|
284
287
|
- lib/ruby_smb/client/tree_connect.rb
|
285
288
|
- lib/ruby_smb/client/utils.rb
|
286
289
|
- lib/ruby_smb/client/winreg.rb
|
@@ -290,6 +293,23 @@ files:
|
|
290
293
|
- lib/ruby_smb/dcerpc.rb
|
291
294
|
- lib/ruby_smb/dcerpc/bind.rb
|
292
295
|
- lib/ruby_smb/dcerpc/bind_ack.rb
|
296
|
+
- lib/ruby_smb/dcerpc/client.rb
|
297
|
+
- lib/ruby_smb/dcerpc/drsr.rb
|
298
|
+
- lib/ruby_smb/dcerpc/drsr/drs_bind_request.rb
|
299
|
+
- lib/ruby_smb/dcerpc/drsr/drs_bind_response.rb
|
300
|
+
- lib/ruby_smb/dcerpc/drsr/drs_crack_names_request.rb
|
301
|
+
- lib/ruby_smb/dcerpc/drsr/drs_crack_names_response.rb
|
302
|
+
- lib/ruby_smb/dcerpc/drsr/drs_domain_controller_info_request.rb
|
303
|
+
- lib/ruby_smb/dcerpc/drsr/drs_domain_controller_info_response.rb
|
304
|
+
- lib/ruby_smb/dcerpc/drsr/drs_extensions.rb
|
305
|
+
- lib/ruby_smb/dcerpc/drsr/drs_get_nc_changes_request.rb
|
306
|
+
- lib/ruby_smb/dcerpc/drsr/drs_get_nc_changes_response.rb
|
307
|
+
- lib/ruby_smb/dcerpc/drsr/drs_unbind_request.rb
|
308
|
+
- lib/ruby_smb/dcerpc/drsr/drs_unbind_response.rb
|
309
|
+
- lib/ruby_smb/dcerpc/epm.rb
|
310
|
+
- lib/ruby_smb/dcerpc/epm/epm_ept_map_request.rb
|
311
|
+
- lib/ruby_smb/dcerpc/epm/epm_ept_map_response.rb
|
312
|
+
- lib/ruby_smb/dcerpc/epm/epm_twrt.rb
|
293
313
|
- lib/ruby_smb/dcerpc/error.rb
|
294
314
|
- lib/ruby_smb/dcerpc/ndr.rb
|
295
315
|
- lib/ruby_smb/dcerpc/netlogon.rb
|
@@ -304,8 +324,30 @@ files:
|
|
304
324
|
- lib/ruby_smb/dcerpc/ptypes.rb
|
305
325
|
- lib/ruby_smb/dcerpc/request.rb
|
306
326
|
- lib/ruby_smb/dcerpc/response.rb
|
327
|
+
- lib/ruby_smb/dcerpc/rpc_auth3.rb
|
307
328
|
- lib/ruby_smb/dcerpc/rpc_security_attributes.rb
|
308
|
-
- lib/ruby_smb/dcerpc/
|
329
|
+
- lib/ruby_smb/dcerpc/rrp_rpc_unicode_string.rb
|
330
|
+
- lib/ruby_smb/dcerpc/samr.rb
|
331
|
+
- lib/ruby_smb/dcerpc/samr/rpc_sid.rb
|
332
|
+
- lib/ruby_smb/dcerpc/samr/samr_close_handle_request.rb
|
333
|
+
- lib/ruby_smb/dcerpc/samr/samr_close_handle_response.rb
|
334
|
+
- lib/ruby_smb/dcerpc/samr/samr_connect_request.rb
|
335
|
+
- lib/ruby_smb/dcerpc/samr/samr_connect_response.rb
|
336
|
+
- lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_request.rb
|
337
|
+
- lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_response.rb
|
338
|
+
- lib/ruby_smb/dcerpc/samr/samr_get_alias_membership_request.rb
|
339
|
+
- lib/ruby_smb/dcerpc/samr/samr_get_alias_membership_response.rb
|
340
|
+
- lib/ruby_smb/dcerpc/samr/samr_get_groups_for_user_request.rb
|
341
|
+
- lib/ruby_smb/dcerpc/samr/samr_get_groups_for_user_response.rb
|
342
|
+
- lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_request.rb
|
343
|
+
- lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_response.rb
|
344
|
+
- lib/ruby_smb/dcerpc/samr/samr_open_domain_request.rb
|
345
|
+
- lib/ruby_smb/dcerpc/samr/samr_open_domain_response.rb
|
346
|
+
- lib/ruby_smb/dcerpc/samr/samr_open_user_request.rb
|
347
|
+
- lib/ruby_smb/dcerpc/samr/samr_open_user_response.rb
|
348
|
+
- lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_request.rb
|
349
|
+
- lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_response.rb
|
350
|
+
- lib/ruby_smb/dcerpc/sec_trailer.rb
|
309
351
|
- lib/ruby_smb/dcerpc/srvsvc.rb
|
310
352
|
- lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all.rb
|
311
353
|
- lib/ruby_smb/dcerpc/svcctl.rb
|
@@ -347,6 +389,10 @@ files:
|
|
347
389
|
- lib/ruby_smb/dcerpc/winreg/regsam.rb
|
348
390
|
- lib/ruby_smb/dcerpc/winreg/save_key_request.rb
|
349
391
|
- lib/ruby_smb/dcerpc/winreg/save_key_response.rb
|
392
|
+
- lib/ruby_smb/dcerpc/wkssvc.rb
|
393
|
+
- lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_request.rb
|
394
|
+
- lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_response.rb
|
395
|
+
- lib/ruby_smb/dialect.rb
|
350
396
|
- lib/ruby_smb/dispatcher.rb
|
351
397
|
- lib/ruby_smb/dispatcher/base.rb
|
352
398
|
- lib/ruby_smb/dispatcher/socket.rb
|
@@ -381,12 +427,21 @@ files:
|
|
381
427
|
- lib/ruby_smb/fscc/file_information/file_rename_information.rb
|
382
428
|
- lib/ruby_smb/generic_packet.rb
|
383
429
|
- lib/ruby_smb/gss.rb
|
430
|
+
- lib/ruby_smb/gss/provider.rb
|
431
|
+
- lib/ruby_smb/gss/provider/authenticator.rb
|
432
|
+
- lib/ruby_smb/gss/provider/ntlm.rb
|
384
433
|
- lib/ruby_smb/impersonation_levels.rb
|
385
434
|
- lib/ruby_smb/nbss.rb
|
386
435
|
- lib/ruby_smb/nbss/negative_session_response.rb
|
387
436
|
- lib/ruby_smb/nbss/netbios_name.rb
|
388
437
|
- lib/ruby_smb/nbss/session_header.rb
|
389
438
|
- lib/ruby_smb/nbss/session_request.rb
|
439
|
+
- lib/ruby_smb/ntlm.rb
|
440
|
+
- lib/ruby_smb/server.rb
|
441
|
+
- lib/ruby_smb/server/server_client.rb
|
442
|
+
- lib/ruby_smb/server/server_client/negotiation.rb
|
443
|
+
- lib/ruby_smb/server/server_client/session_setup.rb
|
444
|
+
- lib/ruby_smb/signing.rb
|
390
445
|
- lib/ruby_smb/smb1.rb
|
391
446
|
- lib/ruby_smb/smb1/andx_block.rb
|
392
447
|
- lib/ruby_smb/smb1/bit_field.rb
|
@@ -532,6 +587,8 @@ files:
|
|
532
587
|
- spec/lib/ruby_smb/crypto_spec.rb
|
533
588
|
- spec/lib/ruby_smb/dcerpc/bind_ack_spec.rb
|
534
589
|
- spec/lib/ruby_smb/dcerpc/bind_spec.rb
|
590
|
+
- spec/lib/ruby_smb/dcerpc/client_spec.rb
|
591
|
+
- spec/lib/ruby_smb/dcerpc/drsr_spec.rb
|
535
592
|
- spec/lib/ruby_smb/dcerpc/ndr_spec.rb
|
536
593
|
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_request_spec.rb
|
537
594
|
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_response_spec.rb
|
@@ -543,8 +600,24 @@ files:
|
|
543
600
|
- spec/lib/ruby_smb/dcerpc/pdu_header_spec.rb
|
544
601
|
- spec/lib/ruby_smb/dcerpc/request_spec.rb
|
545
602
|
- spec/lib/ruby_smb/dcerpc/response_spec.rb
|
603
|
+
- spec/lib/ruby_smb/dcerpc/rpc_auth3_spec.rb
|
546
604
|
- spec/lib/ruby_smb/dcerpc/rpc_security_attributes_spec.rb
|
547
|
-
- spec/lib/ruby_smb/dcerpc/
|
605
|
+
- spec/lib/ruby_smb/dcerpc/rrp_rpc_unicode_string_spec.rb
|
606
|
+
- spec/lib/ruby_smb/dcerpc/samr/rpc_sid_spec.rb
|
607
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_close_handle_request_spec.rb
|
608
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_close_handle_response_spec.rb
|
609
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_connect_request_spec.rb
|
610
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_connect_response_spec.rb
|
611
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_request_spec.rb
|
612
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_response_spec.rb
|
613
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_request_spec.rb
|
614
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_response_spec.rb
|
615
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_open_domain_request_spec.rb
|
616
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_open_domain_response_spec.rb
|
617
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_request_spec.rb
|
618
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_response_spec.rb
|
619
|
+
- spec/lib/ruby_smb/dcerpc/samr_spec.rb
|
620
|
+
- spec/lib/ruby_smb/dcerpc/sec_trailer_spec.rb
|
548
621
|
- spec/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all_spec.rb
|
549
622
|
- spec/lib/ruby_smb/dcerpc/srvsvc_spec.rb
|
550
623
|
- spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_request_spec.rb
|
@@ -586,6 +659,9 @@ files:
|
|
586
659
|
- spec/lib/ruby_smb/dcerpc/winreg/save_key_request_spec.rb
|
587
660
|
- spec/lib/ruby_smb/dcerpc/winreg/save_key_response_spec.rb
|
588
661
|
- spec/lib/ruby_smb/dcerpc/winreg_spec.rb
|
662
|
+
- spec/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_request_spec.rb
|
663
|
+
- spec/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_response_spec.rb
|
664
|
+
- spec/lib/ruby_smb/dcerpc/wkssvc_spec.rb
|
589
665
|
- spec/lib/ruby_smb/dcerpc_spec.rb
|
590
666
|
- spec/lib/ruby_smb/dispatcher/base_spec.rb
|
591
667
|
- spec/lib/ruby_smb/dispatcher/socket_spec.rb
|
@@ -599,6 +675,7 @@ files:
|
|
599
675
|
- spec/lib/ruby_smb/field/smb_fea_spec.rb
|
600
676
|
- spec/lib/ruby_smb/field/smb_gea_list_spec.rb
|
601
677
|
- spec/lib/ruby_smb/field/smb_gea_spec.rb
|
678
|
+
- spec/lib/ruby_smb/field/string16_spec.rb
|
602
679
|
- spec/lib/ruby_smb/field/stringz16_spec.rb
|
603
680
|
- spec/lib/ruby_smb/field/utime_spec.rb
|
604
681
|
- spec/lib/ruby_smb/fscc/ea_info_array_spec.rb
|
@@ -613,10 +690,16 @@ files:
|
|
613
690
|
- spec/lib/ruby_smb/fscc/file_information/file_rename_information_spec.rb
|
614
691
|
- spec/lib/ruby_smb/fscc/fscc_file_attributes_spec.rb
|
615
692
|
- spec/lib/ruby_smb/generic_packet_spec.rb
|
693
|
+
- spec/lib/ruby_smb/gss/provider/ntlm/account_spec.rb
|
694
|
+
- spec/lib/ruby_smb/gss/provider/ntlm/authenticator_spec.rb
|
695
|
+
- spec/lib/ruby_smb/gss/provider/ntlm/os_version_spec.rb
|
696
|
+
- spec/lib/ruby_smb/gss/provider/ntlm_spec.rb
|
616
697
|
- spec/lib/ruby_smb/nbss/negative_session_response_spec.rb
|
617
698
|
- spec/lib/ruby_smb/nbss/netbios_name_spec.rb
|
618
699
|
- spec/lib/ruby_smb/nbss/session_header_spec.rb
|
619
700
|
- spec/lib/ruby_smb/nbss/session_request_spec.rb
|
701
|
+
- spec/lib/ruby_smb/server/server_client_spec.rb
|
702
|
+
- spec/lib/ruby_smb/server_spec.rb
|
620
703
|
- spec/lib/ruby_smb/smb1/andx_block_spec.rb
|
621
704
|
- spec/lib/ruby_smb/smb1/bit_field/capabilities_spec.rb
|
622
705
|
- spec/lib/ruby_smb/smb1/bit_field/create_options_spec.rb
|
@@ -735,6 +818,7 @@ files:
|
|
735
818
|
- spec/lib/ruby_smb/smb2/tree_spec.rb
|
736
819
|
- spec/lib/ruby_smb_spec.rb
|
737
820
|
- spec/spec_helper.rb
|
821
|
+
- spec/support/bin_helper.rb
|
738
822
|
- spec/support/mock_socket_dispatcher.rb
|
739
823
|
- spec/support/shared/examples/bit_field_single_flag.rb
|
740
824
|
homepage: https://github.com/rapid7/ruby_smb
|
@@ -767,6 +851,8 @@ test_files:
|
|
767
851
|
- spec/lib/ruby_smb/crypto_spec.rb
|
768
852
|
- spec/lib/ruby_smb/dcerpc/bind_ack_spec.rb
|
769
853
|
- spec/lib/ruby_smb/dcerpc/bind_spec.rb
|
854
|
+
- spec/lib/ruby_smb/dcerpc/client_spec.rb
|
855
|
+
- spec/lib/ruby_smb/dcerpc/drsr_spec.rb
|
770
856
|
- spec/lib/ruby_smb/dcerpc/ndr_spec.rb
|
771
857
|
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_request_spec.rb
|
772
858
|
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_response_spec.rb
|
@@ -778,8 +864,24 @@ test_files:
|
|
778
864
|
- spec/lib/ruby_smb/dcerpc/pdu_header_spec.rb
|
779
865
|
- spec/lib/ruby_smb/dcerpc/request_spec.rb
|
780
866
|
- spec/lib/ruby_smb/dcerpc/response_spec.rb
|
867
|
+
- spec/lib/ruby_smb/dcerpc/rpc_auth3_spec.rb
|
781
868
|
- spec/lib/ruby_smb/dcerpc/rpc_security_attributes_spec.rb
|
782
|
-
- spec/lib/ruby_smb/dcerpc/
|
869
|
+
- spec/lib/ruby_smb/dcerpc/rrp_rpc_unicode_string_spec.rb
|
870
|
+
- spec/lib/ruby_smb/dcerpc/samr/rpc_sid_spec.rb
|
871
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_close_handle_request_spec.rb
|
872
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_close_handle_response_spec.rb
|
873
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_connect_request_spec.rb
|
874
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_connect_response_spec.rb
|
875
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_request_spec.rb
|
876
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_response_spec.rb
|
877
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_request_spec.rb
|
878
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_response_spec.rb
|
879
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_open_domain_request_spec.rb
|
880
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_open_domain_response_spec.rb
|
881
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_request_spec.rb
|
882
|
+
- spec/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_response_spec.rb
|
883
|
+
- spec/lib/ruby_smb/dcerpc/samr_spec.rb
|
884
|
+
- spec/lib/ruby_smb/dcerpc/sec_trailer_spec.rb
|
783
885
|
- spec/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all_spec.rb
|
784
886
|
- spec/lib/ruby_smb/dcerpc/srvsvc_spec.rb
|
785
887
|
- spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_request_spec.rb
|
@@ -821,6 +923,9 @@ test_files:
|
|
821
923
|
- spec/lib/ruby_smb/dcerpc/winreg/save_key_request_spec.rb
|
822
924
|
- spec/lib/ruby_smb/dcerpc/winreg/save_key_response_spec.rb
|
823
925
|
- spec/lib/ruby_smb/dcerpc/winreg_spec.rb
|
926
|
+
- spec/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_request_spec.rb
|
927
|
+
- spec/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_response_spec.rb
|
928
|
+
- spec/lib/ruby_smb/dcerpc/wkssvc_spec.rb
|
824
929
|
- spec/lib/ruby_smb/dcerpc_spec.rb
|
825
930
|
- spec/lib/ruby_smb/dispatcher/base_spec.rb
|
826
931
|
- spec/lib/ruby_smb/dispatcher/socket_spec.rb
|
@@ -834,6 +939,7 @@ test_files:
|
|
834
939
|
- spec/lib/ruby_smb/field/smb_fea_spec.rb
|
835
940
|
- spec/lib/ruby_smb/field/smb_gea_list_spec.rb
|
836
941
|
- spec/lib/ruby_smb/field/smb_gea_spec.rb
|
942
|
+
- spec/lib/ruby_smb/field/string16_spec.rb
|
837
943
|
- spec/lib/ruby_smb/field/stringz16_spec.rb
|
838
944
|
- spec/lib/ruby_smb/field/utime_spec.rb
|
839
945
|
- spec/lib/ruby_smb/fscc/ea_info_array_spec.rb
|
@@ -848,10 +954,16 @@ test_files:
|
|
848
954
|
- spec/lib/ruby_smb/fscc/file_information/file_rename_information_spec.rb
|
849
955
|
- spec/lib/ruby_smb/fscc/fscc_file_attributes_spec.rb
|
850
956
|
- spec/lib/ruby_smb/generic_packet_spec.rb
|
957
|
+
- spec/lib/ruby_smb/gss/provider/ntlm/account_spec.rb
|
958
|
+
- spec/lib/ruby_smb/gss/provider/ntlm/authenticator_spec.rb
|
959
|
+
- spec/lib/ruby_smb/gss/provider/ntlm/os_version_spec.rb
|
960
|
+
- spec/lib/ruby_smb/gss/provider/ntlm_spec.rb
|
851
961
|
- spec/lib/ruby_smb/nbss/negative_session_response_spec.rb
|
852
962
|
- spec/lib/ruby_smb/nbss/netbios_name_spec.rb
|
853
963
|
- spec/lib/ruby_smb/nbss/session_header_spec.rb
|
854
964
|
- spec/lib/ruby_smb/nbss/session_request_spec.rb
|
965
|
+
- spec/lib/ruby_smb/server/server_client_spec.rb
|
966
|
+
- spec/lib/ruby_smb/server_spec.rb
|
855
967
|
- spec/lib/ruby_smb/smb1/andx_block_spec.rb
|
856
968
|
- spec/lib/ruby_smb/smb1/bit_field/capabilities_spec.rb
|
857
969
|
- spec/lib/ruby_smb/smb1/bit_field/create_options_spec.rb
|
@@ -970,5 +1082,6 @@ test_files:
|
|
970
1082
|
- spec/lib/ruby_smb/smb2/tree_spec.rb
|
971
1083
|
- spec/lib/ruby_smb_spec.rb
|
972
1084
|
- spec/spec_helper.rb
|
1085
|
+
- spec/support/bin_helper.rb
|
973
1086
|
- spec/support/mock_socket_dispatcher.rb
|
974
1087
|
- spec/support/shared/examples/bit_field_single_flag.rb
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,64 +0,0 @@
|
|
1
|
-
module RubySMB
|
2
|
-
class Client
|
3
|
-
# Contains the methods for handling packet signing
|
4
|
-
module Signing
|
5
|
-
# The NTLM Session Key used for signing
|
6
|
-
# @!attribute [rw] session_key
|
7
|
-
# @return [String]
|
8
|
-
attr_accessor :session_key
|
9
|
-
|
10
|
-
# Take an SMB1 packet and checks to see if it should be signed.
|
11
|
-
# If signing is enabled and we have a session key already, then
|
12
|
-
# it will sign the packet appropriately.
|
13
|
-
#
|
14
|
-
# @param packet [RubySMB::GenericPacket] the packet to sign
|
15
|
-
# @return [RubySMB::GenericPacket] the packet, signed if needed
|
16
|
-
def smb1_sign(packet)
|
17
|
-
if signing_required && !session_key.empty?
|
18
|
-
# Pack the Sequence counter into a int64le
|
19
|
-
packed_sequence_counter = [sequence_counter].pack('Q<')
|
20
|
-
packet.smb_header.security_features = packed_sequence_counter
|
21
|
-
signature = OpenSSL::Digest::MD5.digest(session_key + packet.to_binary_s)[0, 8]
|
22
|
-
packet.smb_header.security_features = signature
|
23
|
-
self.sequence_counter += 1
|
24
|
-
end
|
25
|
-
packet
|
26
|
-
end
|
27
|
-
|
28
|
-
# Take an SMB2 packet and checks to see if it should be signed.
|
29
|
-
# If signing is enabled and we have a session key already, then
|
30
|
-
# it will sign the packet appropriately.
|
31
|
-
#
|
32
|
-
# @param packet [RubySMB::GenericPacket] the packet to sign
|
33
|
-
# @return [RubySMB::GenericPacket] the packet, signed if needed
|
34
|
-
def smb2_sign(packet)
|
35
|
-
if signing_required && !session_key.empty?
|
36
|
-
packet.smb2_header.flags.signed = 1
|
37
|
-
packet.smb2_header.signature = "\x00" * 16
|
38
|
-
hmac = OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, session_key, packet.to_binary_s)
|
39
|
-
packet.smb2_header.signature = hmac[0, 16]
|
40
|
-
end
|
41
|
-
packet
|
42
|
-
end
|
43
|
-
|
44
|
-
def smb3_sign(packet)
|
45
|
-
if !session_key.empty? && (signing_required || packet.is_a?(RubySMB::SMB2::Packet::TreeConnectRequest))
|
46
|
-
case @dialect
|
47
|
-
when '0x0300', '0x0302'
|
48
|
-
signing_key = RubySMB::Crypto::KDF.counter_mode(@session_key, "SMB2AESCMAC\x00", "SmbSign\x00")
|
49
|
-
when '0x0311'
|
50
|
-
signing_key = RubySMB::Crypto::KDF.counter_mode(@session_key, "SMBSigningKey\x00", @preauth_integrity_hash_value)
|
51
|
-
else
|
52
|
-
raise RubySMB::Error::SigningError.new('Dialect is incompatible with SMBv3 signing')
|
53
|
-
end
|
54
|
-
|
55
|
-
packet.smb2_header.flags.signed = 1
|
56
|
-
packet.smb2_header.signature = "\x00" * 16
|
57
|
-
hmac = OpenSSL::CMAC.digest('AES', signing_key, packet.to_binary_s)
|
58
|
-
packet.smb2_header.signature = hmac[0, 16]
|
59
|
-
end
|
60
|
-
packet
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'ruby_smb/dcerpc/ndr'
|
2
|
-
|
3
|
-
module RubySMB
|
4
|
-
module Dcerpc
|
5
|
-
|
6
|
-
# A RRP_UNICODE_STRING structure as defined in
|
7
|
-
# [2.2.4 RRP_UNICODE_STRING](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rrp/c0c90f11-a4c4-496a-ac09-8a8a3697ceef)
|
8
|
-
class RrpUnicodeString < BinData::Primitive
|
9
|
-
endian :little
|
10
|
-
|
11
|
-
uint16 :buffer_length
|
12
|
-
uint16 :maximum_length
|
13
|
-
ndr_lp_str :buffer
|
14
|
-
|
15
|
-
def get
|
16
|
-
self.buffer
|
17
|
-
end
|
18
|
-
|
19
|
-
def set(buf)
|
20
|
-
self.buffer = buf
|
21
|
-
self.buffer_length = self.buffer == :null ? 0 : self.buffer.referent.actual_count * 2
|
22
|
-
# Don't reset maximum_length if the buffer is NULL to make sure we can
|
23
|
-
# set it independently of the buffer size
|
24
|
-
return if self.maximum_length > 0 && self.buffer == :null
|
25
|
-
self.maximum_length = self.buffer.referent.max_count * 2
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# A pointer to a RRP_UNICODE_STRING structure
|
30
|
-
class PrrpUnicodeString < Ndr::NdrPointer
|
31
|
-
endian :little
|
32
|
-
|
33
|
-
rrp_unicode_string :referent, onlyif: -> { self.referent_id != 0 }
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
@@ -1,135 +0,0 @@
|
|
1
|
-
RSpec.describe RubySMB::Dcerpc::RrpUnicodeString do
|
2
|
-
subject(:packet) { described_class.new }
|
3
|
-
|
4
|
-
it { is_expected.to respond_to :buffer_length }
|
5
|
-
it { is_expected.to respond_to :maximum_length }
|
6
|
-
it { is_expected.to respond_to :buffer }
|
7
|
-
|
8
|
-
it 'is little endian' do
|
9
|
-
expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '#buffer_length' do
|
13
|
-
it 'should be a 16-bit unsigned integer' do
|
14
|
-
expect(packet.buffer_length).to be_a BinData::Uint16le
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '#maximum_length' do
|
19
|
-
it 'should be a 16-bit unsigned integer' do
|
20
|
-
expect(packet.maximum_length).to be_a BinData::Uint16le
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#buffer' do
|
25
|
-
it 'should be a NdrLpStr' do
|
26
|
-
expect(packet.buffer).to be_a RubySMB::Dcerpc::Ndr::NdrLpStr
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe '#get' do
|
31
|
-
it 'returns #buffer' do
|
32
|
-
packet.buffer = 'spec_test'
|
33
|
-
expect(packet.get).to eq(RubySMB::Dcerpc::Ndr::NdrLpStr.new('spec_test'))
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe '#set' do
|
38
|
-
it 'sets #buffer to the expected value' do
|
39
|
-
packet.set('spec_test')
|
40
|
-
expect(packet.buffer).to eq(RubySMB::Dcerpc::Ndr::NdrLpStr.new('spec_test'))
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'sets #buffer_length to the expected value' do
|
44
|
-
packet.set('spec_test')
|
45
|
-
expect(packet.buffer_length).to eq(('spec_test'.size + 1) * 2)
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'sets #maximum_length to the expected value' do
|
49
|
-
packet.set('spec_test')
|
50
|
-
expect(packet.maximum_length).to eq(('spec_test'.size + 1) * 2)
|
51
|
-
end
|
52
|
-
|
53
|
-
context 'when the value is :null' do
|
54
|
-
it 'sets #buffer_length to 0' do
|
55
|
-
packet.buffer_length = 33
|
56
|
-
packet.set(:null)
|
57
|
-
expect(packet.buffer_length).to eq(0)
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'does not set #maximum_length if it has already been set' do
|
61
|
-
packet.maximum_length = 33
|
62
|
-
packet.set(:null)
|
63
|
-
expect(packet.maximum_length).to eq(33)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
describe '#read' do
|
69
|
-
context 'with a null pointer' do
|
70
|
-
it 'reads its own binary representation' do
|
71
|
-
raw = packet.to_binary_s
|
72
|
-
expect(described_class.read(raw)).to eq(packet)
|
73
|
-
expect(described_class.read(raw).to_binary_s).to eq(raw)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
context 'with a normal string' do
|
78
|
-
it 'reads its own binary representation' do
|
79
|
-
packet.assign('my_test')
|
80
|
-
raw = packet.to_binary_s
|
81
|
-
expect(described_class.read(raw)).to eq(packet)
|
82
|
-
expect(described_class.read(raw).to_binary_s).to eq(raw)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
RSpec.describe RubySMB::Dcerpc::PrrpUnicodeString do
|
89
|
-
it 'is NdrPointer subclass' do
|
90
|
-
expect(described_class).to be < RubySMB::Dcerpc::Ndr::NdrPointer
|
91
|
-
end
|
92
|
-
|
93
|
-
subject(:packet) { described_class.new }
|
94
|
-
|
95
|
-
it { is_expected.to respond_to :referent }
|
96
|
-
|
97
|
-
it 'is little endian' do
|
98
|
-
expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
|
99
|
-
end
|
100
|
-
|
101
|
-
describe '#referent' do
|
102
|
-
it 'is a RrpUnicodeString' do
|
103
|
-
expect(packet.referent).to be_a RubySMB::Dcerpc::RrpUnicodeString
|
104
|
-
end
|
105
|
-
|
106
|
-
it 'exists if superclass #referent_identifier is not zero' do
|
107
|
-
packet.referent_id = 0xCCCC
|
108
|
-
expect(packet.referent?).to be true
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'does not exist if superclass #referent_identifier is zero' do
|
112
|
-
packet.referent_id = 0
|
113
|
-
expect(packet.referent?).to be false
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
describe '#read' do
|
118
|
-
context 'with a null pointer' do
|
119
|
-
it 'reads its own binary representation' do
|
120
|
-
raw = packet.to_binary_s
|
121
|
-
expect(described_class.read(raw)).to eq(packet)
|
122
|
-
expect(described_class.read(raw).to_binary_s).to eq(raw)
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
context 'with a normal string' do
|
127
|
-
it 'reads its own binary representation' do
|
128
|
-
packet.assign('my_test')
|
129
|
-
raw = packet.to_binary_s
|
130
|
-
expect(described_class.read(raw)).to eq(packet)
|
131
|
-
expect(described_class.read(raw).to_binary_s).to eq(raw)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|