ruby_smb 2.0.12 → 3.0.2
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/auth_capture.rb +28 -0
- data/examples/dump_secrets_from_sid.rb +207 -0
- data/examples/enum_domain_users.rb +75 -0
- data/examples/file_server.rb +76 -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/create_actions.rb +21 -0
- 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/encrypting_file_system/efs_rpc_encrypt_file_srv_request.rb +20 -0
- data/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_encrypt_file_srv_response.rb +20 -0
- data/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_open_file_raw_request.rb +21 -0
- data/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_open_file_raw_response.rb +21 -0
- data/lib/ruby_smb/dcerpc/encrypting_file_system.rb +44 -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/print_system/rpc_add_printer_driver_ex_request.rb +22 -0
- data/lib/ruby_smb/dcerpc/print_system/rpc_add_printer_driver_ex_response.rb +20 -0
- data/lib/ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_request.rb +24 -0
- data/lib/ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_response.rb +23 -0
- data/lib/ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_request.rb +24 -0
- data/lib/ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_response.rb +22 -0
- data/lib/ruby_smb/dcerpc/print_system.rb +69 -0
- 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 +43 -13
- data/lib/ruby_smb/field/file_time.rb +1 -1
- data/lib/ruby_smb/field/nt_status.rb +20 -1
- data/lib/ruby_smb/field/string16.rb +5 -1
- data/lib/ruby_smb/fscc/file_information/file_ea_information.rb +14 -0
- data/lib/ruby_smb/fscc/file_information/file_network_open_information.rb +22 -0
- data/lib/ruby_smb/fscc/file_information/file_stream_information.rb +16 -0
- data/lib/ruby_smb/fscc/file_information.rb +29 -0
- data/lib/ruby_smb/fscc/file_system_information/file_fs_attribute_information.rb +46 -0
- data/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information.rb +19 -0
- data/lib/ruby_smb/fscc/file_system_information.rb +22 -0
- data/lib/ruby_smb/fscc.rb +1 -0
- data/lib/ruby_smb/generic_packet.rb +6 -0
- data/lib/ruby_smb/gss/provider/authenticator.rb +4 -0
- data/lib/ruby_smb/gss/provider/ntlm.rb +13 -3
- data/lib/ruby_smb/ntlm.rb +18 -2
- data/lib/ruby_smb/server/server_client/negotiation.rb +0 -2
- data/lib/ruby_smb/server/server_client/session_setup.rb +43 -32
- data/lib/ruby_smb/server/server_client/share_io.rb +28 -0
- data/lib/ruby_smb/server/server_client/tree_connect.rb +60 -0
- data/lib/ruby_smb/server/server_client.rb +214 -24
- data/lib/ruby_smb/server/session.rb +71 -0
- data/lib/ruby_smb/server/share/provider/disk.rb +437 -0
- data/lib/ruby_smb/server/share/provider/pipe.rb +27 -0
- data/lib/ruby_smb/server/share/provider/processor.rb +76 -0
- data/lib/ruby_smb/server/share/provider.rb +38 -0
- data/lib/ruby_smb/server/share.rb +11 -0
- data/lib/ruby_smb/server.rb +35 -3
- data/lib/ruby_smb/signing.rb +37 -11
- data/lib/ruby_smb/smb1/commands.rb +4 -0
- data/lib/ruby_smb/smb1/pipe.rb +4 -0
- data/lib/ruby_smb/smb1.rb +0 -1
- data/lib/ruby_smb/smb2/bit_field/smb2_header_flags.rb +2 -1
- data/lib/ruby_smb/smb2/commands.rb +4 -0
- data/lib/ruby_smb/smb2/create_context/request.rb +64 -0
- data/lib/ruby_smb/smb2/create_context/response.rb +62 -0
- data/lib/ruby_smb/smb2/create_context.rb +74 -22
- data/lib/ruby_smb/smb2/packet/create_request.rb +44 -11
- data/lib/ruby_smb/smb2/packet/create_response.rb +17 -3
- data/lib/ruby_smb/smb2/packet/query_directory_request.rb +1 -1
- data/lib/ruby_smb/smb2/packet/query_directory_response.rb +2 -2
- data/lib/ruby_smb/smb2/packet/query_info_request.rb +43 -0
- data/lib/ruby_smb/smb2/packet/query_info_response.rb +23 -0
- data/lib/ruby_smb/smb2/packet/tree_connect_response.rb +1 -1
- data/lib/ruby_smb/smb2/packet/tree_disconnect_response.rb +1 -0
- data/lib/ruby_smb/smb2/packet.rb +2 -0
- data/lib/ruby_smb/smb2/pipe.rb +4 -0
- data/lib/ruby_smb/smb2.rb +11 -0
- data/lib/ruby_smb/smb_error.rb +110 -0
- data/lib/ruby_smb/version.rb +1 -1
- data/lib/ruby_smb.rb +2 -0
- data/ruby_smb.gemspec +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/encrypting_file_system/efs_rpc_encrypt_file_srv_request_spec.rb +30 -0
- data/spec/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_encrypt_file_srv_response_spec.rb +30 -0
- data/spec/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_open_file_raw_request_spec.rb +38 -0
- data/spec/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_open_file_raw_response_spec.rb +38 -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/print_system/driver_container_spec.rb +41 -0
- data/spec/lib/ruby_smb/dcerpc/print_system/driver_info2_spec.rb +64 -0
- data/spec/lib/ruby_smb/dcerpc/print_system/rpc_add_printer_driver_ex_request_spec.rb +59 -0
- data/spec/lib/ruby_smb/dcerpc/print_system/rpc_add_printer_driver_ex_response_spec.rb +30 -0
- data/spec/lib/ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_request_spec.rb +62 -0
- data/spec/lib/ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_response_spec.rb +54 -0
- data/spec/lib/ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_request_spec.rb +62 -0
- data/spec/lib/ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_response_spec.rb +46 -0
- 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/nt_status_spec.rb +6 -2
- data/spec/lib/ruby_smb/field/string16_spec.rb +22 -0
- data/spec/lib/ruby_smb/gss/provider/ntlm/authenticator_spec.rb +4 -0
- data/spec/lib/ruby_smb/gss/provider/ntlm/os_version_spec.rb +1 -1
- data/spec/lib/ruby_smb/server/server_client_spec.rb +36 -53
- data/spec/lib/ruby_smb/server/session_spec.rb +38 -0
- data/spec/lib/ruby_smb/server/share/provider/disk_spec.rb +61 -0
- data/spec/lib/ruby_smb/server/share/provider/pipe_spec.rb +31 -0
- data/spec/lib/ruby_smb/server/share/provider_spec.rb +13 -0
- data/spec/lib/ruby_smb/smb1/pipe_spec.rb +18 -37
- data/spec/lib/ruby_smb/smb2/bit_field/header_flags_spec.rb +8 -2
- data/spec/lib/ruby_smb/smb2/{create_context_spec.rb → create_context/create_context_request_spec.rb} +1 -1
- data/spec/lib/ruby_smb/smb2/packet/create_request_spec.rb +5 -5
- data/spec/lib/ruby_smb/smb2/packet/create_response_spec.rb +9 -5
- data/spec/lib/ruby_smb/smb2/packet/query_directory_response_spec.rb +3 -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 +165 -10
- metadata.gz.sig +0 -0
- data/lib/ruby_smb/dcerpc/rrp_unicode_string.rb +0 -38
- data/lib/ruby_smb/smb1/create_actions.rb +0 -20
- data/spec/lib/ruby_smb/dcerpc/rrp_unicode_string_spec.rb +0 -135
@@ -10,9 +10,7 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumKeyRequest do
|
|
10
10
|
it { is_expected.to respond_to :hkey }
|
11
11
|
it { is_expected.to respond_to :dw_index }
|
12
12
|
it { is_expected.to respond_to :lp_name }
|
13
|
-
it { is_expected.to respond_to :pad1 }
|
14
13
|
it { is_expected.to respond_to :lp_class }
|
15
|
-
it { is_expected.to respond_to :pad2 }
|
16
14
|
it { is_expected.to respond_to :lpft_last_write_time }
|
17
15
|
it { is_expected.to respond_to :opnum }
|
18
16
|
|
@@ -27,8 +25,8 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumKeyRequest do
|
|
27
25
|
end
|
28
26
|
|
29
27
|
describe '#dw_index' do
|
30
|
-
it 'is a
|
31
|
-
expect(packet.dw_index).to be_a
|
28
|
+
it 'is a NdrUint32' do
|
29
|
+
expect(packet.dw_index).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
@@ -38,37 +36,15 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumKeyRequest do
|
|
38
36
|
end
|
39
37
|
end
|
40
38
|
|
41
|
-
describe '#pad1' do
|
42
|
-
it 'is a string' do
|
43
|
-
expect(packet.pad1).to be_a BinData::String
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'should keep #lp_class 4-byte aligned' do
|
47
|
-
packet.lp_name = "test"
|
48
|
-
expect(packet.lp_class.abs_offset % 4).to eq 0
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
39
|
describe '#lp_class' do
|
53
40
|
it 'is a PrrpUnicodeString structure' do
|
54
41
|
expect(packet.lp_class).to be_a RubySMB::Dcerpc::PrrpUnicodeString
|
55
42
|
end
|
56
43
|
end
|
57
44
|
|
58
|
-
describe '#pad2' do
|
59
|
-
it 'is a string' do
|
60
|
-
expect(packet.pad2).to be_a BinData::String
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'should keep #lpft_last_write_time 4-byte aligned' do
|
64
|
-
packet.lp_class = "test"
|
65
|
-
expect(packet.lpft_last_write_time.abs_offset % 4).to eq 0
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
45
|
describe '#lpft_last_write_time' do
|
70
|
-
it 'is a
|
71
|
-
expect(packet.lpft_last_write_time).to be_a RubySMB::Dcerpc::Ndr::
|
46
|
+
it 'is a NdrFileTimePtr structure' do
|
47
|
+
expect(packet.lpft_last_write_time).to be_a RubySMB::Dcerpc::Ndr::NdrFileTimePtr
|
72
48
|
end
|
73
49
|
end
|
74
50
|
|
@@ -77,28 +53,4 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumKeyRequest do
|
|
77
53
|
expect(packet.opnum).to eq(RubySMB::Dcerpc::Winreg::REG_ENUM_KEY)
|
78
54
|
end
|
79
55
|
end
|
80
|
-
|
81
|
-
describe '#pad_length1' do
|
82
|
-
it 'returns 0 when #lp_class is already 4-byte aligned' do
|
83
|
-
packet.lp_name = 'align'
|
84
|
-
expect(packet.pad_length1).to eq 0
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'returns 2 when #lp_class is only 2-byte aligned' do
|
88
|
-
packet.lp_name = 'align' + 'A'
|
89
|
-
expect(packet.pad_length1).to eq 2
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
describe '#pad_length2' do
|
94
|
-
it 'returns 0 when #lpft_last_write_time is already 4-byte aligned' do
|
95
|
-
packet.lp_class = 'align'
|
96
|
-
expect(packet.pad_length2).to eq 0
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'returns 2 when #lpft_last_write_time is only 2-byte aligned' do
|
100
|
-
packet.lp_class = 'align' + 'A'
|
101
|
-
expect(packet.pad_length2).to eq 2
|
102
|
-
end
|
103
|
-
end
|
104
56
|
end
|
@@ -2,9 +2,7 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumKeyResponse do
|
|
2
2
|
subject(:packet) { described_class.new }
|
3
3
|
|
4
4
|
it { is_expected.to respond_to :lp_name }
|
5
|
-
it { is_expected.to respond_to :pad1 }
|
6
5
|
it { is_expected.to respond_to :lp_class }
|
7
|
-
it { is_expected.to respond_to :pad2 }
|
8
6
|
it { is_expected.to respond_to :lpft_last_write_time }
|
9
7
|
it { is_expected.to respond_to :error_status }
|
10
8
|
it { is_expected.to respond_to :opnum }
|
@@ -20,47 +18,21 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumKeyResponse do
|
|
20
18
|
end
|
21
19
|
end
|
22
20
|
|
23
|
-
describe '#pad1' do
|
24
|
-
it 'is a string' do
|
25
|
-
expect(packet.pad1).to be_a BinData::String
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'should keep #lp_class 4-byte aligned' do
|
29
|
-
packet.lp_name = "test"
|
30
|
-
expect(packet.lp_class.abs_offset % 4).to eq 0
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
21
|
describe '#lp_class' do
|
35
22
|
it 'is a PrrpUnicodeString structure' do
|
36
23
|
expect(packet.lp_class).to be_a RubySMB::Dcerpc::PrrpUnicodeString
|
37
24
|
end
|
38
|
-
|
39
|
-
it 'has a initial value of 0' do
|
40
|
-
expect(packet.lp_class).to eq(0)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe '#pad2' do
|
45
|
-
it 'is a string' do
|
46
|
-
expect(packet.pad2).to be_a BinData::String
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'should keep #lpft_last_write_time 4-byte aligned' do
|
50
|
-
packet.lp_class = "test"
|
51
|
-
expect(packet.lpft_last_write_time.abs_offset % 4).to eq 0
|
52
|
-
end
|
53
25
|
end
|
54
26
|
|
55
27
|
describe '#lpft_last_write_time' do
|
56
|
-
it 'is a
|
57
|
-
expect(packet.lpft_last_write_time).to be_a RubySMB::Dcerpc::Ndr::
|
28
|
+
it 'is a NdrFileTimePtr structure' do
|
29
|
+
expect(packet.lpft_last_write_time).to be_a RubySMB::Dcerpc::Ndr::NdrFileTimePtr
|
58
30
|
end
|
59
31
|
end
|
60
32
|
|
61
33
|
describe '#error_status' do
|
62
|
-
it 'is a
|
63
|
-
expect(packet.error_status).to be_a
|
34
|
+
it 'is a NdrUint32' do
|
35
|
+
expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
64
36
|
end
|
65
37
|
end
|
66
38
|
|
@@ -69,29 +41,5 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumKeyResponse do
|
|
69
41
|
expect(packet.opnum).to eq(RubySMB::Dcerpc::Winreg::REG_ENUM_KEY)
|
70
42
|
end
|
71
43
|
end
|
72
|
-
|
73
|
-
describe '#pad_length1' do
|
74
|
-
it 'returns 0 when #lp_class is already 4-byte aligned' do
|
75
|
-
packet.lp_name = 'align'
|
76
|
-
expect(packet.pad_length1).to eq 0
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'returns 2 when #lp_class is only 2-byte aligned' do
|
80
|
-
packet.lp_name = 'align' + 'A'
|
81
|
-
expect(packet.pad_length1).to eq 2
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe '#pad_length2' do
|
86
|
-
it 'returns 0 when #lpft_last_write_time is already 4-byte aligned' do
|
87
|
-
packet.lp_class = 'align'
|
88
|
-
expect(packet.pad_length2).to eq 0
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'returns 2 when #lpft_last_write_time is only 2-byte aligned' do
|
92
|
-
packet.lp_class = 'align' + 'A'
|
93
|
-
expect(packet.pad_length2).to eq 2
|
94
|
-
end
|
95
|
-
end
|
96
44
|
end
|
97
45
|
|
@@ -10,7 +10,6 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumValueRequest do
|
|
10
10
|
it { is_expected.to respond_to :hkey }
|
11
11
|
it { is_expected.to respond_to :dw_index }
|
12
12
|
it { is_expected.to respond_to :lp_value_name }
|
13
|
-
it { is_expected.to respond_to :pad }
|
14
13
|
it { is_expected.to respond_to :lp_type }
|
15
14
|
it { is_expected.to respond_to :lp_data }
|
16
15
|
it { is_expected.to respond_to :lpcb_data }
|
@@ -28,8 +27,8 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumValueRequest do
|
|
28
27
|
end
|
29
28
|
|
30
29
|
describe '#dw_index' do
|
31
|
-
it 'is a
|
32
|
-
expect(packet.dw_index).to be_a
|
30
|
+
it 'is a NdrUint32' do
|
31
|
+
expect(packet.dw_index).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
33
32
|
end
|
34
33
|
end
|
35
34
|
|
@@ -39,38 +38,27 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumValueRequest do
|
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
42
|
-
describe '#pad' do
|
43
|
-
it 'is a string' do
|
44
|
-
expect(packet.pad).to be_a BinData::String
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'should keep #lp_type 4-byte aligned' do
|
48
|
-
packet.lp_value_name = "test"
|
49
|
-
expect(packet.lp_type.abs_offset % 4).to eq 0
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
41
|
describe '#lp_type' do
|
54
|
-
it 'is a
|
55
|
-
expect(packet.lp_type).to be_a RubySMB::Dcerpc::Ndr::
|
42
|
+
it 'is a NdrUint32Ptr structure' do
|
43
|
+
expect(packet.lp_type).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
|
56
44
|
end
|
57
45
|
end
|
58
46
|
|
59
47
|
describe '#lp_data' do
|
60
|
-
it 'is a
|
61
|
-
expect(packet.lp_data).to be_a RubySMB::Dcerpc::Ndr::
|
48
|
+
it 'is a NdrByteArrayPtr structure' do
|
49
|
+
expect(packet.lp_data).to be_a RubySMB::Dcerpc::Ndr::NdrByteArrayPtr
|
62
50
|
end
|
63
51
|
end
|
64
52
|
|
65
53
|
describe '#lpcb_data' do
|
66
|
-
it 'is a
|
67
|
-
expect(packet.lpcb_data).to be_a RubySMB::Dcerpc::Ndr::
|
54
|
+
it 'is a NdrUint32Ptr structure' do
|
55
|
+
expect(packet.lpcb_data).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
|
68
56
|
end
|
69
57
|
end
|
70
58
|
|
71
59
|
describe '#lpcb_len' do
|
72
|
-
it 'is a
|
73
|
-
expect(packet.lpcb_len).to be_a RubySMB::Dcerpc::Ndr::
|
60
|
+
it 'is a NdrUint32Ptr structure' do
|
61
|
+
expect(packet.lpcb_len).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
|
74
62
|
end
|
75
63
|
end
|
76
64
|
|
@@ -79,16 +67,4 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumValueRequest do
|
|
79
67
|
expect(packet.opnum).to eq(RubySMB::Dcerpc::Winreg::REG_ENUM_VALUE)
|
80
68
|
end
|
81
69
|
end
|
82
|
-
|
83
|
-
describe '#pad_length' do
|
84
|
-
it 'returns 0 when #lp_class is already 4-byte aligned' do
|
85
|
-
packet.lp_value_name = 'align'
|
86
|
-
expect(packet.pad_length).to eq 0
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'returns 2 when #lp_class is only 2-byte aligned' do
|
90
|
-
packet.lp_value_name = 'align' + 'A'
|
91
|
-
expect(packet.pad_length).to eq 2
|
92
|
-
end
|
93
|
-
end
|
94
70
|
end
|
@@ -2,7 +2,6 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumValueResponse do
|
|
2
2
|
subject(:packet) { described_class.new }
|
3
3
|
|
4
4
|
it { is_expected.to respond_to :lp_value_name }
|
5
|
-
it { is_expected.to respond_to :pad }
|
6
5
|
it { is_expected.to respond_to :lp_type }
|
7
6
|
it { is_expected.to respond_to :lp_data }
|
8
7
|
it { is_expected.to respond_to :lpcb_data }
|
@@ -20,44 +19,33 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumValueResponse do
|
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
23
|
-
describe '#pad' do
|
24
|
-
it 'is a string' do
|
25
|
-
expect(packet.pad).to be_a BinData::String
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'should keep #lp_type 4-byte aligned' do
|
29
|
-
packet.lp_value_name = "test"
|
30
|
-
expect(packet.lp_type.abs_offset % 4).to eq 0
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
22
|
describe '#lp_type' do
|
35
|
-
it 'is a
|
36
|
-
expect(packet.lp_type).to be_a RubySMB::Dcerpc::Ndr::
|
23
|
+
it 'is a NdrUint32Ptr structure' do
|
24
|
+
expect(packet.lp_type).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
|
37
25
|
end
|
38
26
|
end
|
39
27
|
|
40
28
|
describe '#lp_data' do
|
41
|
-
it 'is a
|
42
|
-
expect(packet.lp_data).to be_a RubySMB::Dcerpc::Ndr::
|
29
|
+
it 'is a NdrByteArrayPtr structure' do
|
30
|
+
expect(packet.lp_data).to be_a RubySMB::Dcerpc::Ndr::NdrByteArrayPtr
|
43
31
|
end
|
44
32
|
end
|
45
33
|
|
46
34
|
describe '#lpcb_data' do
|
47
|
-
it 'is a
|
48
|
-
expect(packet.lpcb_data).to be_a RubySMB::Dcerpc::Ndr::
|
35
|
+
it 'is a NdrUint32Ptr structure' do
|
36
|
+
expect(packet.lpcb_data).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
|
49
37
|
end
|
50
38
|
end
|
51
39
|
|
52
40
|
describe '#lpcb_len' do
|
53
|
-
it 'is a
|
54
|
-
expect(packet.lpcb_len).to be_a RubySMB::Dcerpc::Ndr::
|
41
|
+
it 'is a NdrUint32Ptr structure' do
|
42
|
+
expect(packet.lpcb_len).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
|
55
43
|
end
|
56
44
|
end
|
57
45
|
|
58
46
|
describe '#error_status' do
|
59
|
-
it 'is a
|
60
|
-
expect(packet.error_status).to be_a
|
47
|
+
it 'is a NdrUint32' do
|
48
|
+
expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
61
49
|
end
|
62
50
|
end
|
63
51
|
|
@@ -66,17 +54,5 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumValueResponse do
|
|
66
54
|
expect(packet.opnum).to eq(RubySMB::Dcerpc::Winreg::REG_ENUM_VALUE)
|
67
55
|
end
|
68
56
|
end
|
69
|
-
|
70
|
-
describe '#pad_length' do
|
71
|
-
it 'returns 0 when #lp_class is already 4-byte aligned' do
|
72
|
-
packet.lp_value_name = 'align'
|
73
|
-
expect(packet.pad_length).to eq 0
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'returns 2 when #lp_class is only 2-byte aligned' do
|
77
|
-
packet.lp_value_name = 'align' + 'A'
|
78
|
-
expect(packet.pad_length).to eq 2
|
79
|
-
end
|
80
|
-
end
|
81
57
|
end
|
82
58
|
|
@@ -9,7 +9,6 @@ RSpec.describe RubySMB::Dcerpc::Winreg::OpenKeyRequest do
|
|
9
9
|
|
10
10
|
it { is_expected.to respond_to :hkey }
|
11
11
|
it { is_expected.to respond_to :lp_sub_key }
|
12
|
-
it { is_expected.to respond_to :pad }
|
13
12
|
it { is_expected.to respond_to :dw_options }
|
14
13
|
it { is_expected.to respond_to :sam_desired }
|
15
14
|
it { is_expected.to respond_to :opnum }
|
@@ -30,20 +29,9 @@ RSpec.describe RubySMB::Dcerpc::Winreg::OpenKeyRequest do
|
|
30
29
|
end
|
31
30
|
end
|
32
31
|
|
33
|
-
describe '#pad' do
|
34
|
-
it 'is a string' do
|
35
|
-
expect(packet.pad).to be_a BinData::String
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'should keep #dw_options 4-byte aligned' do
|
39
|
-
packet.lp_sub_key = "test"
|
40
|
-
expect(packet.dw_options.abs_offset % 4).to eq 0
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
32
|
describe '#dw_options' do
|
45
|
-
it 'is a
|
46
|
-
expect(packet.dw_options).to be_a
|
33
|
+
it 'is a NdrUint32' do
|
34
|
+
expect(packet.dw_options).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
47
35
|
end
|
48
36
|
end
|
49
37
|
|
@@ -58,17 +46,5 @@ RSpec.describe RubySMB::Dcerpc::Winreg::OpenKeyRequest do
|
|
58
46
|
expect(packet.opnum).to eq(RubySMB::Dcerpc::Winreg::REG_OPEN_KEY)
|
59
47
|
end
|
60
48
|
end
|
61
|
-
|
62
|
-
describe '#pad_length' do
|
63
|
-
it 'returns 0 when #dw_options is already 4-byte aligned' do
|
64
|
-
packet.lp_sub_key = 'align'
|
65
|
-
expect(packet.pad_length).to eq 0
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'returns 2 when #dw_options is only 2-byte aligned' do
|
69
|
-
packet.lp_sub_key = 'align' + 'A'
|
70
|
-
expect(packet.pad_length).to eq 2
|
71
|
-
end
|
72
|
-
end
|
73
49
|
end
|
74
50
|
|
@@ -22,8 +22,8 @@ RSpec.describe RubySMB::Dcerpc::Winreg::OpenKeyResponse 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
|
|
@@ -1,38 +1,30 @@
|
|
1
1
|
RSpec.describe RubySMB::Dcerpc::Winreg::PRegistryServerName do
|
2
|
-
it 'is
|
3
|
-
expect(described_class).to be <
|
2
|
+
it 'is BinData::Array subclass' do
|
3
|
+
expect(described_class).to be < BinData::Array
|
4
|
+
end
|
5
|
+
|
6
|
+
it 'is a RubySMB::Dcerpc::Ndr::PointerClassPlugin class' do
|
7
|
+
expect(described_class).to be_a(RubySMB::Dcerpc::Ndr::PointerClassPlugin)
|
4
8
|
end
|
5
9
|
|
6
10
|
subject(:packet) { described_class.new }
|
7
11
|
|
8
|
-
it { is_expected.to respond_to :
|
12
|
+
it { is_expected.to respond_to :ref_id }
|
9
13
|
|
10
|
-
it 'is
|
11
|
-
expect(
|
14
|
+
it 'is an array of UTF-16LE strings' do
|
15
|
+
expect(packet[0]).to be_a RubySMB::Field::String16
|
12
16
|
end
|
13
17
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'only exists if #referent_id is not 0' do
|
20
|
-
packet.referent_id = 0
|
21
|
-
expect(packet.referent?).to be false
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'reads 4-bytes' do
|
25
|
-
str = 'spec_test'.encode('utf-16le')
|
26
|
-
packet.referent.read(str)
|
27
|
-
expect(packet.referent.to_binary_s.bytes).to eq(str.bytes[0,4])
|
28
|
-
end
|
18
|
+
it 'is :null if #ref_id is 0' do
|
19
|
+
packet.ref_id = 0
|
20
|
+
expect(packet).to eq(:null)
|
29
21
|
end
|
30
22
|
end
|
31
23
|
|
32
24
|
RSpec.describe RubySMB::Dcerpc::Winreg::OpenRootKeyRequest do
|
33
25
|
subject(:packet) { described_class.new }
|
34
26
|
|
35
|
-
it { is_expected.to respond_to :
|
27
|
+
it { is_expected.to respond_to :server_name }
|
36
28
|
it { is_expected.to respond_to :sam_desired }
|
37
29
|
it { is_expected.to respond_to :opnum }
|
38
30
|
|
@@ -40,9 +32,9 @@ RSpec.describe RubySMB::Dcerpc::Winreg::OpenRootKeyRequest do
|
|
40
32
|
expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
|
41
33
|
end
|
42
34
|
|
43
|
-
describe '#
|
35
|
+
describe '#server_name' do
|
44
36
|
it 'is a PRegistryServerName structure' do
|
45
|
-
expect(packet.
|
37
|
+
expect(packet.server_name).to be_a RubySMB::Dcerpc::Winreg::PRegistryServerName
|
46
38
|
end
|
47
39
|
end
|
48
40
|
|
@@ -60,8 +52,8 @@ RSpec.describe RubySMB::Dcerpc::Winreg::OpenRootKeyRequest do
|
|
60
52
|
end
|
61
53
|
end
|
62
54
|
|
63
|
-
it 'sets #
|
64
|
-
expect(packet.
|
55
|
+
it 'sets #server_name.referent to :null' do
|
56
|
+
expect(packet.server_name).to eq(:null)
|
65
57
|
end
|
66
58
|
|
67
59
|
context 'when #opnum is not OPEN_HKPD, OPEN_HKPT or OPEN_HKPN' do
|
@@ -22,8 +22,8 @@ RSpec.describe RubySMB::Dcerpc::Winreg::OpenRootKeyResponse 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
|
|
@@ -2,7 +2,6 @@ RSpec.describe RubySMB::Dcerpc::Winreg::QueryInfoKeyResponse do
|
|
2
2
|
subject(:packet) { described_class.new }
|
3
3
|
|
4
4
|
it { is_expected.to respond_to :lp_class }
|
5
|
-
it { is_expected.to respond_to :pad }
|
6
5
|
it { is_expected.to respond_to :lpc_sub_keys }
|
7
6
|
it { is_expected.to respond_to :lpc_max_sub_key_len }
|
8
7
|
it { is_expected.to respond_to :lpc_max_class_len }
|
@@ -23,73 +22,62 @@ RSpec.describe RubySMB::Dcerpc::Winreg::QueryInfoKeyResponse do
|
|
23
22
|
expect(packet.lp_class).to be_a RubySMB::Dcerpc::RrpUnicodeString
|
24
23
|
end
|
25
24
|
|
26
|
-
it 'has
|
27
|
-
expect(packet.lp_class).to eq(0)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#pad' do
|
32
|
-
it 'is a string' do
|
33
|
-
expect(packet.pad).to be_a BinData::String
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'should keep #lpc_sub_keys 4-byte aligned' do
|
37
|
-
packet.lp_class = 'test'
|
38
|
-
expect(packet.lpc_sub_keys.abs_offset % 4).to eq 0
|
25
|
+
it 'has the expected initial value' do
|
26
|
+
expect(packet.lp_class).to eq({:buffer_length=>0, :maximum_length=>0, :buffer=>:null})
|
39
27
|
end
|
40
28
|
end
|
41
29
|
|
42
30
|
describe '#lpc_sub_keys' do
|
43
|
-
it 'is a
|
44
|
-
expect(packet.lpc_sub_keys).to be_a
|
31
|
+
it 'is a NdrUint32' do
|
32
|
+
expect(packet.lpc_sub_keys).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
45
33
|
end
|
46
34
|
end
|
47
35
|
|
48
36
|
describe '#lpc_max_sub_key_len' do
|
49
|
-
it 'is a
|
50
|
-
expect(packet.lpc_max_sub_key_len).to be_a
|
37
|
+
it 'is a NdrUint32' do
|
38
|
+
expect(packet.lpc_max_sub_key_len).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
51
39
|
end
|
52
40
|
end
|
53
41
|
|
54
42
|
describe '#lpc_max_class_len' do
|
55
|
-
it 'is a
|
56
|
-
expect(packet.lpc_max_class_len).to be_a
|
43
|
+
it 'is a NdrUint32' do
|
44
|
+
expect(packet.lpc_max_class_len).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
57
45
|
end
|
58
46
|
end
|
59
47
|
|
60
48
|
describe '#lpc_values' do
|
61
|
-
it 'is a
|
62
|
-
expect(packet.lpc_values).to be_a
|
49
|
+
it 'is a NdrUint32' do
|
50
|
+
expect(packet.lpc_values).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
63
51
|
end
|
64
52
|
end
|
65
53
|
|
66
54
|
describe '#lpcb_max_value_name_len' do
|
67
|
-
it 'is a
|
68
|
-
expect(packet.lpcb_max_value_name_len).to be_a
|
55
|
+
it 'is a NdrUint32' do
|
56
|
+
expect(packet.lpcb_max_value_name_len).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
69
57
|
end
|
70
58
|
end
|
71
59
|
|
72
60
|
describe '#lpcb_max_value_len' do
|
73
|
-
it 'is a
|
74
|
-
expect(packet.lpcb_max_value_len).to be_a
|
61
|
+
it 'is a NdrUint32' do
|
62
|
+
expect(packet.lpcb_max_value_len).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
75
63
|
end
|
76
64
|
end
|
77
65
|
|
78
66
|
describe '#lpcb_security_descriptor' do
|
79
|
-
it 'is a
|
80
|
-
expect(packet.lpcb_security_descriptor).to be_a
|
67
|
+
it 'is a NdrUint32' do
|
68
|
+
expect(packet.lpcb_security_descriptor).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
81
69
|
end
|
82
70
|
end
|
83
71
|
|
84
72
|
describe '#lpft_last_write_time' do
|
85
|
-
it 'is a
|
86
|
-
expect(packet.lpft_last_write_time).to be_a RubySMB::
|
73
|
+
it 'is a NdrFileTime structure' do
|
74
|
+
expect(packet.lpft_last_write_time).to be_a RubySMB::Dcerpc::Ndr::NdrFileTime
|
87
75
|
end
|
88
76
|
end
|
89
77
|
|
90
78
|
describe '#error_status' do
|
91
|
-
it 'is a
|
92
|
-
expect(packet.error_status).to be_a
|
79
|
+
it 'is a NdrUint32' do
|
80
|
+
expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
|
93
81
|
end
|
94
82
|
end
|
95
83
|
|
@@ -98,16 +86,4 @@ RSpec.describe RubySMB::Dcerpc::Winreg::QueryInfoKeyResponse do
|
|
98
86
|
expect(packet.opnum).to eq(RubySMB::Dcerpc::Winreg::REG_QUERY_INFO_KEY)
|
99
87
|
end
|
100
88
|
end
|
101
|
-
|
102
|
-
describe '#pad_length' do
|
103
|
-
it 'returns 0 when #lpc_sub_keys is already 4-byte aligned' do
|
104
|
-
packet.lp_class = 'align'
|
105
|
-
expect(packet.pad_length).to eq 0
|
106
|
-
end
|
107
|
-
|
108
|
-
it 'returns 2 when #lpc_sub_keys is only 2-byte aligned' do
|
109
|
-
packet.lp_class = 'align' + 'A'
|
110
|
-
expect(packet.pad_length).to eq 2
|
111
|
-
end
|
112
|
-
end
|
113
89
|
end
|
@@ -9,10 +9,8 @@ RSpec.describe RubySMB::Dcerpc::Winreg::QueryValueRequest do
|
|
9
9
|
|
10
10
|
it { is_expected.to respond_to :hkey }
|
11
11
|
it { is_expected.to respond_to :lp_value_name }
|
12
|
-
it { is_expected.to respond_to :pad1 }
|
13
12
|
it { is_expected.to respond_to :lp_type }
|
14
13
|
it { is_expected.to respond_to :lp_data }
|
15
|
-
it { is_expected.to respond_to :pad2 }
|
16
14
|
it { is_expected.to respond_to :lpcb_data }
|
17
15
|
it { is_expected.to respond_to :lpcb_len }
|
18
16
|
it { is_expected.to respond_to :opnum }
|
@@ -33,49 +31,27 @@ RSpec.describe RubySMB::Dcerpc::Winreg::QueryValueRequest do
|
|
33
31
|
end
|
34
32
|
end
|
35
33
|
|
36
|
-
describe '#pad1' do
|
37
|
-
it 'is a string' do
|
38
|
-
expect(packet.pad1).to be_a BinData::String
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'should keep #lp_type 4-byte aligned' do
|
42
|
-
packet.lp_value_name = 'test'
|
43
|
-
expect(packet.lp_type.abs_offset % 4).to eq 0
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
34
|
describe '#lp_type' do
|
48
|
-
it 'is a
|
49
|
-
expect(packet.lp_type).to be_a RubySMB::Dcerpc::Ndr::
|
35
|
+
it 'is a Ndr::NdrUint32Ptr structure' do
|
36
|
+
expect(packet.lp_type).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
|
50
37
|
end
|
51
38
|
end
|
52
39
|
|
53
40
|
describe '#lp_data' do
|
54
|
-
it 'is a
|
55
|
-
expect(packet.lp_data).to be_a RubySMB::Dcerpc::Ndr::
|
41
|
+
it 'is a Ndr::NdrByteArrayPtr structure' do
|
42
|
+
expect(packet.lp_data).to be_a RubySMB::Dcerpc::Ndr::NdrByteArrayPtr
|
56
43
|
end
|
57
44
|
end
|
58
45
|
|
59
46
|
describe '#lpcb_data' do
|
60
|
-
it 'is a
|
61
|
-
expect(packet.lpcb_data).to be_a RubySMB::Dcerpc::Ndr::
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe '#pad2' do
|
66
|
-
it 'is a string' do
|
67
|
-
expect(packet.pad2).to be_a BinData::String
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'should keep #lpcb_data 4-byte aligned' do
|
71
|
-
packet.lp_data = [1, 2]
|
72
|
-
expect(packet.lpcb_data.abs_offset % 4).to eq 0
|
47
|
+
it 'is a Ndr::NdrUint32Ptr structure' do
|
48
|
+
expect(packet.lpcb_data).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
|
73
49
|
end
|
74
50
|
end
|
75
51
|
|
76
52
|
describe '#lpcb_len' do
|
77
|
-
it 'is a
|
78
|
-
expect(packet.lpcb_len).to be_a RubySMB::Dcerpc::Ndr::
|
53
|
+
it 'is a Ndr::NdrUint32Ptr structure' do
|
54
|
+
expect(packet.lpcb_len).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
|
79
55
|
end
|
80
56
|
end
|
81
57
|
|