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.
Files changed (279) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.github/workflows/verify.yml +1 -1
  4. data/examples/auth_capture.rb +28 -0
  5. data/examples/dump_secrets_from_sid.rb +207 -0
  6. data/examples/enum_domain_users.rb +75 -0
  7. data/examples/file_server.rb +76 -0
  8. data/examples/get_computer_info.rb +42 -0
  9. data/examples/query_service_status.rb +42 -4
  10. data/lib/ruby_smb/client.rb +3 -14
  11. data/lib/ruby_smb/create_actions.rb +21 -0
  12. data/lib/ruby_smb/dcerpc/bind.rb +28 -20
  13. data/lib/ruby_smb/dcerpc/bind_ack.rb +29 -28
  14. data/lib/ruby_smb/dcerpc/client.rb +542 -0
  15. data/lib/ruby_smb/dcerpc/drsr/drs_bind_request.rb +24 -0
  16. data/lib/ruby_smb/dcerpc/drsr/drs_bind_response.rb +26 -0
  17. data/lib/ruby_smb/dcerpc/drsr/drs_crack_names_request.rb +57 -0
  18. data/lib/ruby_smb/dcerpc/drsr/drs_crack_names_response.rb +76 -0
  19. data/lib/ruby_smb/dcerpc/drsr/drs_domain_controller_info_request.rb +46 -0
  20. data/lib/ruby_smb/dcerpc/drsr/drs_domain_controller_info_response.rb +168 -0
  21. data/lib/ruby_smb/dcerpc/drsr/drs_extensions.rb +56 -0
  22. data/lib/ruby_smb/dcerpc/drsr/drs_get_nc_changes_request.rb +121 -0
  23. data/lib/ruby_smb/dcerpc/drsr/drs_get_nc_changes_response.rb +118 -0
  24. data/lib/ruby_smb/dcerpc/drsr/drs_unbind_request.rb +24 -0
  25. data/lib/ruby_smb/dcerpc/drsr/drs_unbind_response.rb +26 -0
  26. data/lib/ruby_smb/dcerpc/drsr.rb +909 -0
  27. data/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_encrypt_file_srv_request.rb +20 -0
  28. data/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_encrypt_file_srv_response.rb +20 -0
  29. data/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_open_file_raw_request.rb +21 -0
  30. data/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_open_file_raw_response.rb +21 -0
  31. data/lib/ruby_smb/dcerpc/encrypting_file_system.rb +44 -0
  32. data/lib/ruby_smb/dcerpc/epm/epm_ept_map_request.rb +26 -0
  33. data/lib/ruby_smb/dcerpc/epm/epm_ept_map_response.rb +25 -0
  34. data/lib/ruby_smb/dcerpc/epm/epm_twrt.rb +211 -0
  35. data/lib/ruby_smb/dcerpc/epm.rb +75 -0
  36. data/lib/ruby_smb/dcerpc/error.rb +17 -0
  37. data/lib/ruby_smb/dcerpc/ndr.rb +1159 -297
  38. data/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_request.rb +3 -13
  39. data/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_response.rb +3 -3
  40. data/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_request.rb +3 -13
  41. data/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_response.rb +1 -1
  42. data/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_request.rb +3 -11
  43. data/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_response.rb +1 -1
  44. data/lib/ruby_smb/dcerpc/netlogon.rb +5 -4
  45. data/lib/ruby_smb/dcerpc/p_syntax_id_t.rb +4 -3
  46. data/lib/ruby_smb/dcerpc/pdu_header.rb +7 -7
  47. data/lib/ruby_smb/dcerpc/print_system/rpc_add_printer_driver_ex_request.rb +22 -0
  48. data/lib/ruby_smb/dcerpc/print_system/rpc_add_printer_driver_ex_response.rb +20 -0
  49. data/lib/ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_request.rb +24 -0
  50. data/lib/ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_response.rb +23 -0
  51. data/lib/ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_request.rb +24 -0
  52. data/lib/ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_response.rb +22 -0
  53. data/lib/ruby_smb/dcerpc/print_system.rb +69 -0
  54. data/lib/ruby_smb/dcerpc/ptypes.rb +1 -0
  55. data/lib/ruby_smb/dcerpc/request.rb +79 -32
  56. data/lib/ruby_smb/dcerpc/response.rb +45 -10
  57. data/lib/ruby_smb/dcerpc/rpc_auth3.rb +28 -0
  58. data/lib/ruby_smb/dcerpc/rpc_security_attributes.rb +11 -11
  59. data/lib/ruby_smb/dcerpc/rrp_rpc_unicode_string.rb +118 -0
  60. data/lib/ruby_smb/dcerpc/samr/rpc_sid.rb +150 -0
  61. data/lib/ruby_smb/dcerpc/samr/samr_close_handle_request.rb +23 -0
  62. data/lib/ruby_smb/dcerpc/samr/samr_close_handle_response.rb +24 -0
  63. data/lib/ruby_smb/dcerpc/samr/samr_connect_request.rb +32 -0
  64. data/lib/ruby_smb/dcerpc/samr/samr_connect_response.rb +23 -0
  65. data/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_request.rb +26 -0
  66. data/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_response.rb +55 -0
  67. data/lib/ruby_smb/dcerpc/samr/samr_get_alias_membership_request.rb +48 -0
  68. data/lib/ruby_smb/dcerpc/samr/samr_get_alias_membership_response.rb +38 -0
  69. data/lib/ruby_smb/dcerpc/samr/samr_get_groups_for_user_request.rb +23 -0
  70. data/lib/ruby_smb/dcerpc/samr/samr_get_groups_for_user_response.rb +48 -0
  71. data/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_request.rb +24 -0
  72. data/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_response.rb +25 -0
  73. data/lib/ruby_smb/dcerpc/samr/samr_open_domain_request.rb +27 -0
  74. data/lib/ruby_smb/dcerpc/samr/samr_open_domain_response.rb +24 -0
  75. data/lib/ruby_smb/dcerpc/samr/samr_open_user_request.rb +26 -0
  76. data/lib/ruby_smb/dcerpc/samr/samr_open_user_response.rb +24 -0
  77. data/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_request.rb +23 -0
  78. data/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_response.rb +23 -0
  79. data/lib/ruby_smb/dcerpc/samr.rb +613 -0
  80. data/lib/ruby_smb/dcerpc/sec_trailer.rb +26 -0
  81. data/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all.rb +56 -79
  82. data/lib/ruby_smb/dcerpc/srvsvc.rb +27 -4
  83. data/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_request.rb +13 -25
  84. data/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_response.rb +2 -2
  85. data/lib/ruby_smb/dcerpc/svcctl/close_service_handle_response.rb +1 -1
  86. data/lib/ruby_smb/dcerpc/svcctl/control_service_request.rb +1 -1
  87. data/lib/ruby_smb/dcerpc/svcctl/control_service_response.rb +1 -1
  88. data/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_request.rb +4 -14
  89. data/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_response.rb +1 -1
  90. data/lib/ruby_smb/dcerpc/svcctl/open_service_w_request.rb +3 -11
  91. data/lib/ruby_smb/dcerpc/svcctl/open_service_w_response.rb +1 -1
  92. data/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_request.rb +1 -1
  93. data/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_response.rb +12 -11
  94. data/lib/ruby_smb/dcerpc/svcctl/query_service_status_response.rb +1 -1
  95. data/lib/ruby_smb/dcerpc/svcctl/service_status.rb +9 -8
  96. data/lib/ruby_smb/dcerpc/svcctl/start_service_w_request.rb +3 -3
  97. data/lib/ruby_smb/dcerpc/svcctl/start_service_w_response.rb +1 -1
  98. data/lib/ruby_smb/dcerpc/svcctl.rb +1 -3
  99. data/lib/ruby_smb/dcerpc/uuid.rb +3 -0
  100. data/lib/ruby_smb/dcerpc/winreg/close_key_response.rb +2 -2
  101. data/lib/ruby_smb/dcerpc/winreg/create_key_request.rb +2 -13
  102. data/lib/ruby_smb/dcerpc/winreg/create_key_response.rb +3 -3
  103. data/lib/ruby_smb/dcerpc/winreg/enum_key_request.rb +3 -20
  104. data/lib/ruby_smb/dcerpc/winreg/enum_key_response.rb +3 -20
  105. data/lib/ruby_smb/dcerpc/winreg/enum_value_request.rb +5 -14
  106. data/lib/ruby_smb/dcerpc/winreg/enum_value_response.rb +5 -14
  107. data/lib/ruby_smb/dcerpc/winreg/open_key_request.rb +1 -9
  108. data/lib/ruby_smb/dcerpc/winreg/open_key_response.rb +4 -3
  109. data/lib/ruby_smb/dcerpc/winreg/open_root_key_request.rb +5 -6
  110. data/lib/ruby_smb/dcerpc/winreg/open_root_key_response.rb +2 -2
  111. data/lib/ruby_smb/dcerpc/winreg/query_info_key_response.rb +9 -18
  112. data/lib/ruby_smb/dcerpc/winreg/query_value_request.rb +4 -14
  113. data/lib/ruby_smb/dcerpc/winreg/query_value_response.rb +7 -15
  114. data/lib/ruby_smb/dcerpc/winreg/regsam.rb +3 -1
  115. data/lib/ruby_smb/dcerpc/winreg/save_key_request.rb +0 -9
  116. data/lib/ruby_smb/dcerpc/winreg/save_key_response.rb +1 -1
  117. data/lib/ruby_smb/dcerpc/winreg.rb +10 -14
  118. data/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_request.rb +26 -0
  119. data/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_response.rb +88 -0
  120. data/lib/ruby_smb/dcerpc/wkssvc.rb +65 -0
  121. data/lib/ruby_smb/dcerpc.rb +43 -13
  122. data/lib/ruby_smb/field/file_time.rb +1 -1
  123. data/lib/ruby_smb/field/nt_status.rb +20 -1
  124. data/lib/ruby_smb/field/string16.rb +5 -1
  125. data/lib/ruby_smb/fscc/file_information/file_ea_information.rb +14 -0
  126. data/lib/ruby_smb/fscc/file_information/file_network_open_information.rb +22 -0
  127. data/lib/ruby_smb/fscc/file_information/file_stream_information.rb +16 -0
  128. data/lib/ruby_smb/fscc/file_information.rb +29 -0
  129. data/lib/ruby_smb/fscc/file_system_information/file_fs_attribute_information.rb +46 -0
  130. data/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information.rb +19 -0
  131. data/lib/ruby_smb/fscc/file_system_information.rb +22 -0
  132. data/lib/ruby_smb/fscc.rb +1 -0
  133. data/lib/ruby_smb/generic_packet.rb +6 -0
  134. data/lib/ruby_smb/gss/provider/authenticator.rb +4 -0
  135. data/lib/ruby_smb/gss/provider/ntlm.rb +13 -3
  136. data/lib/ruby_smb/ntlm.rb +18 -2
  137. data/lib/ruby_smb/server/server_client/negotiation.rb +0 -2
  138. data/lib/ruby_smb/server/server_client/session_setup.rb +43 -32
  139. data/lib/ruby_smb/server/server_client/share_io.rb +28 -0
  140. data/lib/ruby_smb/server/server_client/tree_connect.rb +60 -0
  141. data/lib/ruby_smb/server/server_client.rb +214 -24
  142. data/lib/ruby_smb/server/session.rb +71 -0
  143. data/lib/ruby_smb/server/share/provider/disk.rb +437 -0
  144. data/lib/ruby_smb/server/share/provider/pipe.rb +27 -0
  145. data/lib/ruby_smb/server/share/provider/processor.rb +76 -0
  146. data/lib/ruby_smb/server/share/provider.rb +38 -0
  147. data/lib/ruby_smb/server/share.rb +11 -0
  148. data/lib/ruby_smb/server.rb +35 -3
  149. data/lib/ruby_smb/signing.rb +37 -11
  150. data/lib/ruby_smb/smb1/commands.rb +4 -0
  151. data/lib/ruby_smb/smb1/pipe.rb +4 -0
  152. data/lib/ruby_smb/smb1.rb +0 -1
  153. data/lib/ruby_smb/smb2/bit_field/smb2_header_flags.rb +2 -1
  154. data/lib/ruby_smb/smb2/commands.rb +4 -0
  155. data/lib/ruby_smb/smb2/create_context/request.rb +64 -0
  156. data/lib/ruby_smb/smb2/create_context/response.rb +62 -0
  157. data/lib/ruby_smb/smb2/create_context.rb +74 -22
  158. data/lib/ruby_smb/smb2/packet/create_request.rb +44 -11
  159. data/lib/ruby_smb/smb2/packet/create_response.rb +17 -3
  160. data/lib/ruby_smb/smb2/packet/query_directory_request.rb +1 -1
  161. data/lib/ruby_smb/smb2/packet/query_directory_response.rb +2 -2
  162. data/lib/ruby_smb/smb2/packet/query_info_request.rb +43 -0
  163. data/lib/ruby_smb/smb2/packet/query_info_response.rb +23 -0
  164. data/lib/ruby_smb/smb2/packet/tree_connect_response.rb +1 -1
  165. data/lib/ruby_smb/smb2/packet/tree_disconnect_response.rb +1 -0
  166. data/lib/ruby_smb/smb2/packet.rb +2 -0
  167. data/lib/ruby_smb/smb2/pipe.rb +4 -0
  168. data/lib/ruby_smb/smb2.rb +11 -0
  169. data/lib/ruby_smb/smb_error.rb +110 -0
  170. data/lib/ruby_smb/version.rb +1 -1
  171. data/lib/ruby_smb.rb +2 -0
  172. data/ruby_smb.gemspec +1 -1
  173. data/spec/lib/ruby_smb/client_spec.rb +1 -2
  174. data/spec/lib/ruby_smb/dcerpc/bind_ack_spec.rb +69 -41
  175. data/spec/lib/ruby_smb/dcerpc/bind_spec.rb +75 -21
  176. data/spec/lib/ruby_smb/dcerpc/client_spec.rb +714 -0
  177. data/spec/lib/ruby_smb/dcerpc/drsr_spec.rb +2169 -0
  178. data/spec/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_encrypt_file_srv_request_spec.rb +30 -0
  179. data/spec/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_encrypt_file_srv_response_spec.rb +30 -0
  180. data/spec/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_open_file_raw_request_spec.rb +38 -0
  181. data/spec/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_open_file_raw_response_spec.rb +38 -0
  182. data/spec/lib/ruby_smb/dcerpc/ndr_spec.rb +3792 -1373
  183. data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_request_spec.rb +4 -4
  184. data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_request_spec.rb +4 -4
  185. data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_request_spec.rb +2 -2
  186. data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_response_spec.rb +2 -2
  187. data/spec/lib/ruby_smb/dcerpc/p_syntax_id_t_spec.rb +18 -4
  188. data/spec/lib/ruby_smb/dcerpc/pdu_header_spec.rb +27 -1
  189. data/spec/lib/ruby_smb/dcerpc/print_system/driver_container_spec.rb +41 -0
  190. data/spec/lib/ruby_smb/dcerpc/print_system/driver_info2_spec.rb +64 -0
  191. data/spec/lib/ruby_smb/dcerpc/print_system/rpc_add_printer_driver_ex_request_spec.rb +59 -0
  192. data/spec/lib/ruby_smb/dcerpc/print_system/rpc_add_printer_driver_ex_response_spec.rb +30 -0
  193. data/spec/lib/ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_request_spec.rb +62 -0
  194. data/spec/lib/ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_response_spec.rb +54 -0
  195. data/spec/lib/ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_request_spec.rb +62 -0
  196. data/spec/lib/ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_response_spec.rb +46 -0
  197. data/spec/lib/ruby_smb/dcerpc/request_spec.rb +76 -11
  198. data/spec/lib/ruby_smb/dcerpc/response_spec.rb +99 -9
  199. data/spec/lib/ruby_smb/dcerpc/rpc_auth3_spec.rb +75 -0
  200. data/spec/lib/ruby_smb/dcerpc/rpc_security_attributes_spec.rb +29 -28
  201. data/spec/lib/ruby_smb/dcerpc/rrp_rpc_unicode_string_spec.rb +340 -0
  202. data/spec/lib/ruby_smb/dcerpc/samr/rpc_sid_spec.rb +116 -0
  203. data/spec/lib/ruby_smb/dcerpc/samr/samr_close_handle_request_spec.rb +40 -0
  204. data/spec/lib/ruby_smb/dcerpc/samr/samr_close_handle_response_spec.rb +48 -0
  205. data/spec/lib/ruby_smb/dcerpc/samr/samr_connect_request_spec.rb +56 -0
  206. data/spec/lib/ruby_smb/dcerpc/samr/samr_connect_response_spec.rb +47 -0
  207. data/spec/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_request_spec.rb +63 -0
  208. data/spec/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_response_spec.rb +265 -0
  209. data/spec/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_request_spec.rb +52 -0
  210. data/spec/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_response_spec.rb +36 -0
  211. data/spec/lib/ruby_smb/dcerpc/samr/samr_open_domain_request_spec.rb +56 -0
  212. data/spec/lib/ruby_smb/dcerpc/samr/samr_open_domain_response_spec.rb +48 -0
  213. data/spec/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_request_spec.rb +48 -0
  214. data/spec/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_response_spec.rb +42 -0
  215. data/spec/lib/ruby_smb/dcerpc/samr_spec.rb +420 -0
  216. data/spec/lib/ruby_smb/dcerpc/sec_trailer_spec.rb +92 -0
  217. data/spec/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all_spec.rb +149 -110
  218. data/spec/lib/ruby_smb/dcerpc/srvsvc_spec.rb +21 -17
  219. data/spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_request_spec.rb +56 -79
  220. data/spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_response_spec.rb +4 -4
  221. data/spec/lib/ruby_smb/dcerpc/svcctl/close_service_handle_response_spec.rb +2 -2
  222. data/spec/lib/ruby_smb/dcerpc/svcctl/control_service_request_spec.rb +2 -2
  223. data/spec/lib/ruby_smb/dcerpc/svcctl/control_service_response_spec.rb +2 -2
  224. data/spec/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_request_spec.rb +19 -29
  225. data/spec/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_response_spec.rb +2 -2
  226. data/spec/lib/ruby_smb/dcerpc/svcctl/open_service_w_request_spec.rb +9 -15
  227. data/spec/lib/ruby_smb/dcerpc/svcctl/open_service_w_response_spec.rb +2 -2
  228. data/spec/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_request_spec.rb +2 -2
  229. data/spec/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_response_spec.rb +22 -22
  230. data/spec/lib/ruby_smb/dcerpc/svcctl/query_service_status_response_spec.rb +2 -2
  231. data/spec/lib/ruby_smb/dcerpc/svcctl/service_status_spec.rb +18 -14
  232. data/spec/lib/ruby_smb/dcerpc/svcctl/start_service_w_request_spec.rb +5 -4
  233. data/spec/lib/ruby_smb/dcerpc/svcctl/start_service_w_response_spec.rb +2 -2
  234. data/spec/lib/ruby_smb/dcerpc/svcctl_spec.rb +1 -5
  235. data/spec/lib/ruby_smb/dcerpc/uuid_spec.rb +15 -23
  236. data/spec/lib/ruby_smb/dcerpc/winreg/close_key_response_spec.rb +2 -2
  237. data/spec/lib/ruby_smb/dcerpc/winreg/create_key_request_spec.rb +4 -41
  238. data/spec/lib/ruby_smb/dcerpc/winreg/create_key_response_spec.rb +4 -4
  239. data/spec/lib/ruby_smb/dcerpc/winreg/enum_key_request_spec.rb +4 -52
  240. data/spec/lib/ruby_smb/dcerpc/winreg/enum_key_response_spec.rb +4 -56
  241. data/spec/lib/ruby_smb/dcerpc/winreg/enum_value_request_spec.rb +10 -34
  242. data/spec/lib/ruby_smb/dcerpc/winreg/enum_value_response_spec.rb +10 -34
  243. data/spec/lib/ruby_smb/dcerpc/winreg/open_key_request_spec.rb +2 -26
  244. data/spec/lib/ruby_smb/dcerpc/winreg/open_key_response_spec.rb +2 -2
  245. data/spec/lib/ruby_smb/dcerpc/winreg/open_root_key_request_spec.rb +17 -25
  246. data/spec/lib/ruby_smb/dcerpc/winreg/open_root_key_response_spec.rb +2 -2
  247. data/spec/lib/ruby_smb/dcerpc/winreg/query_info_key_response_spec.rb +20 -44
  248. data/spec/lib/ruby_smb/dcerpc/winreg/query_value_request_spec.rb +8 -32
  249. data/spec/lib/ruby_smb/dcerpc/winreg/query_value_response_spec.rb +10 -22
  250. data/spec/lib/ruby_smb/dcerpc/winreg/regsam_spec.rb +4 -0
  251. data/spec/lib/ruby_smb/dcerpc/winreg/save_key_request_spec.rb +0 -12
  252. data/spec/lib/ruby_smb/dcerpc/winreg/save_key_response_spec.rb +2 -2
  253. data/spec/lib/ruby_smb/dcerpc/winreg_spec.rb +18 -47
  254. data/spec/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_request_spec.rb +43 -0
  255. data/spec/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_response_spec.rb +410 -0
  256. data/spec/lib/ruby_smb/dcerpc/wkssvc_spec.rb +70 -0
  257. data/spec/lib/ruby_smb/field/nt_status_spec.rb +6 -2
  258. data/spec/lib/ruby_smb/field/string16_spec.rb +22 -0
  259. data/spec/lib/ruby_smb/gss/provider/ntlm/authenticator_spec.rb +4 -0
  260. data/spec/lib/ruby_smb/gss/provider/ntlm/os_version_spec.rb +1 -1
  261. data/spec/lib/ruby_smb/server/server_client_spec.rb +36 -53
  262. data/spec/lib/ruby_smb/server/session_spec.rb +38 -0
  263. data/spec/lib/ruby_smb/server/share/provider/disk_spec.rb +61 -0
  264. data/spec/lib/ruby_smb/server/share/provider/pipe_spec.rb +31 -0
  265. data/spec/lib/ruby_smb/server/share/provider_spec.rb +13 -0
  266. data/spec/lib/ruby_smb/smb1/pipe_spec.rb +18 -37
  267. data/spec/lib/ruby_smb/smb2/bit_field/header_flags_spec.rb +8 -2
  268. data/spec/lib/ruby_smb/smb2/{create_context_spec.rb → create_context/create_context_request_spec.rb} +1 -1
  269. data/spec/lib/ruby_smb/smb2/packet/create_request_spec.rb +5 -5
  270. data/spec/lib/ruby_smb/smb2/packet/create_response_spec.rb +9 -5
  271. data/spec/lib/ruby_smb/smb2/packet/query_directory_response_spec.rb +3 -2
  272. data/spec/lib/ruby_smb/smb2/pipe_spec.rb +18 -16
  273. data/spec/support/bin_helper.rb +9 -0
  274. data.tar.gz.sig +0 -0
  275. metadata +165 -10
  276. metadata.gz.sig +0 -0
  277. data/lib/ruby_smb/dcerpc/rrp_unicode_string.rb +0 -38
  278. data/lib/ruby_smb/smb1/create_actions.rb +0 -20
  279. data/spec/lib/ruby_smb/dcerpc/rrp_unicode_string_spec.rb +0 -135
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_smb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.12
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
@@ -97,7 +97,7 @@ cert_chain:
97
97
  EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
98
98
  9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
99
99
  -----END CERTIFICATE-----
100
- date: 2021-12-01 00:00:00.000000000 Z
100
+ date: 2022-02-04 00:00:00.000000000 Z
101
101
  dependencies:
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: redcarpet
@@ -189,14 +189,14 @@ dependencies:
189
189
  requirements:
190
190
  - - ">="
191
191
  - !ruby/object:Gem::Version
192
- version: '0'
192
+ version: 0.1.3
193
193
  type: :runtime
194
194
  prerelease: false
195
195
  version_requirements: !ruby/object:Gem::Requirement
196
196
  requirements:
197
197
  - - ">="
198
198
  - !ruby/object:Gem::Version
199
- version: '0'
199
+ version: 0.1.3
200
200
  - !ruby/object:Gem::Dependency
201
201
  name: bindata
202
202
  requirement: !ruby/object:Gem::Requirement
@@ -261,8 +261,12 @@ files:
261
261
  - examples/auth_capture.rb
262
262
  - examples/authenticate.rb
263
263
  - examples/delete_file.rb
264
+ - examples/dump_secrets_from_sid.rb
265
+ - examples/enum_domain_users.rb
264
266
  - examples/enum_registry_key.rb
265
267
  - examples/enum_registry_values.rb
268
+ - examples/file_server.rb
269
+ - examples/get_computer_info.rb
266
270
  - examples/list_directory.rb
267
271
  - examples/negotiate.rb
268
272
  - examples/negotiate_with_netbios_service.rb
@@ -286,10 +290,33 @@ files:
286
290
  - lib/ruby_smb/client/winreg.rb
287
291
  - lib/ruby_smb/compression.rb
288
292
  - lib/ruby_smb/compression/lznt1.rb
293
+ - lib/ruby_smb/create_actions.rb
289
294
  - lib/ruby_smb/crypto.rb
290
295
  - lib/ruby_smb/dcerpc.rb
291
296
  - lib/ruby_smb/dcerpc/bind.rb
292
297
  - lib/ruby_smb/dcerpc/bind_ack.rb
298
+ - lib/ruby_smb/dcerpc/client.rb
299
+ - lib/ruby_smb/dcerpc/drsr.rb
300
+ - lib/ruby_smb/dcerpc/drsr/drs_bind_request.rb
301
+ - lib/ruby_smb/dcerpc/drsr/drs_bind_response.rb
302
+ - lib/ruby_smb/dcerpc/drsr/drs_crack_names_request.rb
303
+ - lib/ruby_smb/dcerpc/drsr/drs_crack_names_response.rb
304
+ - lib/ruby_smb/dcerpc/drsr/drs_domain_controller_info_request.rb
305
+ - lib/ruby_smb/dcerpc/drsr/drs_domain_controller_info_response.rb
306
+ - lib/ruby_smb/dcerpc/drsr/drs_extensions.rb
307
+ - lib/ruby_smb/dcerpc/drsr/drs_get_nc_changes_request.rb
308
+ - lib/ruby_smb/dcerpc/drsr/drs_get_nc_changes_response.rb
309
+ - lib/ruby_smb/dcerpc/drsr/drs_unbind_request.rb
310
+ - lib/ruby_smb/dcerpc/drsr/drs_unbind_response.rb
311
+ - lib/ruby_smb/dcerpc/encrypting_file_system.rb
312
+ - lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_encrypt_file_srv_request.rb
313
+ - lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_encrypt_file_srv_response.rb
314
+ - lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_open_file_raw_request.rb
315
+ - lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_open_file_raw_response.rb
316
+ - lib/ruby_smb/dcerpc/epm.rb
317
+ - lib/ruby_smb/dcerpc/epm/epm_ept_map_request.rb
318
+ - lib/ruby_smb/dcerpc/epm/epm_ept_map_response.rb
319
+ - lib/ruby_smb/dcerpc/epm/epm_twrt.rb
293
320
  - lib/ruby_smb/dcerpc/error.rb
294
321
  - lib/ruby_smb/dcerpc/ndr.rb
295
322
  - lib/ruby_smb/dcerpc/netlogon.rb
@@ -301,11 +328,40 @@ files:
301
328
  - lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_response.rb
302
329
  - lib/ruby_smb/dcerpc/p_syntax_id_t.rb
303
330
  - lib/ruby_smb/dcerpc/pdu_header.rb
331
+ - lib/ruby_smb/dcerpc/print_system.rb
332
+ - lib/ruby_smb/dcerpc/print_system/rpc_add_printer_driver_ex_request.rb
333
+ - lib/ruby_smb/dcerpc/print_system/rpc_add_printer_driver_ex_response.rb
334
+ - lib/ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_request.rb
335
+ - lib/ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_response.rb
336
+ - lib/ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_request.rb
337
+ - lib/ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_response.rb
304
338
  - lib/ruby_smb/dcerpc/ptypes.rb
305
339
  - lib/ruby_smb/dcerpc/request.rb
306
340
  - lib/ruby_smb/dcerpc/response.rb
341
+ - lib/ruby_smb/dcerpc/rpc_auth3.rb
307
342
  - lib/ruby_smb/dcerpc/rpc_security_attributes.rb
308
- - lib/ruby_smb/dcerpc/rrp_unicode_string.rb
343
+ - lib/ruby_smb/dcerpc/rrp_rpc_unicode_string.rb
344
+ - lib/ruby_smb/dcerpc/samr.rb
345
+ - lib/ruby_smb/dcerpc/samr/rpc_sid.rb
346
+ - lib/ruby_smb/dcerpc/samr/samr_close_handle_request.rb
347
+ - lib/ruby_smb/dcerpc/samr/samr_close_handle_response.rb
348
+ - lib/ruby_smb/dcerpc/samr/samr_connect_request.rb
349
+ - lib/ruby_smb/dcerpc/samr/samr_connect_response.rb
350
+ - lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_request.rb
351
+ - lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_response.rb
352
+ - lib/ruby_smb/dcerpc/samr/samr_get_alias_membership_request.rb
353
+ - lib/ruby_smb/dcerpc/samr/samr_get_alias_membership_response.rb
354
+ - lib/ruby_smb/dcerpc/samr/samr_get_groups_for_user_request.rb
355
+ - lib/ruby_smb/dcerpc/samr/samr_get_groups_for_user_response.rb
356
+ - lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_request.rb
357
+ - lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_response.rb
358
+ - lib/ruby_smb/dcerpc/samr/samr_open_domain_request.rb
359
+ - lib/ruby_smb/dcerpc/samr/samr_open_domain_response.rb
360
+ - lib/ruby_smb/dcerpc/samr/samr_open_user_request.rb
361
+ - lib/ruby_smb/dcerpc/samr/samr_open_user_response.rb
362
+ - lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_request.rb
363
+ - lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_response.rb
364
+ - lib/ruby_smb/dcerpc/sec_trailer.rb
309
365
  - lib/ruby_smb/dcerpc/srvsvc.rb
310
366
  - lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all.rb
311
367
  - lib/ruby_smb/dcerpc/svcctl.rb
@@ -347,6 +403,9 @@ files:
347
403
  - lib/ruby_smb/dcerpc/winreg/regsam.rb
348
404
  - lib/ruby_smb/dcerpc/winreg/save_key_request.rb
349
405
  - lib/ruby_smb/dcerpc/winreg/save_key_response.rb
406
+ - lib/ruby_smb/dcerpc/wkssvc.rb
407
+ - lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_request.rb
408
+ - lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_response.rb
350
409
  - lib/ruby_smb/dialect.rb
351
410
  - lib/ruby_smb/dispatcher.rb
352
411
  - lib/ruby_smb/dispatcher/base.rb
@@ -375,11 +434,17 @@ files:
375
434
  - lib/ruby_smb/fscc/file_information/file_both_directory_information.rb
376
435
  - lib/ruby_smb/fscc/file_information/file_directory_information.rb
377
436
  - lib/ruby_smb/fscc/file_information/file_disposition_information.rb
437
+ - lib/ruby_smb/fscc/file_information/file_ea_information.rb
378
438
  - lib/ruby_smb/fscc/file_information/file_full_directory_information.rb
379
439
  - lib/ruby_smb/fscc/file_information/file_id_both_directory_information.rb
380
440
  - lib/ruby_smb/fscc/file_information/file_id_full_directory_information.rb
381
441
  - lib/ruby_smb/fscc/file_information/file_names_information.rb
442
+ - lib/ruby_smb/fscc/file_information/file_network_open_information.rb
382
443
  - lib/ruby_smb/fscc/file_information/file_rename_information.rb
444
+ - lib/ruby_smb/fscc/file_information/file_stream_information.rb
445
+ - lib/ruby_smb/fscc/file_system_information.rb
446
+ - lib/ruby_smb/fscc/file_system_information/file_fs_attribute_information.rb
447
+ - lib/ruby_smb/fscc/file_system_information/file_fs_volume_information.rb
383
448
  - lib/ruby_smb/generic_packet.rb
384
449
  - lib/ruby_smb/gss.rb
385
450
  - lib/ruby_smb/gss/provider.rb
@@ -396,6 +461,14 @@ files:
396
461
  - lib/ruby_smb/server/server_client.rb
397
462
  - lib/ruby_smb/server/server_client/negotiation.rb
398
463
  - lib/ruby_smb/server/server_client/session_setup.rb
464
+ - lib/ruby_smb/server/server_client/share_io.rb
465
+ - lib/ruby_smb/server/server_client/tree_connect.rb
466
+ - lib/ruby_smb/server/session.rb
467
+ - lib/ruby_smb/server/share.rb
468
+ - lib/ruby_smb/server/share/provider.rb
469
+ - lib/ruby_smb/server/share/provider/disk.rb
470
+ - lib/ruby_smb/server/share/provider/pipe.rb
471
+ - lib/ruby_smb/server/share/provider/processor.rb
399
472
  - lib/ruby_smb/signing.rb
400
473
  - lib/ruby_smb/smb1.rb
401
474
  - lib/ruby_smb/smb1/andx_block.rb
@@ -420,7 +493,6 @@ files:
420
493
  - lib/ruby_smb/smb1/bit_field/trans_flags.rb
421
494
  - lib/ruby_smb/smb1/bit_field/tree_connect_flags.rb
422
495
  - lib/ruby_smb/smb1/commands.rb
423
- - lib/ruby_smb/smb1/create_actions.rb
424
496
  - lib/ruby_smb/smb1/data_block.rb
425
497
  - lib/ruby_smb/smb1/dialect.rb
426
498
  - lib/ruby_smb/smb1/file.rb
@@ -499,6 +571,8 @@ files:
499
571
  - lib/ruby_smb/smb2/bit_field/smb2_security_mode_single.rb
500
572
  - lib/ruby_smb/smb2/commands.rb
501
573
  - lib/ruby_smb/smb2/create_context.rb
574
+ - lib/ruby_smb/smb2/create_context/request.rb
575
+ - lib/ruby_smb/smb2/create_context/response.rb
502
576
  - lib/ruby_smb/smb2/file.rb
503
577
  - lib/ruby_smb/smb2/info_type.rb
504
578
  - lib/ruby_smb/smb2/negotiate_context.rb
@@ -519,6 +593,8 @@ files:
519
593
  - lib/ruby_smb/smb2/packet/negotiate_response.rb
520
594
  - lib/ruby_smb/smb2/packet/query_directory_request.rb
521
595
  - lib/ruby_smb/smb2/packet/query_directory_response.rb
596
+ - lib/ruby_smb/smb2/packet/query_info_request.rb
597
+ - lib/ruby_smb/smb2/packet/query_info_response.rb
522
598
  - lib/ruby_smb/smb2/packet/read_request.rb
523
599
  - lib/ruby_smb/smb2/packet/read_response.rb
524
600
  - lib/ruby_smb/smb2/packet/session_setup_request.rb
@@ -535,6 +611,7 @@ files:
535
611
  - lib/ruby_smb/smb2/pipe.rb
536
612
  - lib/ruby_smb/smb2/smb2_header.rb
537
613
  - lib/ruby_smb/smb2/tree.rb
614
+ - lib/ruby_smb/smb_error.rb
538
615
  - lib/ruby_smb/version.rb
539
616
  - ruby_smb.gemspec
540
617
  - spec/lib/ruby_smb/client_spec.rb
@@ -542,6 +619,12 @@ files:
542
619
  - spec/lib/ruby_smb/crypto_spec.rb
543
620
  - spec/lib/ruby_smb/dcerpc/bind_ack_spec.rb
544
621
  - spec/lib/ruby_smb/dcerpc/bind_spec.rb
622
+ - spec/lib/ruby_smb/dcerpc/client_spec.rb
623
+ - spec/lib/ruby_smb/dcerpc/drsr_spec.rb
624
+ - spec/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_encrypt_file_srv_request_spec.rb
625
+ - spec/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_encrypt_file_srv_response_spec.rb
626
+ - spec/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_open_file_raw_request_spec.rb
627
+ - spec/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_open_file_raw_response_spec.rb
545
628
  - spec/lib/ruby_smb/dcerpc/ndr_spec.rb
546
629
  - spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_request_spec.rb
547
630
  - spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_response_spec.rb
@@ -551,10 +634,34 @@ files:
551
634
  - spec/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_response_spec.rb
552
635
  - spec/lib/ruby_smb/dcerpc/p_syntax_id_t_spec.rb
553
636
  - spec/lib/ruby_smb/dcerpc/pdu_header_spec.rb
637
+ - spec/lib/ruby_smb/dcerpc/print_system/driver_container_spec.rb
638
+ - spec/lib/ruby_smb/dcerpc/print_system/driver_info2_spec.rb
639
+ - spec/lib/ruby_smb/dcerpc/print_system/rpc_add_printer_driver_ex_request_spec.rb
640
+ - spec/lib/ruby_smb/dcerpc/print_system/rpc_add_printer_driver_ex_response_spec.rb
641
+ - spec/lib/ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_request_spec.rb
642
+ - spec/lib/ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_response_spec.rb
643
+ - spec/lib/ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_request_spec.rb
644
+ - spec/lib/ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_response_spec.rb
554
645
  - spec/lib/ruby_smb/dcerpc/request_spec.rb
555
646
  - spec/lib/ruby_smb/dcerpc/response_spec.rb
647
+ - spec/lib/ruby_smb/dcerpc/rpc_auth3_spec.rb
556
648
  - spec/lib/ruby_smb/dcerpc/rpc_security_attributes_spec.rb
557
- - spec/lib/ruby_smb/dcerpc/rrp_unicode_string_spec.rb
649
+ - spec/lib/ruby_smb/dcerpc/rrp_rpc_unicode_string_spec.rb
650
+ - spec/lib/ruby_smb/dcerpc/samr/rpc_sid_spec.rb
651
+ - spec/lib/ruby_smb/dcerpc/samr/samr_close_handle_request_spec.rb
652
+ - spec/lib/ruby_smb/dcerpc/samr/samr_close_handle_response_spec.rb
653
+ - spec/lib/ruby_smb/dcerpc/samr/samr_connect_request_spec.rb
654
+ - spec/lib/ruby_smb/dcerpc/samr/samr_connect_response_spec.rb
655
+ - spec/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_request_spec.rb
656
+ - spec/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_response_spec.rb
657
+ - spec/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_request_spec.rb
658
+ - spec/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_response_spec.rb
659
+ - spec/lib/ruby_smb/dcerpc/samr/samr_open_domain_request_spec.rb
660
+ - spec/lib/ruby_smb/dcerpc/samr/samr_open_domain_response_spec.rb
661
+ - spec/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_request_spec.rb
662
+ - spec/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_response_spec.rb
663
+ - spec/lib/ruby_smb/dcerpc/samr_spec.rb
664
+ - spec/lib/ruby_smb/dcerpc/sec_trailer_spec.rb
558
665
  - spec/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all_spec.rb
559
666
  - spec/lib/ruby_smb/dcerpc/srvsvc_spec.rb
560
667
  - spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_request_spec.rb
@@ -596,6 +703,9 @@ files:
596
703
  - spec/lib/ruby_smb/dcerpc/winreg/save_key_request_spec.rb
597
704
  - spec/lib/ruby_smb/dcerpc/winreg/save_key_response_spec.rb
598
705
  - spec/lib/ruby_smb/dcerpc/winreg_spec.rb
706
+ - spec/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_request_spec.rb
707
+ - spec/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_response_spec.rb
708
+ - spec/lib/ruby_smb/dcerpc/wkssvc_spec.rb
599
709
  - spec/lib/ruby_smb/dcerpc_spec.rb
600
710
  - spec/lib/ruby_smb/dispatcher/base_spec.rb
601
711
  - spec/lib/ruby_smb/dispatcher/socket_spec.rb
@@ -609,6 +719,7 @@ files:
609
719
  - spec/lib/ruby_smb/field/smb_fea_spec.rb
610
720
  - spec/lib/ruby_smb/field/smb_gea_list_spec.rb
611
721
  - spec/lib/ruby_smb/field/smb_gea_spec.rb
722
+ - spec/lib/ruby_smb/field/string16_spec.rb
612
723
  - spec/lib/ruby_smb/field/stringz16_spec.rb
613
724
  - spec/lib/ruby_smb/field/utime_spec.rb
614
725
  - spec/lib/ruby_smb/fscc/ea_info_array_spec.rb
@@ -632,6 +743,10 @@ files:
632
743
  - spec/lib/ruby_smb/nbss/session_header_spec.rb
633
744
  - spec/lib/ruby_smb/nbss/session_request_spec.rb
634
745
  - spec/lib/ruby_smb/server/server_client_spec.rb
746
+ - spec/lib/ruby_smb/server/session_spec.rb
747
+ - spec/lib/ruby_smb/server/share/provider/disk_spec.rb
748
+ - spec/lib/ruby_smb/server/share/provider/pipe_spec.rb
749
+ - spec/lib/ruby_smb/server/share/provider_spec.rb
635
750
  - spec/lib/ruby_smb/server_spec.rb
636
751
  - spec/lib/ruby_smb/smb1/andx_block_spec.rb
637
752
  - spec/lib/ruby_smb/smb1/bit_field/capabilities_spec.rb
@@ -715,7 +830,7 @@ files:
715
830
  - spec/lib/ruby_smb/smb2/bit_field/share_flags_spec.rb
716
831
  - spec/lib/ruby_smb/smb2/bit_field/smb2_capabilities_spec.rb
717
832
  - spec/lib/ruby_smb/smb2/bit_field/smb_secruity_mode_spec.rb
718
- - spec/lib/ruby_smb/smb2/create_context_spec.rb
833
+ - spec/lib/ruby_smb/smb2/create_context/create_context_request_spec.rb
719
834
  - spec/lib/ruby_smb/smb2/file_spec.rb
720
835
  - spec/lib/ruby_smb/smb2/negotiate_context_spec.rb
721
836
  - spec/lib/ruby_smb/smb2/packet/close_request_spec.rb
@@ -751,6 +866,7 @@ files:
751
866
  - spec/lib/ruby_smb/smb2/tree_spec.rb
752
867
  - spec/lib/ruby_smb_spec.rb
753
868
  - spec/spec_helper.rb
869
+ - spec/support/bin_helper.rb
754
870
  - spec/support/mock_socket_dispatcher.rb
755
871
  - spec/support/shared/examples/bit_field_single_flag.rb
756
872
  homepage: https://github.com/rapid7/ruby_smb
@@ -783,6 +899,12 @@ test_files:
783
899
  - spec/lib/ruby_smb/crypto_spec.rb
784
900
  - spec/lib/ruby_smb/dcerpc/bind_ack_spec.rb
785
901
  - spec/lib/ruby_smb/dcerpc/bind_spec.rb
902
+ - spec/lib/ruby_smb/dcerpc/client_spec.rb
903
+ - spec/lib/ruby_smb/dcerpc/drsr_spec.rb
904
+ - spec/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_encrypt_file_srv_request_spec.rb
905
+ - spec/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_encrypt_file_srv_response_spec.rb
906
+ - spec/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_open_file_raw_request_spec.rb
907
+ - spec/lib/ruby_smb/dcerpc/encrypting_file_system/efs_rpc_open_file_raw_response_spec.rb
786
908
  - spec/lib/ruby_smb/dcerpc/ndr_spec.rb
787
909
  - spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_request_spec.rb
788
910
  - spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_response_spec.rb
@@ -792,10 +914,34 @@ test_files:
792
914
  - spec/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_response_spec.rb
793
915
  - spec/lib/ruby_smb/dcerpc/p_syntax_id_t_spec.rb
794
916
  - spec/lib/ruby_smb/dcerpc/pdu_header_spec.rb
917
+ - spec/lib/ruby_smb/dcerpc/print_system/driver_container_spec.rb
918
+ - spec/lib/ruby_smb/dcerpc/print_system/driver_info2_spec.rb
919
+ - spec/lib/ruby_smb/dcerpc/print_system/rpc_add_printer_driver_ex_request_spec.rb
920
+ - spec/lib/ruby_smb/dcerpc/print_system/rpc_add_printer_driver_ex_response_spec.rb
921
+ - spec/lib/ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_request_spec.rb
922
+ - spec/lib/ruby_smb/dcerpc/print_system/rpc_enum_printer_drivers_response_spec.rb
923
+ - spec/lib/ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_request_spec.rb
924
+ - spec/lib/ruby_smb/dcerpc/print_system/rpc_get_printer_driver_directory_response_spec.rb
795
925
  - spec/lib/ruby_smb/dcerpc/request_spec.rb
796
926
  - spec/lib/ruby_smb/dcerpc/response_spec.rb
927
+ - spec/lib/ruby_smb/dcerpc/rpc_auth3_spec.rb
797
928
  - spec/lib/ruby_smb/dcerpc/rpc_security_attributes_spec.rb
798
- - spec/lib/ruby_smb/dcerpc/rrp_unicode_string_spec.rb
929
+ - spec/lib/ruby_smb/dcerpc/rrp_rpc_unicode_string_spec.rb
930
+ - spec/lib/ruby_smb/dcerpc/samr/rpc_sid_spec.rb
931
+ - spec/lib/ruby_smb/dcerpc/samr/samr_close_handle_request_spec.rb
932
+ - spec/lib/ruby_smb/dcerpc/samr/samr_close_handle_response_spec.rb
933
+ - spec/lib/ruby_smb/dcerpc/samr/samr_connect_request_spec.rb
934
+ - spec/lib/ruby_smb/dcerpc/samr/samr_connect_response_spec.rb
935
+ - spec/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_request_spec.rb
936
+ - spec/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_response_spec.rb
937
+ - spec/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_request_spec.rb
938
+ - spec/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_response_spec.rb
939
+ - spec/lib/ruby_smb/dcerpc/samr/samr_open_domain_request_spec.rb
940
+ - spec/lib/ruby_smb/dcerpc/samr/samr_open_domain_response_spec.rb
941
+ - spec/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_request_spec.rb
942
+ - spec/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_response_spec.rb
943
+ - spec/lib/ruby_smb/dcerpc/samr_spec.rb
944
+ - spec/lib/ruby_smb/dcerpc/sec_trailer_spec.rb
799
945
  - spec/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all_spec.rb
800
946
  - spec/lib/ruby_smb/dcerpc/srvsvc_spec.rb
801
947
  - spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_request_spec.rb
@@ -837,6 +983,9 @@ test_files:
837
983
  - spec/lib/ruby_smb/dcerpc/winreg/save_key_request_spec.rb
838
984
  - spec/lib/ruby_smb/dcerpc/winreg/save_key_response_spec.rb
839
985
  - spec/lib/ruby_smb/dcerpc/winreg_spec.rb
986
+ - spec/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_request_spec.rb
987
+ - spec/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_response_spec.rb
988
+ - spec/lib/ruby_smb/dcerpc/wkssvc_spec.rb
840
989
  - spec/lib/ruby_smb/dcerpc_spec.rb
841
990
  - spec/lib/ruby_smb/dispatcher/base_spec.rb
842
991
  - spec/lib/ruby_smb/dispatcher/socket_spec.rb
@@ -850,6 +999,7 @@ test_files:
850
999
  - spec/lib/ruby_smb/field/smb_fea_spec.rb
851
1000
  - spec/lib/ruby_smb/field/smb_gea_list_spec.rb
852
1001
  - spec/lib/ruby_smb/field/smb_gea_spec.rb
1002
+ - spec/lib/ruby_smb/field/string16_spec.rb
853
1003
  - spec/lib/ruby_smb/field/stringz16_spec.rb
854
1004
  - spec/lib/ruby_smb/field/utime_spec.rb
855
1005
  - spec/lib/ruby_smb/fscc/ea_info_array_spec.rb
@@ -873,6 +1023,10 @@ test_files:
873
1023
  - spec/lib/ruby_smb/nbss/session_header_spec.rb
874
1024
  - spec/lib/ruby_smb/nbss/session_request_spec.rb
875
1025
  - spec/lib/ruby_smb/server/server_client_spec.rb
1026
+ - spec/lib/ruby_smb/server/session_spec.rb
1027
+ - spec/lib/ruby_smb/server/share/provider/disk_spec.rb
1028
+ - spec/lib/ruby_smb/server/share/provider/pipe_spec.rb
1029
+ - spec/lib/ruby_smb/server/share/provider_spec.rb
876
1030
  - spec/lib/ruby_smb/server_spec.rb
877
1031
  - spec/lib/ruby_smb/smb1/andx_block_spec.rb
878
1032
  - spec/lib/ruby_smb/smb1/bit_field/capabilities_spec.rb
@@ -956,7 +1110,7 @@ test_files:
956
1110
  - spec/lib/ruby_smb/smb2/bit_field/share_flags_spec.rb
957
1111
  - spec/lib/ruby_smb/smb2/bit_field/smb2_capabilities_spec.rb
958
1112
  - spec/lib/ruby_smb/smb2/bit_field/smb_secruity_mode_spec.rb
959
- - spec/lib/ruby_smb/smb2/create_context_spec.rb
1113
+ - spec/lib/ruby_smb/smb2/create_context/create_context_request_spec.rb
960
1114
  - spec/lib/ruby_smb/smb2/file_spec.rb
961
1115
  - spec/lib/ruby_smb/smb2/negotiate_context_spec.rb
962
1116
  - spec/lib/ruby_smb/smb2/packet/close_request_spec.rb
@@ -992,5 +1146,6 @@ test_files:
992
1146
  - spec/lib/ruby_smb/smb2/tree_spec.rb
993
1147
  - spec/lib/ruby_smb_spec.rb
994
1148
  - spec/spec_helper.rb
1149
+ - spec/support/bin_helper.rb
995
1150
  - spec/support/mock_socket_dispatcher.rb
996
1151
  - spec/support/shared/examples/bit_field_single_flag.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,38 +0,0 @@
1
- require 'ruby_smb/dcerpc/ndr'
2
-
3
- module RubySMB
4
- module Dcerpc
5
-
6
- # A RRP_UNICODE_STRING structure as defined in
7
- # [2.2.4 RRP_UNICODE_STRING](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rrp/c0c90f11-a4c4-496a-ac09-8a8a3697ceef)
8
- class RrpUnicodeString < BinData::Primitive
9
- endian :little
10
-
11
- uint16 :buffer_length
12
- uint16 :maximum_length
13
- ndr_lp_str :buffer
14
-
15
- def get
16
- self.buffer
17
- end
18
-
19
- def set(buf)
20
- self.buffer = buf
21
- self.buffer_length = self.buffer == :null ? 0 : self.buffer.referent.actual_count * 2
22
- # Don't reset maximum_length if the buffer is NULL to make sure we can
23
- # set it independently of the buffer size
24
- return if self.maximum_length > 0 && self.buffer == :null
25
- self.maximum_length = self.buffer.referent.max_count * 2
26
- end
27
- end
28
-
29
- # A pointer to a RRP_UNICODE_STRING structure
30
- class PrrpUnicodeString < Ndr::NdrPointer
31
- endian :little
32
-
33
- rrp_unicode_string :referent, onlyif: -> { self.referent_id != 0 }
34
- end
35
-
36
- end
37
- end
38
-
@@ -1,20 +0,0 @@
1
- module RubySMB
2
- module SMB1
3
- # This module holds the Create Actions used in NT_TRANSACT_CREATE and
4
- # SMB_COM_NT_CREATE_ANDX responses. The definitions for these values can be found at
5
- # [2.2.7.1.2 Response](https://msdn.microsoft.com/en-us/library/ee441961.aspx)
6
- module CreateActions
7
- # An existing file was deleted and a new file was created in its place.
8
- FILE_SUPERSEDED = 0x00000000
9
-
10
- # An existing file was opened.
11
- FILE_OPENED = 0x00000001
12
-
13
- # A new file was created.
14
- FILE_CREATED = 0x00000002
15
-
16
- # An existing file was overwritten.
17
- FILE_OVERWRITEN = 0x00000003
18
- end
19
- end
20
- end
@@ -1,135 +0,0 @@
1
- RSpec.describe RubySMB::Dcerpc::RrpUnicodeString do
2
- subject(:packet) { described_class.new }
3
-
4
- it { is_expected.to respond_to :buffer_length }
5
- it { is_expected.to respond_to :maximum_length }
6
- it { is_expected.to respond_to :buffer }
7
-
8
- it 'is little endian' do
9
- expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
10
- end
11
-
12
- describe '#buffer_length' do
13
- it 'should be a 16-bit unsigned integer' do
14
- expect(packet.buffer_length).to be_a BinData::Uint16le
15
- end
16
- end
17
-
18
- describe '#maximum_length' do
19
- it 'should be a 16-bit unsigned integer' do
20
- expect(packet.maximum_length).to be_a BinData::Uint16le
21
- end
22
- end
23
-
24
- describe '#buffer' do
25
- it 'should be a NdrLpStr' do
26
- expect(packet.buffer).to be_a RubySMB::Dcerpc::Ndr::NdrLpStr
27
- end
28
- end
29
-
30
- describe '#get' do
31
- it 'returns #buffer' do
32
- packet.buffer = 'spec_test'
33
- expect(packet.get).to eq(RubySMB::Dcerpc::Ndr::NdrLpStr.new('spec_test'))
34
- end
35
- end
36
-
37
- describe '#set' do
38
- it 'sets #buffer to the expected value' do
39
- packet.set('spec_test')
40
- expect(packet.buffer).to eq(RubySMB::Dcerpc::Ndr::NdrLpStr.new('spec_test'))
41
- end
42
-
43
- it 'sets #buffer_length to the expected value' do
44
- packet.set('spec_test')
45
- expect(packet.buffer_length).to eq(('spec_test'.size + 1) * 2)
46
- end
47
-
48
- it 'sets #maximum_length to the expected value' do
49
- packet.set('spec_test')
50
- expect(packet.maximum_length).to eq(('spec_test'.size + 1) * 2)
51
- end
52
-
53
- context 'when the value is :null' do
54
- it 'sets #buffer_length to 0' do
55
- packet.buffer_length = 33
56
- packet.set(:null)
57
- expect(packet.buffer_length).to eq(0)
58
- end
59
-
60
- it 'does not set #maximum_length if it has already been set' do
61
- packet.maximum_length = 33
62
- packet.set(:null)
63
- expect(packet.maximum_length).to eq(33)
64
- end
65
- end
66
- end
67
-
68
- describe '#read' do
69
- context 'with a null pointer' do
70
- it 'reads its own binary representation' do
71
- raw = packet.to_binary_s
72
- expect(described_class.read(raw)).to eq(packet)
73
- expect(described_class.read(raw).to_binary_s).to eq(raw)
74
- end
75
- end
76
-
77
- context 'with a normal string' do
78
- it 'reads its own binary representation' do
79
- packet.assign('my_test')
80
- raw = packet.to_binary_s
81
- expect(described_class.read(raw)).to eq(packet)
82
- expect(described_class.read(raw).to_binary_s).to eq(raw)
83
- end
84
- end
85
- end
86
- end
87
-
88
- RSpec.describe RubySMB::Dcerpc::PrrpUnicodeString do
89
- it 'is NdrPointer subclass' do
90
- expect(described_class).to be < RubySMB::Dcerpc::Ndr::NdrPointer
91
- end
92
-
93
- subject(:packet) { described_class.new }
94
-
95
- it { is_expected.to respond_to :referent }
96
-
97
- it 'is little endian' do
98
- expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
99
- end
100
-
101
- describe '#referent' do
102
- it 'is a RrpUnicodeString' do
103
- expect(packet.referent).to be_a RubySMB::Dcerpc::RrpUnicodeString
104
- end
105
-
106
- it 'exists if superclass #referent_identifier is not zero' do
107
- packet.referent_id = 0xCCCC
108
- expect(packet.referent?).to be true
109
- end
110
-
111
- it 'does not exist if superclass #referent_identifier is zero' do
112
- packet.referent_id = 0
113
- expect(packet.referent?).to be false
114
- end
115
- end
116
-
117
- describe '#read' do
118
- context 'with a null pointer' do
119
- it 'reads its own binary representation' do
120
- raw = packet.to_binary_s
121
- expect(described_class.read(raw)).to eq(packet)
122
- expect(described_class.read(raw).to_binary_s).to eq(raw)
123
- end
124
- end
125
-
126
- context 'with a normal string' do
127
- it 'reads its own binary representation' do
128
- packet.assign('my_test')
129
- raw = packet.to_binary_s
130
- expect(described_class.read(raw)).to eq(packet)
131
- expect(described_class.read(raw).to_binary_s).to eq(raw)
132
- end
133
- end
134
- end
135
- end