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
@@ -3,30 +3,30 @@ module RubySMB
|
|
3
3
|
|
4
4
|
# This class represents a RPC_SECURITY_DESCRIPTOR structure as defined in
|
5
5
|
# [2.2.8 RPC_SECURITY_DESCRIPTOR](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rrp/9729e781-8eb9-441b-82ca-e898f98d29c2)
|
6
|
-
class RpcSecurityDescriptor <
|
6
|
+
class RpcSecurityDescriptor < Ndr::NdrStruct
|
7
|
+
default_parameters byte_align: 4
|
7
8
|
endian :little
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
ndr_byte_array_ptr :lp_security_descriptor
|
11
|
+
ndr_uint32 :cb_in_security_descriptor
|
12
|
+
ndr_uint32 :cb_out_security_descriptor
|
12
13
|
end
|
13
14
|
|
14
15
|
# This class represents a RPC_SECURITY_ATTRIBUTES structure as defined in
|
15
16
|
# [2.2.7 RPC_SECURITY_ATTRIBUTES](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rrp/bc37b8cf-8c94-4804-ad53-0aaf5eaf0ecb)
|
16
|
-
class RpcSecurityAttributes <
|
17
|
+
class RpcSecurityAttributes < Ndr::NdrStruct
|
18
|
+
default_parameters byte_align: 4
|
17
19
|
endian :little
|
18
20
|
|
19
|
-
|
21
|
+
ndr_uint32 :n_length
|
20
22
|
rpc_security_descriptor :rpc_security_descriptor
|
21
|
-
|
23
|
+
ndr_uint8 :b_inheritHandle
|
22
24
|
end
|
23
25
|
|
24
26
|
# This class represents a pointer to a RPC_SECURITY_ATTRIBUTES structure as defined in
|
25
27
|
# [2.2.7 RPC_SECURITY_ATTRIBUTES](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rrp/bc37b8cf-8c94-4804-ad53-0aaf5eaf0ecb)
|
26
|
-
class PrpcSecurityAttributes <
|
27
|
-
|
28
|
-
|
29
|
-
rpc_security_attributes :referent, onlyif: -> { self.referent_id != 0 }
|
28
|
+
class PrpcSecurityAttributes < RpcSecurityAttributes
|
29
|
+
extend Ndr::PointerClassPlugin
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
|
4
|
+
# A RRP_UNICODE_STRING structure as defined in
|
5
|
+
# [2.2.4 RRP_UNICODE_STRING](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rrp/c0c90f11-a4c4-496a-ac09-8a8a3697ceef)
|
6
|
+
class RrpUnicodeString < Ndr::NdrStruct
|
7
|
+
default_parameters byte_align: 4
|
8
|
+
endian :little
|
9
|
+
|
10
|
+
ndr_uint16 :buffer_length
|
11
|
+
ndr_uint16 :maximum_length
|
12
|
+
ndr_wide_stringz_ptr :buffer
|
13
|
+
|
14
|
+
def assign(val)
|
15
|
+
case val
|
16
|
+
when :null
|
17
|
+
self.buffer = val
|
18
|
+
self.buffer_length = 0
|
19
|
+
self.maximum_length = 0
|
20
|
+
when BinData::Stringz, BinData::String, String
|
21
|
+
self.buffer = val.to_s
|
22
|
+
val_length = val.strip.length
|
23
|
+
val_length += 1 unless val == ''
|
24
|
+
self.buffer_length = val_length * 2
|
25
|
+
self.maximum_length = val_length * 2
|
26
|
+
else
|
27
|
+
super
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Set `maximum_length` and buffer `max_count` values to `val`. It also
|
32
|
+
# takes care of initializing the buffer pointer `ref_id` if the pointer
|
33
|
+
# is null.
|
34
|
+
#
|
35
|
+
# This helper is typically called in requests where a unicode string
|
36
|
+
# field needs to contain the maximum length information without any
|
37
|
+
# string value. It is usually required by some RPC calls and used by the
|
38
|
+
# server to determine the maximum length for the corresponding output
|
39
|
+
# field in order to allocate space accordingly.
|
40
|
+
def set_max_buffer_size(val)
|
41
|
+
self.buffer.instantiate_referent if self.buffer.is_null_ptr?
|
42
|
+
self.buffer.max_count = val / 2
|
43
|
+
self.maximum_length.assign(val)
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_s
|
47
|
+
return ''.encode('utf-16le') if self.buffer.is_null_ptr?
|
48
|
+
self.buffer.to_s
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# A pointer to a RRP_UNICODE_STRING structure
|
53
|
+
class PrrpUnicodeString < RrpUnicodeString
|
54
|
+
extend Ndr::PointerClassPlugin
|
55
|
+
end
|
56
|
+
|
57
|
+
# A RPC_UNICODE_STRING structure as defined in
|
58
|
+
# [2.3.10 RPC_UNICODE_STRING](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/94a16bb6-c610-4cb9-8db6-26f15f560061)
|
59
|
+
class RpcUnicodeString < Ndr::NdrStruct
|
60
|
+
# Same as RrpUnicodeString, but not necessary null terminated
|
61
|
+
#
|
62
|
+
# It is the caller responsability to null terminate the string, if it has
|
63
|
+
# to. This structure won't do it automatically the way RrpUnicodeString
|
64
|
+
# do.
|
65
|
+
#
|
66
|
+
# It also takes care of detecting the terminating null character and
|
67
|
+
# exclude when calculating buffer_length and maximum_length.
|
68
|
+
default_parameters byte_align: 4
|
69
|
+
endian :little
|
70
|
+
|
71
|
+
ndr_uint16 :buffer_length
|
72
|
+
ndr_uint16 :maximum_length
|
73
|
+
ndr_wide_string_ptr :buffer
|
74
|
+
|
75
|
+
def assign(val)
|
76
|
+
case val
|
77
|
+
when :null
|
78
|
+
self.buffer = val
|
79
|
+
self.buffer_length = 0
|
80
|
+
self.maximum_length = 0
|
81
|
+
when BinData::Stringz, BinData::String, String
|
82
|
+
self.buffer = val.to_s
|
83
|
+
val_length = val.strip.length
|
84
|
+
self.buffer_length = val_length * 2
|
85
|
+
self.maximum_length = val_length * 2
|
86
|
+
else
|
87
|
+
super
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Set `maximum_length` and buffer `max_count` values to `val`. It also
|
92
|
+
# takes care of initializing the buffer pointer `ref_id` if the pointer
|
93
|
+
# is null.
|
94
|
+
#
|
95
|
+
# This helper is typically called in requests where a unicode string
|
96
|
+
# field needs to contain the maximum length information without any
|
97
|
+
# string value. It is usually required by some RPC calls and used by the
|
98
|
+
# server to determine the maximum length for the corresponding output
|
99
|
+
# field in order to allocate space accordingly.
|
100
|
+
def set_max_buffer_size(val)
|
101
|
+
self.buffer.instantiate_referent if self.buffer.is_null_ptr?
|
102
|
+
self.buffer.max_count = val / 2
|
103
|
+
self.maximum_length.assign(val)
|
104
|
+
end
|
105
|
+
|
106
|
+
def to_s
|
107
|
+
return ''.encode('utf-16le') if self.buffer.is_null_ptr?
|
108
|
+
self.buffer.to_s
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# A pointer to a RPC_UNICODE_STRING structure
|
113
|
+
class PrpcUnicodeString < RpcUnicodeString
|
114
|
+
extend Ndr::PointerClassPlugin
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
@@ -0,0 +1,150 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module Samr
|
4
|
+
WELL_KNOWN_SID_NAME = {
|
5
|
+
[0,0] => 'NULL SID',
|
6
|
+
[1,0] => 'Everyone',
|
7
|
+
[2,0] => 'LOCAL',
|
8
|
+
[2,1] => 'CONSOLE LOGON',
|
9
|
+
[3,0] => 'CREATOR OWNER',
|
10
|
+
[3,1] => 'CREATOR GROUP',
|
11
|
+
[3,2] => 'CREATOR OWNER SERVER',
|
12
|
+
[3,3] => 'CREATOR GROUP SERVER',
|
13
|
+
[3,4] => 'OWNER RIGHTS',
|
14
|
+
[5,1] => 'NT AUTHORITY\\DIALUP',
|
15
|
+
[5,2] => 'NT AUTHORITY\\NETWORK',
|
16
|
+
[5,3] => 'NT AUTHORITY\\BATCH',
|
17
|
+
[5,4] => 'NT AUTHORITY\\INTERACTIVE',
|
18
|
+
[5,6] => 'NT AUTHORITY\\SERVICE',
|
19
|
+
[5,7] => 'NT AUTHORITY\\ANONYMOUS LOGON',
|
20
|
+
[5,8] => 'NT AUTHORITY\\PROXY',
|
21
|
+
[5,9] => 'NT AUTHORITY\\ENTERPRISE DOMAIN CONTROLLERS',
|
22
|
+
[5,10] => 'NT AUTHORITY\\SELF',
|
23
|
+
[5,11] => 'NT AUTHORITY\\Authenticated Users',
|
24
|
+
[5,12] => 'NT AUTHORITY\\RESTRICTED',
|
25
|
+
[5,13] => 'NT AUTHORITY\\TERMINAL SERVER USER',
|
26
|
+
[5,14] => 'NT AUTHORITY\\REMOTE INTERACTIVE LOGON',
|
27
|
+
[5,15] => 'NT AUTHORITY\\This Organization',
|
28
|
+
[5,17] => 'NT AUTHORITY\\IUSR',
|
29
|
+
[5,18] => 'NT AUTHORITY\\SYSTEM',
|
30
|
+
[5,19] => 'NT AUTHORITY\\LOCAL SERVICE',
|
31
|
+
[5,20] => 'NT AUTHORITY\\NETWORK SERVICE',
|
32
|
+
[5,22] => 'NT AUTHORITY\\ENTERPRISE READ-ONLY DOMAIN CONTROLLERS BETA',
|
33
|
+
[5,33] => 'NT AUTHORITY\\WRITE RESTRICTED',
|
34
|
+
[5,32] => 'Builtin Domain'
|
35
|
+
}
|
36
|
+
|
37
|
+
WELL_KNOWN_RID_NAME = {
|
38
|
+
498 => '(domain)\\Enterprise Read-only Domain Controllers',
|
39
|
+
500 => '(domain)\\Administrator',
|
40
|
+
501 => '(domain)\\Guest',
|
41
|
+
502 => '(domain)\\krbtgt',
|
42
|
+
512 => '(domain)\\Domain Admins',
|
43
|
+
513 => '(domain)\\Domain Users',
|
44
|
+
514 => '(domain)\\Domain Guests',
|
45
|
+
515 => '(domain)\\Domain Computers',
|
46
|
+
516 => '(domain)\\Domain Controllers',
|
47
|
+
517 => '(domain)\\Cert Publishers',
|
48
|
+
518 => '(domain)\\Schema Admins',
|
49
|
+
519 => '(domain)\\Enterprise Admins',
|
50
|
+
520 => '(domain)\\Group Policy Creator Owners',
|
51
|
+
521 => '(domain)\\Read-only Domain Controllers',
|
52
|
+
522 => '(domain)\\Cloneable Domain Controllers',
|
53
|
+
544 => 'BUILTIN\\Administrators',
|
54
|
+
545 => 'BUILTIN\\Users',
|
55
|
+
546 => 'BUILTIN\\Guests',
|
56
|
+
548 => 'BUILTIN\\Account Operators',
|
57
|
+
549 => 'BUILTIN\\Server Operators',
|
58
|
+
550 => 'BUILTIN\\Print Operators',
|
59
|
+
551 => 'BUILTIN\\Backup Operators',
|
60
|
+
552 => 'BUILTIN\\Replicator',
|
61
|
+
553 => '(domain)\\RAS and IAS Servers',
|
62
|
+
554 => 'BUILTIN\\Pre-Windows 2000 Compatible Access',
|
63
|
+
555 => 'BUILTIN\\Remote Desktop Users',
|
64
|
+
556 => 'BUILTIN\\Network Configuration Operators',
|
65
|
+
557 => 'BUILTIN\\Incoming Forest Trust Builders',
|
66
|
+
558 => 'BUILTIN\\Performance Monitor Users',
|
67
|
+
559 => 'BUILTIN\\Performance Log Users',
|
68
|
+
560 => 'BUILTIN\\Windows Authorization Access Group',
|
69
|
+
561 => 'BUILTIN\\Terminal Server License Servers',
|
70
|
+
562 => 'BUILTIN\\Distributed COM Users',
|
71
|
+
568 => 'BUILTIN\\IIS_IUSRS',
|
72
|
+
569 => 'BUILTIN\\Cryptographic Operators',
|
73
|
+
571 => '(domain)\\Allowed RODC Password Replication Group',
|
74
|
+
572 => '(domain)\\Denied RODC Password Replication Group',
|
75
|
+
573 => 'BUILTIN\\Event Log Readers',
|
76
|
+
574 => 'BUILTIN\\Certificate Service DCOM Access',
|
77
|
+
575 => 'BUILTIN\\RDS Remote Access Servers',
|
78
|
+
576 => 'BUILTIN\\RDS Endpoint Servers',
|
79
|
+
577 => 'BUILTIN\\RDS Management Servers',
|
80
|
+
578 => 'BUILTIN\\Hyper-V Administrators',
|
81
|
+
579 => 'BUILTIN\\Access Control Assistance Operators',
|
82
|
+
580 => 'BUILTIN\\Remote Management Users'
|
83
|
+
}
|
84
|
+
|
85
|
+
#[2.4.1.1 RPC_SID_IDENTIFIER_AUTHORITY](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/d7e6e5a5-437c-41e5-8ba1-bdfd43e96cbc)
|
86
|
+
class RpcSidIdentifierAuthority < Ndr::NdrFixArray
|
87
|
+
default_parameters type: :ndr_uint8, initial_length: 6, byte_align: 1
|
88
|
+
end
|
89
|
+
|
90
|
+
# [2.4.2.3 RPC_SID](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/5cb97814-a1c2-4215-b7dc-76d1f4bfad01)
|
91
|
+
class RpcSid < Ndr::NdrStruct
|
92
|
+
default_parameters byte_align: 4
|
93
|
+
endian :little
|
94
|
+
|
95
|
+
ndr_uint8 :revision
|
96
|
+
ndr_uint8 :sub_authority_count, initial_value: -> { self.sub_authority.size }
|
97
|
+
rpc_sid_identifier_authority :identifier_authority
|
98
|
+
ndr_conf_array :sub_authority, type: :ndr_uint32
|
99
|
+
|
100
|
+
def snapshot
|
101
|
+
sid = ['S', self.revision.to_s, self.identifier_authority[-1].to_s]
|
102
|
+
self.sub_authority.each { |e| sid << e.to_s }
|
103
|
+
sid.join('-')
|
104
|
+
end
|
105
|
+
|
106
|
+
def assign(val)
|
107
|
+
case val
|
108
|
+
when String
|
109
|
+
elems = val.split('-')
|
110
|
+
raise ArgumentError, "Wrong SID format" unless elems[0].downcase == 's'
|
111
|
+
self.revision = elems[1].to_i
|
112
|
+
self.sub_authority_count = elems[3..-1].size
|
113
|
+
self.identifier_authority = [0, 0, 0, 0, 0, elems[2].to_i]
|
114
|
+
self.sub_authority = elems[3..-1].map(&:to_i)
|
115
|
+
when RpcSid
|
116
|
+
super
|
117
|
+
else
|
118
|
+
raise ArgumentError, "Can only assign String or other RpcSid object (got #{val.class})"
|
119
|
+
end
|
120
|
+
self
|
121
|
+
end
|
122
|
+
|
123
|
+
def name
|
124
|
+
sid = case sub_authority.size
|
125
|
+
when 1
|
126
|
+
WELL_KNOWN_SID_NAME[[identifier_authority[-1].to_i, sub_authority[0].to_i]]
|
127
|
+
when 2
|
128
|
+
if identifier_authority[-1] == 5 && sub_authority[0] == 32
|
129
|
+
WELL_KNOWN_RID_NAME[sub_authority[1]]
|
130
|
+
end
|
131
|
+
when 3
|
132
|
+
if identifier_authority[-1] == 5 && sub_authority[0] == 5
|
133
|
+
"Current Session Logon SID"
|
134
|
+
end
|
135
|
+
else
|
136
|
+
if identifier_authority[-1] == 5
|
137
|
+
WELL_KNOWN_RID_NAME[sub_authority.last]
|
138
|
+
end
|
139
|
+
end
|
140
|
+
sid || "Unknown SID (#{self})"
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
class PrpcSid < RpcSid
|
145
|
+
extend Ndr::PointerClassPlugin
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module Samr
|
4
|
+
|
5
|
+
# [3.1.5.13.1 SamrCloseHandle (Opnum 1)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/55d134df-e257-48ad-8afa-cb2ca45cd3cc)
|
6
|
+
class SamrCloseHandleRequest < BinData::Record
|
7
|
+
attr_reader :opnum
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
sampr_handle :sam_handle
|
12
|
+
|
13
|
+
def initialize_instance
|
14
|
+
super
|
15
|
+
@opnum = SAMR_CLOSE_HANDLE
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module Samr
|
4
|
+
|
5
|
+
# [3.1.5.13.1 SamrCloseHandle (Opnum 1)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/55d134df-e257-48ad-8afa-cb2ca45cd3cc)
|
6
|
+
class SamrCloseHandleResponse < BinData::Record
|
7
|
+
attr_reader :opnum
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
sampr_handle :sam_handle
|
12
|
+
ndr_uint32 :error_status
|
13
|
+
|
14
|
+
def initialize_instance
|
15
|
+
super
|
16
|
+
@opnum = SAMR_CLOSE_HANDLE
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module Samr
|
4
|
+
|
5
|
+
# [2.2.7.1 PSAMPR_SERVER_NAME](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/7a77f1ce-cc55-4e36-a3c2-87c48f835f86)
|
6
|
+
class PsamprServerName < RubySMB::Field::Stringz16
|
7
|
+
default_parameters referent_byte_align: 2
|
8
|
+
extend Ndr::PointerClassPlugin
|
9
|
+
end
|
10
|
+
|
11
|
+
# [3.1.5.1.4 SamrConnect (Opnum 0)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/defe2091-0a61-4dfa-be9a-2c1206d53a1f)
|
12
|
+
class SamrConnectRequest < BinData::Record
|
13
|
+
attr_reader :opnum
|
14
|
+
|
15
|
+
endian :little
|
16
|
+
|
17
|
+
psampr_server_name :server_name
|
18
|
+
# Access control on a server object: bitwise OR of common ACCESS_MASK
|
19
|
+
# and server ACCESS_MASK values (see lib/ruby_smb/dcerpc/samr.rb)
|
20
|
+
ndr_uint32 :desired_access
|
21
|
+
|
22
|
+
def initialize_instance
|
23
|
+
super
|
24
|
+
@opnum = SAMR_CONNECT
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module Samr
|
4
|
+
|
5
|
+
# [3.1.5.1.4 SamrConnect (Opnum 0)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/defe2091-0a61-4dfa-be9a-2c1206d53a1f)
|
6
|
+
class SamrConnectResponse < BinData::Record
|
7
|
+
attr_reader :opnum
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
sampr_handle :server_handle
|
12
|
+
ndr_uint32 :error_status
|
13
|
+
|
14
|
+
def initialize_instance
|
15
|
+
super
|
16
|
+
@opnum = SAMR_CONNECT
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module Samr
|
4
|
+
|
5
|
+
# [3.1.5.2.5 SamrEnumerateUsersInDomain (Opnum 13)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/6bdc92c0-c692-4ffb-9de7-65858b68da75)
|
6
|
+
class SamrEnumerateUsersInDomainRequest < BinData::Record
|
7
|
+
attr_reader :opnum
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
sampr_handle :domain_handle
|
12
|
+
ndr_uint32 :enumeration_context
|
13
|
+
# UserAccountControl flags are defined in lib/ruby_smb/dcerpc/samr.rb
|
14
|
+
ndr_uint32 :user_account_control
|
15
|
+
ndr_uint32 :prefered_maximum_length
|
16
|
+
|
17
|
+
def initialize_instance
|
18
|
+
super
|
19
|
+
@opnum = SAMR_ENUMERATE_USERS_IN_DOMAIN
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module Samr
|
4
|
+
|
5
|
+
# [2.2.3.9 SAMPR_RID_ENUMERATION](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/5c94a35a-e7f2-4675-af34-741f5a8ee1a2)
|
6
|
+
class SamprRidEnumeration < Ndr::NdrStruct
|
7
|
+
default_parameters byte_align: 4
|
8
|
+
endian :little
|
9
|
+
|
10
|
+
ndr_uint32 :relative_id
|
11
|
+
rpc_unicode_string :name
|
12
|
+
end
|
13
|
+
|
14
|
+
class SamprRidEnumerationArray < Ndr::NdrConfArray
|
15
|
+
default_parameter type: :sampr_rid_enumeration
|
16
|
+
end
|
17
|
+
|
18
|
+
class PsamprRidEnumerationArray < SamprRidEnumerationArray
|
19
|
+
extend Ndr::PointerClassPlugin
|
20
|
+
end
|
21
|
+
|
22
|
+
# [2.2.3.10 SAMPR_ENUMERATION_BUFFER](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/c53161a4-38e8-4a28-a33e-0d378fce03dd)
|
23
|
+
class SamprEnumerationBuffer < Ndr::NdrStruct
|
24
|
+
default_parameters byte_align: 4
|
25
|
+
endian :little
|
26
|
+
|
27
|
+
ndr_uint32 :entries_read
|
28
|
+
psampr_rid_enumeration_array :buffer
|
29
|
+
end
|
30
|
+
|
31
|
+
class PsamprEnumerationBuffer < SamprEnumerationBuffer
|
32
|
+
extend Ndr::PointerClassPlugin
|
33
|
+
end
|
34
|
+
|
35
|
+
# [3.1.5.2.5 SamrEnumerateUsersInDomain (Opnum 13)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/6bdc92c0-c692-4ffb-9de7-65858b68da75)
|
36
|
+
class SamrEnumerateUsersInDomainResponse < BinData::Record
|
37
|
+
attr_reader :opnum
|
38
|
+
|
39
|
+
endian :little
|
40
|
+
|
41
|
+
ndr_uint32 :enumeration_context
|
42
|
+
psampr_enumeration_buffer :buffer
|
43
|
+
ndr_uint32 :count_returned
|
44
|
+
ndr_uint32 :error_status
|
45
|
+
|
46
|
+
def initialize_instance
|
47
|
+
super
|
48
|
+
@opnum = SAMR_ENUMERATE_USERS_IN_DOMAIN
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module Samr
|
4
|
+
|
5
|
+
#[2.2.7.6 SAMPR_SID_INFORMATION](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/0c138399-f663-4039-b4e7-b3c9f82bff65)
|
6
|
+
class SamprSidInformation < Ndr::NdrStruct
|
7
|
+
default_parameter byte_align: 4
|
8
|
+
|
9
|
+
rpc_sid :sid_pointer
|
10
|
+
end
|
11
|
+
|
12
|
+
class PsamprSidInformation < SamprSidInformation
|
13
|
+
extend Ndr::PointerClassPlugin
|
14
|
+
end
|
15
|
+
|
16
|
+
class PsamprSidInformationArray < Ndr::NdrConfArray
|
17
|
+
default_parameter type: :psampr_sid_information
|
18
|
+
extend Ndr::PointerClassPlugin
|
19
|
+
end
|
20
|
+
|
21
|
+
# [2.2.7.5 SAMPR_PSID_ARRAY](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/1d40622e-52e4-4aaa-bc77-aa626089f116)
|
22
|
+
class SamprPsidArray < Ndr::NdrStruct
|
23
|
+
default_parameter byte_align: 4
|
24
|
+
|
25
|
+
ndr_uint32 :sid_count, initial_value: -> { sids.size }
|
26
|
+
psampr_sid_information_array :sids
|
27
|
+
end
|
28
|
+
|
29
|
+
# [3.1.5.9.2 SamrGetAliasMembership (Opnum 16)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/03184045-2208-4c02-b38b-ef955d6dc3ef)
|
30
|
+
class SamrGetAliasMembershipRequest < BinData::Record
|
31
|
+
attr_reader :opnum
|
32
|
+
|
33
|
+
endian :little
|
34
|
+
|
35
|
+
sampr_handle :domain_handle
|
36
|
+
sampr_psid_array :sid_array
|
37
|
+
|
38
|
+
def initialize_instance
|
39
|
+
super
|
40
|
+
@opnum = SAMR_GET_ALIAS_MEMBERSHIP
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module Samr
|
4
|
+
|
5
|
+
class PulongArray < Ndr::NdrConfArray
|
6
|
+
default_parameter type: :ndr_uint32
|
7
|
+
extend Ndr::PointerClassPlugin
|
8
|
+
end
|
9
|
+
|
10
|
+
# [2.2.7.4 SAMPR_ULONG_ARRAY](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/2feb3806-4db2-45b7-90d2-86c8336a31ba)
|
11
|
+
class PsamprUlongArray < Ndr::NdrStruct
|
12
|
+
default_parameter byte_align: 4
|
13
|
+
|
14
|
+
ndr_uint32 :elem_count, initial_value: -> { elements.size }
|
15
|
+
pulong_array :elements
|
16
|
+
end
|
17
|
+
|
18
|
+
# [3.1.5.9.2 SamrGetAliasMembership (Opnum 16)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/03184045-2208-4c02-b38b-ef955d6dc3ef)
|
19
|
+
class SamrGetAliasMembershipResponse < BinData::Record
|
20
|
+
attr_reader :opnum
|
21
|
+
|
22
|
+
endian :little
|
23
|
+
|
24
|
+
psampr_ulong_array :membership
|
25
|
+
ndr_uint32 :error_status
|
26
|
+
|
27
|
+
def initialize_instance
|
28
|
+
super
|
29
|
+
@opnum = SAMR_GET_ALIAS_MEMBERSHIP
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module Samr
|
4
|
+
|
5
|
+
# [3.1.5.9.1 SamrGetGroupsForUser (Opnum 39)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/a4adbf20-040f-4416-a960-e5b7917fdae7)
|
6
|
+
class SamrGetGroupsForUserRequest < BinData::Record
|
7
|
+
attr_reader :opnum
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
sampr_handle :user_handle
|
12
|
+
|
13
|
+
def initialize_instance
|
14
|
+
super
|
15
|
+
@opnum = SAMR_GET_GROUPS_FOR_USER
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module Samr
|
4
|
+
|
5
|
+
# [[2.2.7.12 GROUP_MEMBERSHIP](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/dc0d27ac-5218-4709-9d1b-cab6f6d90b10)
|
6
|
+
class GroupMembership < Ndr::NdrStruct
|
7
|
+
default_parameter byte_align: 4
|
8
|
+
|
9
|
+
ndr_uint32 :relative_id
|
10
|
+
ndr_uint32 :attributes
|
11
|
+
end
|
12
|
+
|
13
|
+
class PgroupMembershipArray < Ndr::NdrConfArray
|
14
|
+
default_parameter type: :group_membership
|
15
|
+
extend Ndr::PointerClassPlugin
|
16
|
+
end
|
17
|
+
|
18
|
+
# [2.2.7.13 SAMPR_GET_GROUPS_BUFFER](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/31879676-cc95-4cf1-8f75-c09ddcef8750)
|
19
|
+
class SamprGetGroupsBuffer < Ndr::NdrStruct
|
20
|
+
default_parameter byte_align: 4
|
21
|
+
|
22
|
+
ndr_uint32 :membership_count, initial_value: -> { groups.size }
|
23
|
+
pgroup_membership_array :groups
|
24
|
+
end
|
25
|
+
|
26
|
+
class PsamprGetGroupsBuffer < SamprGetGroupsBuffer
|
27
|
+
extend Ndr::PointerClassPlugin
|
28
|
+
end
|
29
|
+
|
30
|
+
# [3.1.5.9.1 SamrGetGroupsForUser (Opnum 39)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/a4adbf20-040f-4416-a960-e5b7917fdae7)
|
31
|
+
class SamrGetGroupsForUserResponse < BinData::Record
|
32
|
+
attr_reader :opnum
|
33
|
+
|
34
|
+
endian :little
|
35
|
+
|
36
|
+
psampr_get_groups_buffer :groups
|
37
|
+
ndr_uint32 :error_status
|
38
|
+
|
39
|
+
def initialize_instance
|
40
|
+
super
|
41
|
+
@opnum = SAMR_GET_GROUPS_FOR_USER
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module Samr
|
4
|
+
|
5
|
+
# [3.1.5.11.1 SamrLookupDomainInSamServer (Opnum 5)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/47492d59-e095-4398-b03e-8a062b989123)
|
6
|
+
class SamrLookupDomainInSamServerRequest < BinData::Record
|
7
|
+
attr_reader :opnum
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
sampr_handle :server_handle
|
12
|
+
rpc_unicode_string :name
|
13
|
+
|
14
|
+
def initialize_instance
|
15
|
+
super
|
16
|
+
@opnum = SAMR_LOOKUP_DOMAIN_IN_SAM_SERVER
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|