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
@@ -11,26 +11,16 @@ module RubySMB
|
|
11
11
|
endian :little
|
12
12
|
|
13
13
|
logonsrv_handle :primary_name
|
14
|
-
|
15
|
-
ndr_string :account_name
|
14
|
+
ndr_conf_var_wide_stringz :account_name
|
16
15
|
netlogon_secure_channel_type :secure_channel_type
|
17
|
-
|
18
|
-
ndr_string :computer_name
|
16
|
+
ndr_conf_var_wide_stringz :computer_name
|
19
17
|
netlogon_credential :client_credential
|
20
|
-
|
21
|
-
uint32 :flags
|
18
|
+
ndr_uint32 :flags
|
22
19
|
|
23
20
|
def initialize_instance
|
24
21
|
super
|
25
22
|
@opnum = NETR_SERVER_AUTHENTICATE3
|
26
23
|
end
|
27
|
-
|
28
|
-
# Determines the correct length for the padding, so that the next
|
29
|
-
# field is 4-byte aligned.
|
30
|
-
def pad_length(prev_element)
|
31
|
-
offset = (prev_element.abs_offset + prev_element.to_binary_s.length) % 4
|
32
|
-
(4 - offset) % 4
|
33
|
-
end
|
34
24
|
end
|
35
25
|
end
|
36
26
|
end
|
@@ -11,9 +11,9 @@ module RubySMB
|
|
11
11
|
endian :little
|
12
12
|
|
13
13
|
netlogon_credential :server_credential
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
ndr_uint32 :negotiate_flags
|
15
|
+
ndr_uint32 :account_rid
|
16
|
+
ndr_uint32 :error_status
|
17
17
|
|
18
18
|
def initialize_instance
|
19
19
|
super
|
@@ -11,26 +11,16 @@ module RubySMB
|
|
11
11
|
endian :little
|
12
12
|
|
13
13
|
logonsrv_handle :primary_name
|
14
|
-
|
15
|
-
ndr_string :account_name
|
14
|
+
ndr_conf_var_wide_stringz :account_name
|
16
15
|
netlogon_secure_channel_type :secure_channel_type
|
17
|
-
|
18
|
-
ndr_string :computer_name
|
19
|
-
string :pad3, length: -> { pad_length(self.computer_name) }
|
16
|
+
ndr_conf_var_wide_stringz :computer_name
|
20
17
|
netlogon_authenticator :authenticator
|
21
|
-
ndr_fixed_byte_array :clear_new_password,
|
18
|
+
ndr_fixed_byte_array :clear_new_password, initial_length: 516 # this is an encrypted NL_TRUST_PASSWORD
|
22
19
|
|
23
20
|
def initialize_instance
|
24
21
|
super
|
25
22
|
@opnum = Netlogon::NETR_SERVER_PASSWORD_SET2
|
26
23
|
end
|
27
|
-
|
28
|
-
# Determines the correct length for the padding, so that the next
|
29
|
-
# field is 4-byte aligned.
|
30
|
-
def pad_length(prev_element)
|
31
|
-
offset = (prev_element.abs_offset + prev_element.to_binary_s.length) % 4
|
32
|
-
(4 - offset) % 4
|
33
|
-
end
|
34
24
|
end
|
35
25
|
end
|
36
26
|
end
|
@@ -10,22 +10,14 @@ module RubySMB
|
|
10
10
|
|
11
11
|
endian :little
|
12
12
|
|
13
|
-
logonsrv_handle
|
14
|
-
|
15
|
-
|
16
|
-
netlogon_credential :client_challenge
|
13
|
+
logonsrv_handle :primary_name
|
14
|
+
ndr_conf_var_wide_stringz :computer_name
|
15
|
+
netlogon_credential :client_challenge
|
17
16
|
|
18
17
|
def initialize_instance
|
19
18
|
super
|
20
19
|
@opnum = NETR_SERVER_REQ_CHALLENGE
|
21
20
|
end
|
22
|
-
|
23
|
-
# Determines the correct length for the padding, so that the next
|
24
|
-
# field is 4-byte aligned.
|
25
|
-
def pad_length(prev_element)
|
26
|
-
offset = (prev_element.abs_offset + prev_element.to_binary_s.length) % 4
|
27
|
-
(4 - offset) % 4
|
28
|
-
end
|
29
21
|
end
|
30
22
|
end
|
31
23
|
end
|
@@ -13,19 +13,20 @@ module RubySMB
|
|
13
13
|
NETR_SERVER_PASSWORD_SET2 = 30
|
14
14
|
|
15
15
|
# see: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nrpc/3b224201-b531-43e2-8c79-b61f6dea8640
|
16
|
-
class LogonsrvHandle < Ndr::
|
16
|
+
class LogonsrvHandle < Ndr::NdrWideStringzPtr; end
|
17
17
|
|
18
18
|
# see: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nrpc/d55e2632-7163-4f6c-b662-4b870e8cc1cd
|
19
19
|
class NetlogonCredential < Ndr::NdrFixedByteArray
|
20
|
-
default_parameters
|
20
|
+
default_parameters initial_length: 8
|
21
21
|
end
|
22
22
|
|
23
23
|
# see: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nrpc/76c93227-942a-4687-ab9d-9d972ffabdab
|
24
|
-
class NetlogonAuthenticator <
|
24
|
+
class NetlogonAuthenticator < Ndr::NdrStruct
|
25
|
+
default_parameter byte_align: 4
|
25
26
|
endian :little
|
26
27
|
|
27
28
|
netlogon_credential :credential
|
28
|
-
|
29
|
+
ndr_uint32 :timestamp
|
29
30
|
end
|
30
31
|
|
31
32
|
# see: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nrpc/4d1235e3-2c96-4e9f-a147-3cb338a0d09f
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module RubySMB
|
2
2
|
module Dcerpc
|
3
|
-
class PSyntaxIdT <
|
3
|
+
class PSyntaxIdT < Ndr::NdrStruct
|
4
|
+
default_parameter byte_align: 4
|
4
5
|
endian :little
|
5
6
|
|
6
7
|
uuid :if_uuid, initial_value: -> { uuid }
|
7
|
-
|
8
|
-
|
8
|
+
ndr_uint16 :if_ver_major, initial_value: -> { ver_major }
|
9
|
+
ndr_uint16 :if_ver_minor, initial_value: -> { ver_minor }
|
9
10
|
end
|
10
11
|
end
|
11
12
|
end
|
@@ -10,14 +10,14 @@ module RubySMB
|
|
10
10
|
uint8 :ptype, label: 'PDU type'
|
11
11
|
|
12
12
|
struct :pfc_flags do
|
13
|
-
bit1 :object_uuid,
|
14
|
-
bit1 :maybe,
|
13
|
+
bit1 :object_uuid, label: 'Object UUID'
|
14
|
+
bit1 :maybe, label: 'Maybe call semantics'
|
15
15
|
bit1 :did_not_execute, label: 'Did not execute'
|
16
|
-
bit1 :conc_mpx,
|
17
|
-
bit1 :reserved_1,
|
18
|
-
bit1 :
|
19
|
-
bit1 :last_frag,
|
20
|
-
bit1 :first_frag,
|
16
|
+
bit1 :conc_mpx, label: 'Concurrent multiplexing'
|
17
|
+
bit1 :reserved_1, label: 'Reserved'
|
18
|
+
bit1 :support_header_sign, label: 'Support Header Signing'
|
19
|
+
bit1 :last_frag, label: 'Last fragment', initial_value: 1
|
20
|
+
bit1 :first_frag, label: 'First fragment', initial_value: 1
|
21
21
|
end
|
22
22
|
|
23
23
|
uint32 :packed_drep, label: 'NDR data representation format label', initial_value: 0x10
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module PrintSystem
|
4
|
+
|
5
|
+
# [3.1.4.4.8 RpcAddPrinterDriverEx (Opnum 89)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/b96cc497-59e5-4510-ab04-5484993b259b)
|
6
|
+
class RpcAddPrinterDriverExRequest < BinData::Record
|
7
|
+
attr_reader :opnum
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
ndr_wide_stringz_ptr :p_name
|
12
|
+
driver_container :p_driver_container
|
13
|
+
ndr_uint32 :dw_file_copy_flags
|
14
|
+
|
15
|
+
def initialize_instance
|
16
|
+
super
|
17
|
+
@opnum = RPC_ADD_PRINTER_DRIVER_EX
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module PrintSystem
|
4
|
+
|
5
|
+
# [3.1.4.4.8 RpcAddPrinterDriverEx (Opnum 89)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/b96cc497-59e5-4510-ab04-5484993b259b)
|
6
|
+
class RpcAddPrinterDriverExResponse < BinData::Record
|
7
|
+
attr_reader :opnum
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
def initialize_instance
|
12
|
+
super
|
13
|
+
@opnum = RPC_ADD_PRINTER_DRIVER_EX
|
14
|
+
end
|
15
|
+
|
16
|
+
ndr_uint32 :error_status
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module PrintSystem
|
4
|
+
|
5
|
+
# [3.1.4.4.2 RpcEnumPrinterDrivers (Opnum 10)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/857d00ac-3682-4a0d-86ca-3d3c372e5e4a)
|
6
|
+
class RpcEnumPrinterDriversRequest < BinData::Record
|
7
|
+
attr_reader :opnum
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
def initialize_instance
|
12
|
+
super
|
13
|
+
@opnum = RPC_ENUM_PRINTER_DRIVERS
|
14
|
+
end
|
15
|
+
|
16
|
+
ndr_wide_stringz_ptr :p_name
|
17
|
+
ndr_wide_stringz_ptr :p_environment
|
18
|
+
ndr_uint32 :level
|
19
|
+
rprn_byte_array_ptr :p_drivers
|
20
|
+
ndr_uint32 :cb_buf
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module PrintSystem
|
4
|
+
|
5
|
+
# [3.1.4.4.2 RpcEnumPrinterDrivers (Opnum 10)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/857d00ac-3682-4a0d-86ca-3d3c372e5e4a)
|
6
|
+
class RpcEnumPrinterDriversResponse < BinData::Record
|
7
|
+
attr_reader :opnum
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
def initialize_instance
|
12
|
+
super
|
13
|
+
@opnum = RPC_ENUM_PRINTER_DRIVERS
|
14
|
+
end
|
15
|
+
|
16
|
+
rprn_byte_array_ptr :p_drivers
|
17
|
+
ndr_uint32 :pcb_needed
|
18
|
+
ndr_uint32 :pc_returned
|
19
|
+
ndr_uint32 :error_status
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module PrintSystem
|
4
|
+
|
5
|
+
# [3.1.4.4.4 RpcGetPrinterDriverDirectory (Opnum 12)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/9df11cf4-4098-4852-ad72-d1f75a82bffe)
|
6
|
+
class RpcGetPrinterDriverDirectoryRequest < BinData::Record
|
7
|
+
attr_reader :opnum
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
def initialize_instance
|
12
|
+
super
|
13
|
+
@opnum = RPC_GET_PRINTER_DRIVER_DIRECTORY
|
14
|
+
end
|
15
|
+
|
16
|
+
ndr_wide_stringz_ptr :p_name
|
17
|
+
ndr_wide_stringz_ptr :p_environment
|
18
|
+
ndr_uint32 :level
|
19
|
+
rprn_byte_array_ptr :p_driver_directory
|
20
|
+
ndr_uint32 :cb_buf
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module PrintSystem
|
4
|
+
|
5
|
+
# [3.1.4.4.4 RpcGetPrinterDriverDirectory (Opnum 12)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/9df11cf4-4098-4852-ad72-d1f75a82bffe)
|
6
|
+
class RpcGetPrinterDriverDirectoryResponse < BinData::Record
|
7
|
+
attr_reader :opnum
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
def initialize_instance
|
12
|
+
super
|
13
|
+
@opnum = RPC_GET_PRINTER_DRIVER_DIRECTORY
|
14
|
+
end
|
15
|
+
|
16
|
+
rprn_byte_array_ptr :p_driver_directory
|
17
|
+
ndr_uint32 :pcb_needed
|
18
|
+
ndr_uint32 :error_status
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
module PrintSystem
|
4
|
+
|
5
|
+
# see: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/848b8334-134a-4d02-aea4-03b673d6c515
|
6
|
+
UUID = '12345678-1234-abcd-ef00-0123456789ab'.freeze
|
7
|
+
VER_MAJOR = 1
|
8
|
+
VER_MINOR = 0
|
9
|
+
|
10
|
+
# Operation numbers
|
11
|
+
RPC_ENUM_PRINTER_DRIVERS = 10
|
12
|
+
RPC_GET_PRINTER_DRIVER_DIRECTORY = 12
|
13
|
+
RPC_ADD_PRINTER_DRIVER_EX = 89
|
14
|
+
|
15
|
+
# see: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/b96cc497-59e5-4510-ab04-5484993b259b
|
16
|
+
APD_STRICT_UPGRADE = 0x00000001
|
17
|
+
APD_STRICT_DOWNGRADE = 0x00000002
|
18
|
+
APD_COPY_ALL_FILES = 0x00000004
|
19
|
+
APD_COPY_NEW_FILES = 0x00000008
|
20
|
+
APD_COPY_FROM_DIRECTORY = 0x00000010
|
21
|
+
APD_DONT_COPY_FILES_TO_CLUSTER = 0x00001000
|
22
|
+
APD_COPY_TO_ALL_SPOOLERS = 0x00002000
|
23
|
+
APD_INSTALL_WARNED_DRIVER = 0x00008000
|
24
|
+
APD_RETURN_BLOCKING_STATUS_CODE = 0x00010000
|
25
|
+
|
26
|
+
# [2.2.1.5.2 DRIVER_INFO_2](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/39bbfc30-8768-4cd4-9930-434857e2c2a2)
|
27
|
+
class DriverInfo2 < RubySMB::Dcerpc::Ndr::NdrStruct
|
28
|
+
default_parameter byte_align: 4
|
29
|
+
endian :little
|
30
|
+
|
31
|
+
ndr_uint32 :c_version
|
32
|
+
ndr_wide_stringz_ptr :p_name
|
33
|
+
ndr_wide_stringz_ptr :p_environment
|
34
|
+
ndr_wide_stringz_ptr :p_driver_path
|
35
|
+
ndr_wide_stringz_ptr :p_data_file
|
36
|
+
ndr_wide_stringz_ptr :p_config_file
|
37
|
+
end
|
38
|
+
|
39
|
+
class PDriverInfo2 < DriverInfo2
|
40
|
+
extend RubySMB::Dcerpc::Ndr::PointerClassPlugin
|
41
|
+
end
|
42
|
+
|
43
|
+
# [2.2.1.2.3 DRIVER_CONTAINER](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/3a3f9cf7-8ec4-4921-b1f6-86cf8d139bc2)
|
44
|
+
class DriverContainer < RubySMB::Dcerpc::Ndr::NdrStruct
|
45
|
+
default_parameter byte_align: 4
|
46
|
+
endian :little
|
47
|
+
|
48
|
+
ndr_uint32 :level, check_value: -> { [2].include?(value) }
|
49
|
+
ndr_uint32 :tag
|
50
|
+
choice :driver_info, selection: :level, byte_align: 4 do
|
51
|
+
p_driver_info2 2
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# for RpcEnumPrinterDrivers and RpcGetPrinterDriverDirectory `BYTE*` fields
|
56
|
+
class RprnByteArrayPtr < RubySMB::Dcerpc::Ndr::NdrConfArray
|
57
|
+
default_parameters type: :ndr_uint8
|
58
|
+
extend RubySMB::Dcerpc::Ndr::PointerClassPlugin
|
59
|
+
end
|
60
|
+
|
61
|
+
require 'ruby_smb/dcerpc/print_system/rpc_add_printer_driver_ex_request'
|
62
|
+
require 'ruby_smb/dcerpc/print_system/rpc_add_printer_driver_ex_response'
|
63
|
+
require 'ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_request'
|
64
|
+
require 'ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_response'
|
65
|
+
require 'ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_request'
|
66
|
+
require 'ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_response'
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -3,66 +3,113 @@ module RubySMB
|
|
3
3
|
# The Request PDU as defined in
|
4
4
|
# [The request PDU](http://pubs.opengroup.org/onlinepubs/9629399/chap12.htm#tagcjh_17_06_04_09)
|
5
5
|
class Request < BinData::Record
|
6
|
+
PTYPE = PTypes::REQUEST
|
7
|
+
|
6
8
|
endian :little
|
7
9
|
|
8
|
-
|
10
|
+
# PDU Header
|
11
|
+
pdu_header :pdu_header, label: 'PDU header common fields'
|
9
12
|
uint32 :alloc_hint, label: 'Allocation hint', initial_value: -> { stub.num_bytes }
|
10
13
|
uint16 :p_cont_id, label: 'Presentation context identification'
|
11
14
|
uint16 :opnum, label: 'Operation Number'
|
12
15
|
uuid :object, label: 'Object UID', onlyif: -> { pdu_header.pfc_flags.object_uuid == 1 }
|
13
16
|
|
17
|
+
# PDU Body
|
14
18
|
choice :stub, label: 'Stub', selection: -> { @obj.parent.get_parameter(:endpoint) || '' } do
|
19
|
+
string 'Encrypted'
|
15
20
|
choice 'Winreg', selection: -> { opnum } do
|
16
|
-
open_root_key_request
|
17
|
-
open_root_key_request
|
18
|
-
open_root_key_request
|
19
|
-
open_root_key_request
|
20
|
-
open_root_key_request
|
21
|
-
open_root_key_request
|
22
|
-
open_root_key_request
|
23
|
-
open_root_key_request
|
24
|
-
close_key_request
|
25
|
-
enum_key_request
|
26
|
-
enum_value_request
|
27
|
-
open_key_request
|
28
|
-
query_info_key_request
|
29
|
-
query_value_request
|
30
|
-
create_key_request
|
31
|
-
save_key_request
|
21
|
+
open_root_key_request Winreg::OPEN_HKCR, opnum: Winreg::OPEN_HKCR
|
22
|
+
open_root_key_request Winreg::OPEN_HKCU, opnum: Winreg::OPEN_HKCU
|
23
|
+
open_root_key_request Winreg::OPEN_HKLM, opnum: Winreg::OPEN_HKLM
|
24
|
+
open_root_key_request Winreg::OPEN_HKPD, opnum: Winreg::OPEN_HKPD
|
25
|
+
open_root_key_request Winreg::OPEN_HKU, opnum: Winreg::OPEN_HKU
|
26
|
+
open_root_key_request Winreg::OPEN_HKCC, opnum: Winreg::OPEN_HKCC
|
27
|
+
open_root_key_request Winreg::OPEN_HKPT, opnum: Winreg::OPEN_HKPT
|
28
|
+
open_root_key_request Winreg::OPEN_HKPN, opnum: Winreg::OPEN_HKPN
|
29
|
+
close_key_request Winreg::REG_CLOSE_KEY
|
30
|
+
enum_key_request Winreg::REG_ENUM_KEY
|
31
|
+
enum_value_request Winreg::REG_ENUM_VALUE
|
32
|
+
open_key_request Winreg::REG_OPEN_KEY
|
33
|
+
query_info_key_request Winreg::REG_QUERY_INFO_KEY
|
34
|
+
query_value_request Winreg::REG_QUERY_VALUE
|
35
|
+
create_key_request Winreg::REG_CREATE_KEY
|
36
|
+
save_key_request Winreg::REG_SAVE_KEY
|
32
37
|
string :default
|
33
38
|
end
|
34
39
|
choice 'Netlogon', selection: -> { opnum } do
|
35
|
-
netr_server_authenticate3_request
|
36
|
-
netr_server_password_set2_request
|
37
|
-
netr_server_req_challenge_request
|
40
|
+
netr_server_authenticate3_request Netlogon::NETR_SERVER_AUTHENTICATE3
|
41
|
+
netr_server_password_set2_request Netlogon::NETR_SERVER_PASSWORD_SET2
|
42
|
+
netr_server_req_challenge_request Netlogon::NETR_SERVER_REQ_CHALLENGE
|
38
43
|
string :default
|
39
44
|
end
|
40
45
|
choice 'Srvsvc', selection: -> { opnum } do
|
41
|
-
|
46
|
+
net_share_enum_all_request Srvsvc::NET_SHARE_ENUM_ALL
|
42
47
|
string :default
|
43
48
|
end
|
44
49
|
choice 'Svcctl', selection: -> { opnum } do
|
45
|
-
open_sc_manager_w_request
|
46
|
-
open_service_w_request
|
47
|
-
query_service_status_request
|
48
|
-
query_service_config_w_request
|
49
|
-
change_service_config_w_request
|
50
|
-
start_service_w_request
|
51
|
-
control_service_request
|
52
|
-
close_service_handle_request
|
50
|
+
open_sc_manager_w_request Svcctl::OPEN_SC_MANAGER_W
|
51
|
+
open_service_w_request Svcctl::OPEN_SERVICE_W
|
52
|
+
query_service_status_request Svcctl::QUERY_SERVICE_STATUS
|
53
|
+
query_service_config_w_request Svcctl::QUERY_SERVICE_CONFIG_W
|
54
|
+
change_service_config_w_request Svcctl::CHANGE_SERVICE_CONFIG_W
|
55
|
+
start_service_w_request Svcctl::START_SERVICE_W
|
56
|
+
control_service_request Svcctl::CONTROL_SERVICE
|
57
|
+
close_service_handle_request Svcctl::CLOSE_SERVICE_HANDLE
|
53
58
|
string :default
|
54
59
|
end
|
60
|
+
choice 'Samr', selection: -> { opnum } do
|
61
|
+
samr_connect_request Samr::SAMR_CONNECT
|
62
|
+
samr_lookup_domain_in_sam_server_request Samr::SAMR_LOOKUP_DOMAIN_IN_SAM_SERVER
|
63
|
+
samr_open_domain_request Samr::SAMR_OPEN_DOMAIN
|
64
|
+
samr_enumerate_users_in_domain_request Samr::SAMR_ENUMERATE_USERS_IN_DOMAIN
|
65
|
+
samr_rid_to_sid_request Samr::SAMR_RID_TO_SID
|
66
|
+
samr_close_handle_request Samr::SAMR_CLOSE_HANDLE
|
67
|
+
samr_get_alias_membership_request Samr::SAMR_GET_ALIAS_MEMBERSHIP
|
68
|
+
samr_open_user_request Samr::SAMR_OPEN_USER
|
69
|
+
samr_get_groups_for_user_request Samr::SAMR_GET_GROUPS_FOR_USER
|
70
|
+
string :default
|
71
|
+
end
|
72
|
+
choice 'Wkssvc', selection: -> { opnum } do
|
73
|
+
netr_wksta_get_info_request Wkssvc::NETR_WKSTA_GET_INFO
|
74
|
+
string :default
|
75
|
+
end
|
76
|
+
choice 'Epm', selection: -> { opnum } do
|
77
|
+
epm_ept_map_request RubySMB::Dcerpc::Epm::EPT_MAP
|
78
|
+
string :default
|
79
|
+
end
|
80
|
+
choice 'Drsr', selection: -> { opnum } do
|
81
|
+
drs_bind_request Drsr::DRS_BIND
|
82
|
+
drs_unbind_request Drsr::DRS_UNBIND
|
83
|
+
drs_domain_controller_info_request Drsr::DRS_DOMAIN_CONTROLLER_INFO
|
84
|
+
drs_crack_names_request Drsr::DRS_CRACK_NAMES
|
85
|
+
drs_get_nc_changes_request Drsr::DRS_GET_NC_CHANGES
|
86
|
+
string :default
|
87
|
+
end
|
55
88
|
string :default
|
56
89
|
end
|
90
|
+
string :auth_pad,
|
91
|
+
onlyif: -> { has_auth_verifier? },
|
92
|
+
length: -> { (16 - (stub.num_bytes % 16)) % 16 }
|
57
93
|
|
58
|
-
|
59
|
-
|
94
|
+
# Auth Verifier
|
95
|
+
sec_trailer :sec_trailer, onlyif: -> { has_auth_verifier? }
|
96
|
+
string :auth_value, label: 'Authentication verifier',
|
97
|
+
onlyif: -> { has_auth_verifier? },
|
60
98
|
read_length: -> { pdu_header.auth_length }
|
61
99
|
|
62
100
|
def initialize_instance
|
63
101
|
super
|
64
|
-
pdu_header.ptype =
|
102
|
+
pdu_header.ptype = PTYPE
|
65
103
|
end
|
104
|
+
|
105
|
+
def enable_encrypted_stub
|
106
|
+
@params[:endpoint] = 'Encrypted'
|
107
|
+
end
|
108
|
+
|
109
|
+
def has_auth_verifier?
|
110
|
+
self.pdu_header.auth_length > 0
|
111
|
+
end
|
112
|
+
|
66
113
|
end
|
67
114
|
end
|
68
115
|
end
|
@@ -3,24 +3,59 @@ module RubySMB
|
|
3
3
|
# The Response PDU as defined in
|
4
4
|
# [The response PDU](http://pubs.opengroup.org/onlinepubs/9629399/chap12.htm#tagcjh_17_06_04_10)
|
5
5
|
class Response < BinData::Record
|
6
|
-
|
6
|
+
PTYPE = PTypes::RESPONSE
|
7
7
|
|
8
|
-
|
8
|
+
endian :little
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
# PDU Header
|
11
|
+
pdu_header :pdu_header, label: 'PDU header common fields'
|
12
|
+
uint32 :alloc_hint, label: 'Allocation hint', initial_value: -> { stub.do_num_bytes }
|
13
|
+
uint16 :p_cont_id, label: 'Presentation context identification'
|
14
|
+
uint8 :cancel_count, label: 'Cancel count'
|
15
|
+
uint8 :reserved
|
14
16
|
|
15
|
-
|
17
|
+
# PDU Body
|
18
|
+
string :stub, label: 'Stub', read_length: -> { stub_length }
|
19
|
+
string :auth_pad,
|
20
|
+
onlyif: -> { has_auth_verifier? },
|
21
|
+
length: -> { (16 - (stub.num_bytes % 16)) % 16 }
|
16
22
|
|
17
|
-
|
18
|
-
|
23
|
+
# Auth Verifier
|
24
|
+
sec_trailer :sec_trailer, onlyif: -> { has_auth_verifier? }
|
25
|
+
string :auth_value, label: 'Authentication verifier',
|
26
|
+
onlyif: -> { has_auth_verifier? },
|
19
27
|
read_length: -> { pdu_header.auth_length }
|
20
28
|
|
21
29
|
def initialize_instance
|
22
30
|
super
|
23
|
-
pdu_header.ptype =
|
31
|
+
pdu_header.ptype = PTYPE
|
32
|
+
end
|
33
|
+
|
34
|
+
def has_auth_verifier?
|
35
|
+
self.pdu_header.auth_length > 0
|
36
|
+
end
|
37
|
+
|
38
|
+
def stub_length
|
39
|
+
stub_length = pdu_header.frag_length - stub.rel_offset
|
40
|
+
if has_auth_verifier?
|
41
|
+
# Note that the resulting stub length includes auth_pad. We will be
|
42
|
+
# able to separate the auth_pad from the stub once the sec_trailer
|
43
|
+
# structure is read.
|
44
|
+
stub_length -= (sec_trailer.num_bytes + pdu_header.auth_length)
|
45
|
+
end
|
46
|
+
stub_length
|
47
|
+
end
|
48
|
+
|
49
|
+
def read(io)
|
50
|
+
super
|
51
|
+
if has_auth_verifier? && sec_trailer.auth_pad_length > 0
|
52
|
+
# At this point, auth_pad is at the end of the stub. We need to move
|
53
|
+
# it to the correct field. It is now possible since we know its
|
54
|
+
# length from the sec_trailer auth_pad_length field.
|
55
|
+
pad = stub[-(sec_trailer.auth_pad_length)..-1]
|
56
|
+
stub.assign(stub[0...-(sec_trailer.auth_pad_length)])
|
57
|
+
auth_pad.assign(pad)
|
58
|
+
end
|
24
59
|
end
|
25
60
|
end
|
26
61
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Dcerpc
|
3
|
+
|
4
|
+
# [2.2.2.10 rpc_auth_3 PDU](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rpce/a6b7b03c-4ac5-4c25-8c52-f2bec872ac97)
|
5
|
+
class RpcAuth3 < BinData::Record
|
6
|
+
PTYPE = PTypes::RPC_AUTH3
|
7
|
+
|
8
|
+
endian :little
|
9
|
+
|
10
|
+
# PDU Header
|
11
|
+
pdu_header :pdu_header
|
12
|
+
uint32 :pad
|
13
|
+
|
14
|
+
# Auth Verifier
|
15
|
+
sec_trailer :sec_trailer, onlyif: -> { pdu_header.auth_length > 0 }
|
16
|
+
string :auth_value,
|
17
|
+
onlyif: -> { pdu_header.auth_length > 0 },
|
18
|
+
read_length: -> { pdu_header.auth_length }
|
19
|
+
|
20
|
+
def initialize_instance
|
21
|
+
super
|
22
|
+
pdu_header.ptype = PTYPE
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
|