ruby_smb 2.0.10 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (224) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.github/workflows/verify.yml +5 -16
  4. data/examples/auth_capture.rb +71 -0
  5. data/examples/dump_secrets_from_sid.rb +207 -0
  6. data/examples/enum_domain_users.rb +75 -0
  7. data/examples/get_computer_info.rb +42 -0
  8. data/examples/query_service_status.rb +42 -4
  9. data/lib/ruby_smb/client/negotiation.rb +1 -1
  10. data/lib/ruby_smb/client.rb +10 -20
  11. data/lib/ruby_smb/dcerpc/bind.rb +28 -20
  12. data/lib/ruby_smb/dcerpc/bind_ack.rb +29 -28
  13. data/lib/ruby_smb/dcerpc/client.rb +542 -0
  14. data/lib/ruby_smb/dcerpc/drsr/drs_bind_request.rb +24 -0
  15. data/lib/ruby_smb/dcerpc/drsr/drs_bind_response.rb +26 -0
  16. data/lib/ruby_smb/dcerpc/drsr/drs_crack_names_request.rb +57 -0
  17. data/lib/ruby_smb/dcerpc/drsr/drs_crack_names_response.rb +76 -0
  18. data/lib/ruby_smb/dcerpc/drsr/drs_domain_controller_info_request.rb +46 -0
  19. data/lib/ruby_smb/dcerpc/drsr/drs_domain_controller_info_response.rb +168 -0
  20. data/lib/ruby_smb/dcerpc/drsr/drs_extensions.rb +56 -0
  21. data/lib/ruby_smb/dcerpc/drsr/drs_get_nc_changes_request.rb +121 -0
  22. data/lib/ruby_smb/dcerpc/drsr/drs_get_nc_changes_response.rb +118 -0
  23. data/lib/ruby_smb/dcerpc/drsr/drs_unbind_request.rb +24 -0
  24. data/lib/ruby_smb/dcerpc/drsr/drs_unbind_response.rb +26 -0
  25. data/lib/ruby_smb/dcerpc/drsr.rb +909 -0
  26. data/lib/ruby_smb/dcerpc/epm/epm_ept_map_request.rb +26 -0
  27. data/lib/ruby_smb/dcerpc/epm/epm_ept_map_response.rb +25 -0
  28. data/lib/ruby_smb/dcerpc/epm/epm_twrt.rb +211 -0
  29. data/lib/ruby_smb/dcerpc/epm.rb +75 -0
  30. data/lib/ruby_smb/dcerpc/error.rb +17 -0
  31. data/lib/ruby_smb/dcerpc/ndr.rb +1159 -297
  32. data/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_request.rb +3 -13
  33. data/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_response.rb +3 -3
  34. data/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_request.rb +3 -13
  35. data/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_response.rb +1 -1
  36. data/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_request.rb +3 -11
  37. data/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_response.rb +1 -1
  38. data/lib/ruby_smb/dcerpc/netlogon.rb +5 -4
  39. data/lib/ruby_smb/dcerpc/p_syntax_id_t.rb +4 -3
  40. data/lib/ruby_smb/dcerpc/pdu_header.rb +7 -7
  41. data/lib/ruby_smb/dcerpc/ptypes.rb +1 -0
  42. data/lib/ruby_smb/dcerpc/request.rb +79 -32
  43. data/lib/ruby_smb/dcerpc/response.rb +45 -10
  44. data/lib/ruby_smb/dcerpc/rpc_auth3.rb +28 -0
  45. data/lib/ruby_smb/dcerpc/rpc_security_attributes.rb +11 -11
  46. data/lib/ruby_smb/dcerpc/rrp_rpc_unicode_string.rb +118 -0
  47. data/lib/ruby_smb/dcerpc/samr/rpc_sid.rb +150 -0
  48. data/lib/ruby_smb/dcerpc/samr/samr_close_handle_request.rb +23 -0
  49. data/lib/ruby_smb/dcerpc/samr/samr_close_handle_response.rb +24 -0
  50. data/lib/ruby_smb/dcerpc/samr/samr_connect_request.rb +32 -0
  51. data/lib/ruby_smb/dcerpc/samr/samr_connect_response.rb +23 -0
  52. data/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_request.rb +26 -0
  53. data/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_response.rb +55 -0
  54. data/lib/ruby_smb/dcerpc/samr/samr_get_alias_membership_request.rb +48 -0
  55. data/lib/ruby_smb/dcerpc/samr/samr_get_alias_membership_response.rb +38 -0
  56. data/lib/ruby_smb/dcerpc/samr/samr_get_groups_for_user_request.rb +23 -0
  57. data/lib/ruby_smb/dcerpc/samr/samr_get_groups_for_user_response.rb +48 -0
  58. data/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_request.rb +24 -0
  59. data/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_response.rb +25 -0
  60. data/lib/ruby_smb/dcerpc/samr/samr_open_domain_request.rb +27 -0
  61. data/lib/ruby_smb/dcerpc/samr/samr_open_domain_response.rb +24 -0
  62. data/lib/ruby_smb/dcerpc/samr/samr_open_user_request.rb +26 -0
  63. data/lib/ruby_smb/dcerpc/samr/samr_open_user_response.rb +24 -0
  64. data/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_request.rb +23 -0
  65. data/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_response.rb +23 -0
  66. data/lib/ruby_smb/dcerpc/samr.rb +613 -0
  67. data/lib/ruby_smb/dcerpc/sec_trailer.rb +26 -0
  68. data/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all.rb +56 -79
  69. data/lib/ruby_smb/dcerpc/srvsvc.rb +27 -4
  70. data/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_request.rb +13 -25
  71. data/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_response.rb +2 -2
  72. data/lib/ruby_smb/dcerpc/svcctl/close_service_handle_response.rb +1 -1
  73. data/lib/ruby_smb/dcerpc/svcctl/control_service_request.rb +1 -1
  74. data/lib/ruby_smb/dcerpc/svcctl/control_service_response.rb +1 -1
  75. data/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_request.rb +4 -14
  76. data/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_response.rb +1 -1
  77. data/lib/ruby_smb/dcerpc/svcctl/open_service_w_request.rb +3 -11
  78. data/lib/ruby_smb/dcerpc/svcctl/open_service_w_response.rb +1 -1
  79. data/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_request.rb +1 -1
  80. data/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_response.rb +12 -11
  81. data/lib/ruby_smb/dcerpc/svcctl/query_service_status_response.rb +1 -1
  82. data/lib/ruby_smb/dcerpc/svcctl/service_status.rb +9 -8
  83. data/lib/ruby_smb/dcerpc/svcctl/start_service_w_request.rb +3 -3
  84. data/lib/ruby_smb/dcerpc/svcctl/start_service_w_response.rb +1 -1
  85. data/lib/ruby_smb/dcerpc/svcctl.rb +1 -3
  86. data/lib/ruby_smb/dcerpc/uuid.rb +3 -0
  87. data/lib/ruby_smb/dcerpc/winreg/close_key_response.rb +2 -2
  88. data/lib/ruby_smb/dcerpc/winreg/create_key_request.rb +2 -13
  89. data/lib/ruby_smb/dcerpc/winreg/create_key_response.rb +3 -3
  90. data/lib/ruby_smb/dcerpc/winreg/enum_key_request.rb +3 -20
  91. data/lib/ruby_smb/dcerpc/winreg/enum_key_response.rb +3 -20
  92. data/lib/ruby_smb/dcerpc/winreg/enum_value_request.rb +5 -14
  93. data/lib/ruby_smb/dcerpc/winreg/enum_value_response.rb +5 -14
  94. data/lib/ruby_smb/dcerpc/winreg/open_key_request.rb +1 -9
  95. data/lib/ruby_smb/dcerpc/winreg/open_key_response.rb +4 -3
  96. data/lib/ruby_smb/dcerpc/winreg/open_root_key_request.rb +5 -6
  97. data/lib/ruby_smb/dcerpc/winreg/open_root_key_response.rb +2 -2
  98. data/lib/ruby_smb/dcerpc/winreg/query_info_key_response.rb +9 -18
  99. data/lib/ruby_smb/dcerpc/winreg/query_value_request.rb +4 -14
  100. data/lib/ruby_smb/dcerpc/winreg/query_value_response.rb +7 -15
  101. data/lib/ruby_smb/dcerpc/winreg/regsam.rb +3 -1
  102. data/lib/ruby_smb/dcerpc/winreg/save_key_request.rb +0 -9
  103. data/lib/ruby_smb/dcerpc/winreg/save_key_response.rb +1 -1
  104. data/lib/ruby_smb/dcerpc/winreg.rb +10 -14
  105. data/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_request.rb +26 -0
  106. data/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_response.rb +88 -0
  107. data/lib/ruby_smb/dcerpc/wkssvc.rb +65 -0
  108. data/lib/ruby_smb/dcerpc.rb +41 -11
  109. data/lib/ruby_smb/dialect.rb +45 -0
  110. data/lib/ruby_smb/dispatcher/base.rb +1 -1
  111. data/lib/ruby_smb/field/file_time.rb +1 -1
  112. data/lib/ruby_smb/field/string16.rb +5 -1
  113. data/lib/ruby_smb/gss/provider/authenticator.rb +42 -0
  114. data/lib/ruby_smb/gss/provider/ntlm.rb +303 -0
  115. data/lib/ruby_smb/gss/provider.rb +35 -0
  116. data/lib/ruby_smb/gss.rb +56 -63
  117. data/lib/ruby_smb/ntlm.rb +61 -0
  118. data/lib/ruby_smb/server/server_client/negotiation.rb +156 -0
  119. data/lib/ruby_smb/server/server_client/session_setup.rb +82 -0
  120. data/lib/ruby_smb/server/server_client.rb +162 -0
  121. data/lib/ruby_smb/server.rb +54 -0
  122. data/lib/ruby_smb/signing.rb +59 -0
  123. data/lib/ruby_smb/smb1/packet/negotiate_response.rb +11 -11
  124. data/lib/ruby_smb/smb1/packet/negotiate_response_extended.rb +1 -1
  125. data/lib/ruby_smb/smb1/packet/session_setup_request.rb +1 -1
  126. data/lib/ruby_smb/smb1/pipe.rb +4 -0
  127. data/lib/ruby_smb/smb2/negotiate_context.rb +18 -2
  128. data/lib/ruby_smb/smb2/packet/negotiate_request.rb +9 -0
  129. data/lib/ruby_smb/smb2/packet/negotiate_response.rb +0 -1
  130. data/lib/ruby_smb/smb2/packet/session_setup_response.rb +2 -2
  131. data/lib/ruby_smb/smb2/packet/tree_connect_request.rb +1 -1
  132. data/lib/ruby_smb/smb2/pipe.rb +4 -0
  133. data/lib/ruby_smb/smb2.rb +3 -1
  134. data/lib/ruby_smb/version.rb +1 -1
  135. data/lib/ruby_smb.rb +2 -1
  136. data/spec/lib/ruby_smb/client_spec.rb +8 -11
  137. data/spec/lib/ruby_smb/dcerpc/bind_ack_spec.rb +69 -41
  138. data/spec/lib/ruby_smb/dcerpc/bind_spec.rb +75 -21
  139. data/spec/lib/ruby_smb/dcerpc/client_spec.rb +714 -0
  140. data/spec/lib/ruby_smb/dcerpc/drsr_spec.rb +2169 -0
  141. data/spec/lib/ruby_smb/dcerpc/ndr_spec.rb +3792 -1373
  142. data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_request_spec.rb +4 -4
  143. data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_request_spec.rb +4 -4
  144. data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_request_spec.rb +2 -2
  145. data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_response_spec.rb +2 -2
  146. data/spec/lib/ruby_smb/dcerpc/p_syntax_id_t_spec.rb +18 -4
  147. data/spec/lib/ruby_smb/dcerpc/pdu_header_spec.rb +27 -1
  148. data/spec/lib/ruby_smb/dcerpc/request_spec.rb +76 -11
  149. data/spec/lib/ruby_smb/dcerpc/response_spec.rb +99 -9
  150. data/spec/lib/ruby_smb/dcerpc/rpc_auth3_spec.rb +75 -0
  151. data/spec/lib/ruby_smb/dcerpc/rpc_security_attributes_spec.rb +29 -28
  152. data/spec/lib/ruby_smb/dcerpc/rrp_rpc_unicode_string_spec.rb +340 -0
  153. data/spec/lib/ruby_smb/dcerpc/samr/rpc_sid_spec.rb +116 -0
  154. data/spec/lib/ruby_smb/dcerpc/samr/samr_close_handle_request_spec.rb +40 -0
  155. data/spec/lib/ruby_smb/dcerpc/samr/samr_close_handle_response_spec.rb +48 -0
  156. data/spec/lib/ruby_smb/dcerpc/samr/samr_connect_request_spec.rb +56 -0
  157. data/spec/lib/ruby_smb/dcerpc/samr/samr_connect_response_spec.rb +47 -0
  158. data/spec/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_request_spec.rb +63 -0
  159. data/spec/lib/ruby_smb/dcerpc/samr/samr_enumerate_users_in_domain_response_spec.rb +265 -0
  160. data/spec/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_request_spec.rb +52 -0
  161. data/spec/lib/ruby_smb/dcerpc/samr/samr_lookup_domain_in_sam_server_response_spec.rb +36 -0
  162. data/spec/lib/ruby_smb/dcerpc/samr/samr_open_domain_request_spec.rb +56 -0
  163. data/spec/lib/ruby_smb/dcerpc/samr/samr_open_domain_response_spec.rb +48 -0
  164. data/spec/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_request_spec.rb +48 -0
  165. data/spec/lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_response_spec.rb +42 -0
  166. data/spec/lib/ruby_smb/dcerpc/samr_spec.rb +420 -0
  167. data/spec/lib/ruby_smb/dcerpc/sec_trailer_spec.rb +92 -0
  168. data/spec/lib/ruby_smb/dcerpc/srvsvc/net_share_enum_all_spec.rb +149 -110
  169. data/spec/lib/ruby_smb/dcerpc/srvsvc_spec.rb +21 -17
  170. data/spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_request_spec.rb +56 -79
  171. data/spec/lib/ruby_smb/dcerpc/svcctl/change_service_config_w_response_spec.rb +4 -4
  172. data/spec/lib/ruby_smb/dcerpc/svcctl/close_service_handle_response_spec.rb +2 -2
  173. data/spec/lib/ruby_smb/dcerpc/svcctl/control_service_request_spec.rb +2 -2
  174. data/spec/lib/ruby_smb/dcerpc/svcctl/control_service_response_spec.rb +2 -2
  175. data/spec/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_request_spec.rb +19 -29
  176. data/spec/lib/ruby_smb/dcerpc/svcctl/open_sc_manager_w_response_spec.rb +2 -2
  177. data/spec/lib/ruby_smb/dcerpc/svcctl/open_service_w_request_spec.rb +9 -15
  178. data/spec/lib/ruby_smb/dcerpc/svcctl/open_service_w_response_spec.rb +2 -2
  179. data/spec/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_request_spec.rb +2 -2
  180. data/spec/lib/ruby_smb/dcerpc/svcctl/query_service_config_w_response_spec.rb +22 -22
  181. data/spec/lib/ruby_smb/dcerpc/svcctl/query_service_status_response_spec.rb +2 -2
  182. data/spec/lib/ruby_smb/dcerpc/svcctl/service_status_spec.rb +18 -14
  183. data/spec/lib/ruby_smb/dcerpc/svcctl/start_service_w_request_spec.rb +5 -4
  184. data/spec/lib/ruby_smb/dcerpc/svcctl/start_service_w_response_spec.rb +2 -2
  185. data/spec/lib/ruby_smb/dcerpc/svcctl_spec.rb +1 -5
  186. data/spec/lib/ruby_smb/dcerpc/uuid_spec.rb +15 -23
  187. data/spec/lib/ruby_smb/dcerpc/winreg/close_key_response_spec.rb +2 -2
  188. data/spec/lib/ruby_smb/dcerpc/winreg/create_key_request_spec.rb +4 -41
  189. data/spec/lib/ruby_smb/dcerpc/winreg/create_key_response_spec.rb +4 -4
  190. data/spec/lib/ruby_smb/dcerpc/winreg/enum_key_request_spec.rb +4 -52
  191. data/spec/lib/ruby_smb/dcerpc/winreg/enum_key_response_spec.rb +4 -56
  192. data/spec/lib/ruby_smb/dcerpc/winreg/enum_value_request_spec.rb +10 -34
  193. data/spec/lib/ruby_smb/dcerpc/winreg/enum_value_response_spec.rb +10 -34
  194. data/spec/lib/ruby_smb/dcerpc/winreg/open_key_request_spec.rb +2 -26
  195. data/spec/lib/ruby_smb/dcerpc/winreg/open_key_response_spec.rb +2 -2
  196. data/spec/lib/ruby_smb/dcerpc/winreg/open_root_key_request_spec.rb +17 -25
  197. data/spec/lib/ruby_smb/dcerpc/winreg/open_root_key_response_spec.rb +2 -2
  198. data/spec/lib/ruby_smb/dcerpc/winreg/query_info_key_response_spec.rb +20 -44
  199. data/spec/lib/ruby_smb/dcerpc/winreg/query_value_request_spec.rb +8 -32
  200. data/spec/lib/ruby_smb/dcerpc/winreg/query_value_response_spec.rb +10 -22
  201. data/spec/lib/ruby_smb/dcerpc/winreg/regsam_spec.rb +4 -0
  202. data/spec/lib/ruby_smb/dcerpc/winreg/save_key_request_spec.rb +0 -12
  203. data/spec/lib/ruby_smb/dcerpc/winreg/save_key_response_spec.rb +2 -2
  204. data/spec/lib/ruby_smb/dcerpc/winreg_spec.rb +18 -47
  205. data/spec/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_request_spec.rb +43 -0
  206. data/spec/lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_response_spec.rb +410 -0
  207. data/spec/lib/ruby_smb/dcerpc/wkssvc_spec.rb +70 -0
  208. data/spec/lib/ruby_smb/field/string16_spec.rb +22 -0
  209. data/spec/lib/ruby_smb/gss/provider/ntlm/account_spec.rb +32 -0
  210. data/spec/lib/ruby_smb/gss/provider/ntlm/authenticator_spec.rb +101 -0
  211. data/spec/lib/ruby_smb/gss/provider/ntlm/os_version_spec.rb +32 -0
  212. data/spec/lib/ruby_smb/gss/provider/ntlm_spec.rb +113 -0
  213. data/spec/lib/ruby_smb/server/server_client_spec.rb +156 -0
  214. data/spec/lib/ruby_smb/server_spec.rb +32 -0
  215. data/spec/lib/ruby_smb/smb1/pipe_spec.rb +18 -37
  216. data/spec/lib/ruby_smb/smb2/negotiate_context_spec.rb +2 -2
  217. data/spec/lib/ruby_smb/smb2/pipe_spec.rb +18 -16
  218. data/spec/support/bin_helper.rb +9 -0
  219. data.tar.gz.sig +0 -0
  220. metadata +119 -6
  221. metadata.gz.sig +0 -0
  222. data/lib/ruby_smb/client/signing.rb +0 -64
  223. data/lib/ruby_smb/dcerpc/rrp_unicode_string.rb +0 -38
  224. data/spec/lib/ruby_smb/dcerpc/rrp_unicode_string_spec.rb +0 -135
@@ -10,9 +10,7 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumKeyRequest do
10
10
  it { is_expected.to respond_to :hkey }
11
11
  it { is_expected.to respond_to :dw_index }
12
12
  it { is_expected.to respond_to :lp_name }
13
- it { is_expected.to respond_to :pad1 }
14
13
  it { is_expected.to respond_to :lp_class }
15
- it { is_expected.to respond_to :pad2 }
16
14
  it { is_expected.to respond_to :lpft_last_write_time }
17
15
  it { is_expected.to respond_to :opnum }
18
16
 
@@ -27,8 +25,8 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumKeyRequest do
27
25
  end
28
26
 
29
27
  describe '#dw_index' do
30
- it 'is a 32-bit unsigned integer' do
31
- expect(packet.dw_index).to be_a BinData::Uint32le
28
+ it 'is a NdrUint32' do
29
+ expect(packet.dw_index).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
32
30
  end
33
31
  end
34
32
 
@@ -38,37 +36,15 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumKeyRequest do
38
36
  end
39
37
  end
40
38
 
41
- describe '#pad1' do
42
- it 'is a string' do
43
- expect(packet.pad1).to be_a BinData::String
44
- end
45
-
46
- it 'should keep #lp_class 4-byte aligned' do
47
- packet.lp_name = "test"
48
- expect(packet.lp_class.abs_offset % 4).to eq 0
49
- end
50
- end
51
-
52
39
  describe '#lp_class' do
53
40
  it 'is a PrrpUnicodeString structure' do
54
41
  expect(packet.lp_class).to be_a RubySMB::Dcerpc::PrrpUnicodeString
55
42
  end
56
43
  end
57
44
 
58
- describe '#pad2' do
59
- it 'is a string' do
60
- expect(packet.pad2).to be_a BinData::String
61
- end
62
-
63
- it 'should keep #lpft_last_write_time 4-byte aligned' do
64
- packet.lp_class = "test"
65
- expect(packet.lpft_last_write_time.abs_offset % 4).to eq 0
66
- end
67
- end
68
-
69
45
  describe '#lpft_last_write_time' do
70
- it 'is a NdrLpFileTime structure' do
71
- expect(packet.lpft_last_write_time).to be_a RubySMB::Dcerpc::Ndr::NdrLpFileTime
46
+ it 'is a NdrFileTimePtr structure' do
47
+ expect(packet.lpft_last_write_time).to be_a RubySMB::Dcerpc::Ndr::NdrFileTimePtr
72
48
  end
73
49
  end
74
50
 
@@ -77,28 +53,4 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumKeyRequest do
77
53
  expect(packet.opnum).to eq(RubySMB::Dcerpc::Winreg::REG_ENUM_KEY)
78
54
  end
79
55
  end
80
-
81
- describe '#pad_length1' do
82
- it 'returns 0 when #lp_class is already 4-byte aligned' do
83
- packet.lp_name = 'align'
84
- expect(packet.pad_length1).to eq 0
85
- end
86
-
87
- it 'returns 2 when #lp_class is only 2-byte aligned' do
88
- packet.lp_name = 'align' + 'A'
89
- expect(packet.pad_length1).to eq 2
90
- end
91
- end
92
-
93
- describe '#pad_length2' do
94
- it 'returns 0 when #lpft_last_write_time is already 4-byte aligned' do
95
- packet.lp_class = 'align'
96
- expect(packet.pad_length2).to eq 0
97
- end
98
-
99
- it 'returns 2 when #lpft_last_write_time is only 2-byte aligned' do
100
- packet.lp_class = 'align' + 'A'
101
- expect(packet.pad_length2).to eq 2
102
- end
103
- end
104
56
  end
@@ -2,9 +2,7 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumKeyResponse do
2
2
  subject(:packet) { described_class.new }
3
3
 
4
4
  it { is_expected.to respond_to :lp_name }
5
- it { is_expected.to respond_to :pad1 }
6
5
  it { is_expected.to respond_to :lp_class }
7
- it { is_expected.to respond_to :pad2 }
8
6
  it { is_expected.to respond_to :lpft_last_write_time }
9
7
  it { is_expected.to respond_to :error_status }
10
8
  it { is_expected.to respond_to :opnum }
@@ -20,47 +18,21 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumKeyResponse do
20
18
  end
21
19
  end
22
20
 
23
- describe '#pad1' do
24
- it 'is a string' do
25
- expect(packet.pad1).to be_a BinData::String
26
- end
27
-
28
- it 'should keep #lp_class 4-byte aligned' do
29
- packet.lp_name = "test"
30
- expect(packet.lp_class.abs_offset % 4).to eq 0
31
- end
32
- end
33
-
34
21
  describe '#lp_class' do
35
22
  it 'is a PrrpUnicodeString structure' do
36
23
  expect(packet.lp_class).to be_a RubySMB::Dcerpc::PrrpUnicodeString
37
24
  end
38
-
39
- it 'has a initial value of 0' do
40
- expect(packet.lp_class).to eq(0)
41
- end
42
- end
43
-
44
- describe '#pad2' do
45
- it 'is a string' do
46
- expect(packet.pad2).to be_a BinData::String
47
- end
48
-
49
- it 'should keep #lpft_last_write_time 4-byte aligned' do
50
- packet.lp_class = "test"
51
- expect(packet.lpft_last_write_time.abs_offset % 4).to eq 0
52
- end
53
25
  end
54
26
 
55
27
  describe '#lpft_last_write_time' do
56
- it 'is a NdrLpFileTime structure' do
57
- expect(packet.lpft_last_write_time).to be_a RubySMB::Dcerpc::Ndr::NdrLpFileTime
28
+ it 'is a NdrFileTimePtr structure' do
29
+ expect(packet.lpft_last_write_time).to be_a RubySMB::Dcerpc::Ndr::NdrFileTimePtr
58
30
  end
59
31
  end
60
32
 
61
33
  describe '#error_status' do
62
- it 'is a 32-bit unsigned integer' do
63
- expect(packet.error_status).to be_a BinData::Uint32le
34
+ it 'is a NdrUint32' do
35
+ expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
64
36
  end
65
37
  end
66
38
 
@@ -69,29 +41,5 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumKeyResponse do
69
41
  expect(packet.opnum).to eq(RubySMB::Dcerpc::Winreg::REG_ENUM_KEY)
70
42
  end
71
43
  end
72
-
73
- describe '#pad_length1' do
74
- it 'returns 0 when #lp_class is already 4-byte aligned' do
75
- packet.lp_name = 'align'
76
- expect(packet.pad_length1).to eq 0
77
- end
78
-
79
- it 'returns 2 when #lp_class is only 2-byte aligned' do
80
- packet.lp_name = 'align' + 'A'
81
- expect(packet.pad_length1).to eq 2
82
- end
83
- end
84
-
85
- describe '#pad_length2' do
86
- it 'returns 0 when #lpft_last_write_time is already 4-byte aligned' do
87
- packet.lp_class = 'align'
88
- expect(packet.pad_length2).to eq 0
89
- end
90
-
91
- it 'returns 2 when #lpft_last_write_time is only 2-byte aligned' do
92
- packet.lp_class = 'align' + 'A'
93
- expect(packet.pad_length2).to eq 2
94
- end
95
- end
96
44
  end
97
45
 
@@ -10,7 +10,6 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumValueRequest do
10
10
  it { is_expected.to respond_to :hkey }
11
11
  it { is_expected.to respond_to :dw_index }
12
12
  it { is_expected.to respond_to :lp_value_name }
13
- it { is_expected.to respond_to :pad }
14
13
  it { is_expected.to respond_to :lp_type }
15
14
  it { is_expected.to respond_to :lp_data }
16
15
  it { is_expected.to respond_to :lpcb_data }
@@ -28,8 +27,8 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumValueRequest do
28
27
  end
29
28
 
30
29
  describe '#dw_index' do
31
- it 'is a 32-bit unsigned integer' do
32
- expect(packet.dw_index).to be_a BinData::Uint32le
30
+ it 'is a NdrUint32' do
31
+ expect(packet.dw_index).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
33
32
  end
34
33
  end
35
34
 
@@ -39,38 +38,27 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumValueRequest do
39
38
  end
40
39
  end
41
40
 
42
- describe '#pad' do
43
- it 'is a string' do
44
- expect(packet.pad).to be_a BinData::String
45
- end
46
-
47
- it 'should keep #lp_type 4-byte aligned' do
48
- packet.lp_value_name = "test"
49
- expect(packet.lp_type.abs_offset % 4).to eq 0
50
- end
51
- end
52
-
53
41
  describe '#lp_type' do
54
- it 'is a NdrLpDword structure' do
55
- expect(packet.lp_type).to be_a RubySMB::Dcerpc::Ndr::NdrLpDword
42
+ it 'is a NdrUint32Ptr structure' do
43
+ expect(packet.lp_type).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
56
44
  end
57
45
  end
58
46
 
59
47
  describe '#lp_data' do
60
- it 'is a NdrLpByteArray structure' do
61
- expect(packet.lp_data).to be_a RubySMB::Dcerpc::Ndr::NdrLpByteArray
48
+ it 'is a NdrByteArrayPtr structure' do
49
+ expect(packet.lp_data).to be_a RubySMB::Dcerpc::Ndr::NdrByteArrayPtr
62
50
  end
63
51
  end
64
52
 
65
53
  describe '#lpcb_data' do
66
- it 'is a NdrLpDword structure' do
67
- expect(packet.lpcb_data).to be_a RubySMB::Dcerpc::Ndr::NdrLpDword
54
+ it 'is a NdrUint32Ptr structure' do
55
+ expect(packet.lpcb_data).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
68
56
  end
69
57
  end
70
58
 
71
59
  describe '#lpcb_len' do
72
- it 'is a NdrLpDword structure' do
73
- expect(packet.lpcb_len).to be_a RubySMB::Dcerpc::Ndr::NdrLpDword
60
+ it 'is a NdrUint32Ptr structure' do
61
+ expect(packet.lpcb_len).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
74
62
  end
75
63
  end
76
64
 
@@ -79,16 +67,4 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumValueRequest do
79
67
  expect(packet.opnum).to eq(RubySMB::Dcerpc::Winreg::REG_ENUM_VALUE)
80
68
  end
81
69
  end
82
-
83
- describe '#pad_length' do
84
- it 'returns 0 when #lp_class is already 4-byte aligned' do
85
- packet.lp_value_name = 'align'
86
- expect(packet.pad_length).to eq 0
87
- end
88
-
89
- it 'returns 2 when #lp_class is only 2-byte aligned' do
90
- packet.lp_value_name = 'align' + 'A'
91
- expect(packet.pad_length).to eq 2
92
- end
93
- end
94
70
  end
@@ -2,7 +2,6 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumValueResponse do
2
2
  subject(:packet) { described_class.new }
3
3
 
4
4
  it { is_expected.to respond_to :lp_value_name }
5
- it { is_expected.to respond_to :pad }
6
5
  it { is_expected.to respond_to :lp_type }
7
6
  it { is_expected.to respond_to :lp_data }
8
7
  it { is_expected.to respond_to :lpcb_data }
@@ -20,44 +19,33 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumValueResponse do
20
19
  end
21
20
  end
22
21
 
23
- describe '#pad' do
24
- it 'is a string' do
25
- expect(packet.pad).to be_a BinData::String
26
- end
27
-
28
- it 'should keep #lp_type 4-byte aligned' do
29
- packet.lp_value_name = "test"
30
- expect(packet.lp_type.abs_offset % 4).to eq 0
31
- end
32
- end
33
-
34
22
  describe '#lp_type' do
35
- it 'is a NdrLpDword structure' do
36
- expect(packet.lp_type).to be_a RubySMB::Dcerpc::Ndr::NdrLpDword
23
+ it 'is a NdrUint32Ptr structure' do
24
+ expect(packet.lp_type).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
37
25
  end
38
26
  end
39
27
 
40
28
  describe '#lp_data' do
41
- it 'is a NdrLpByteArray structure' do
42
- expect(packet.lp_data).to be_a RubySMB::Dcerpc::Ndr::NdrLpByteArray
29
+ it 'is a NdrByteArrayPtr structure' do
30
+ expect(packet.lp_data).to be_a RubySMB::Dcerpc::Ndr::NdrByteArrayPtr
43
31
  end
44
32
  end
45
33
 
46
34
  describe '#lpcb_data' do
47
- it 'is a NdrLpDword structure' do
48
- expect(packet.lpcb_data).to be_a RubySMB::Dcerpc::Ndr::NdrLpDword
35
+ it 'is a NdrUint32Ptr structure' do
36
+ expect(packet.lpcb_data).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
49
37
  end
50
38
  end
51
39
 
52
40
  describe '#lpcb_len' do
53
- it 'is a NdrLpDword structure' do
54
- expect(packet.lpcb_len).to be_a RubySMB::Dcerpc::Ndr::NdrLpDword
41
+ it 'is a NdrUint32Ptr structure' do
42
+ expect(packet.lpcb_len).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
55
43
  end
56
44
  end
57
45
 
58
46
  describe '#error_status' do
59
- it 'is a 32-bit unsigned integer' do
60
- expect(packet.error_status).to be_a BinData::Uint32le
47
+ it 'is a NdrUint32' do
48
+ expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
61
49
  end
62
50
  end
63
51
 
@@ -66,17 +54,5 @@ RSpec.describe RubySMB::Dcerpc::Winreg::EnumValueResponse do
66
54
  expect(packet.opnum).to eq(RubySMB::Dcerpc::Winreg::REG_ENUM_VALUE)
67
55
  end
68
56
  end
69
-
70
- describe '#pad_length' do
71
- it 'returns 0 when #lp_class is already 4-byte aligned' do
72
- packet.lp_value_name = 'align'
73
- expect(packet.pad_length).to eq 0
74
- end
75
-
76
- it 'returns 2 when #lp_class is only 2-byte aligned' do
77
- packet.lp_value_name = 'align' + 'A'
78
- expect(packet.pad_length).to eq 2
79
- end
80
- end
81
57
  end
82
58
 
@@ -9,7 +9,6 @@ RSpec.describe RubySMB::Dcerpc::Winreg::OpenKeyRequest do
9
9
 
10
10
  it { is_expected.to respond_to :hkey }
11
11
  it { is_expected.to respond_to :lp_sub_key }
12
- it { is_expected.to respond_to :pad }
13
12
  it { is_expected.to respond_to :dw_options }
14
13
  it { is_expected.to respond_to :sam_desired }
15
14
  it { is_expected.to respond_to :opnum }
@@ -30,20 +29,9 @@ RSpec.describe RubySMB::Dcerpc::Winreg::OpenKeyRequest do
30
29
  end
31
30
  end
32
31
 
33
- describe '#pad' do
34
- it 'is a string' do
35
- expect(packet.pad).to be_a BinData::String
36
- end
37
-
38
- it 'should keep #dw_options 4-byte aligned' do
39
- packet.lp_sub_key = "test"
40
- expect(packet.dw_options.abs_offset % 4).to eq 0
41
- end
42
- end
43
-
44
32
  describe '#dw_options' do
45
- it 'is a 32-bit unsigned integer' do
46
- expect(packet.dw_options).to be_a BinData::Uint32le
33
+ it 'is a NdrUint32' do
34
+ expect(packet.dw_options).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
47
35
  end
48
36
  end
49
37
 
@@ -58,17 +46,5 @@ RSpec.describe RubySMB::Dcerpc::Winreg::OpenKeyRequest do
58
46
  expect(packet.opnum).to eq(RubySMB::Dcerpc::Winreg::REG_OPEN_KEY)
59
47
  end
60
48
  end
61
-
62
- describe '#pad_length' do
63
- it 'returns 0 when #dw_options is already 4-byte aligned' do
64
- packet.lp_sub_key = 'align'
65
- expect(packet.pad_length).to eq 0
66
- end
67
-
68
- it 'returns 2 when #dw_options is only 2-byte aligned' do
69
- packet.lp_sub_key = 'align' + 'A'
70
- expect(packet.pad_length).to eq 2
71
- end
72
- end
73
49
  end
74
50
 
@@ -22,8 +22,8 @@ RSpec.describe RubySMB::Dcerpc::Winreg::OpenKeyResponse do
22
22
  end
23
23
 
24
24
  describe '#error_status' do
25
- it 'is a 32-bit unsigned integer' do
26
- expect(packet.error_status).to be_a BinData::Uint32le
25
+ it 'is a NdrUint32' do
26
+ expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
27
27
  end
28
28
  end
29
29
 
@@ -1,38 +1,30 @@
1
1
  RSpec.describe RubySMB::Dcerpc::Winreg::PRegistryServerName do
2
- it 'is NdrPointer subclass' do
3
- expect(described_class).to be < RubySMB::Dcerpc::Ndr::NdrPointer
2
+ it 'is BinData::Array subclass' do
3
+ expect(described_class).to be < BinData::Array
4
+ end
5
+
6
+ it 'is a RubySMB::Dcerpc::Ndr::PointerClassPlugin class' do
7
+ expect(described_class).to be_a(RubySMB::Dcerpc::Ndr::PointerClassPlugin)
4
8
  end
5
9
 
6
10
  subject(:packet) { described_class.new }
7
11
 
8
- it { is_expected.to respond_to :referent }
12
+ it { is_expected.to respond_to :ref_id }
9
13
 
10
- it 'is little endian' do
11
- expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
14
+ it 'is an array of UTF-16LE strings' do
15
+ expect(packet[0]).to be_a RubySMB::Field::String16
12
16
  end
13
17
 
14
- describe '#referent' do
15
- it 'is a string in UTF-16LE' do
16
- expect(packet.referent).to be_a RubySMB::Field::String16
17
- end
18
-
19
- it 'only exists if #referent_id is not 0' do
20
- packet.referent_id = 0
21
- expect(packet.referent?).to be false
22
- end
23
-
24
- it 'reads 4-bytes' do
25
- str = 'spec_test'.encode('utf-16le')
26
- packet.referent.read(str)
27
- expect(packet.referent.to_binary_s.bytes).to eq(str.bytes[0,4])
28
- end
18
+ it 'is :null if #ref_id is 0' do
19
+ packet.ref_id = 0
20
+ expect(packet).to eq(:null)
29
21
  end
30
22
  end
31
23
 
32
24
  RSpec.describe RubySMB::Dcerpc::Winreg::OpenRootKeyRequest do
33
25
  subject(:packet) { described_class.new }
34
26
 
35
- it { is_expected.to respond_to :p_registry_server_name }
27
+ it { is_expected.to respond_to :server_name }
36
28
  it { is_expected.to respond_to :sam_desired }
37
29
  it { is_expected.to respond_to :opnum }
38
30
 
@@ -40,9 +32,9 @@ RSpec.describe RubySMB::Dcerpc::Winreg::OpenRootKeyRequest do
40
32
  expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
41
33
  end
42
34
 
43
- describe '#p_registry_server_name' do
35
+ describe '#server_name' do
44
36
  it 'is a PRegistryServerName structure' do
45
- expect(packet.p_registry_server_name).to be_a RubySMB::Dcerpc::Winreg::PRegistryServerName
37
+ expect(packet.server_name).to be_a RubySMB::Dcerpc::Winreg::PRegistryServerName
46
38
  end
47
39
  end
48
40
 
@@ -60,8 +52,8 @@ RSpec.describe RubySMB::Dcerpc::Winreg::OpenRootKeyRequest do
60
52
  end
61
53
  end
62
54
 
63
- it 'sets #p_registry_server_name.referent to :null' do
64
- expect(packet.p_registry_server_name).to eq(:null)
55
+ it 'sets #server_name.referent to :null' do
56
+ expect(packet.server_name).to eq(:null)
65
57
  end
66
58
 
67
59
  context 'when #opnum is not OPEN_HKPD, OPEN_HKPT or OPEN_HKPN' do
@@ -22,8 +22,8 @@ RSpec.describe RubySMB::Dcerpc::Winreg::OpenRootKeyResponse do
22
22
  end
23
23
 
24
24
  describe '#error_status' do
25
- it 'is a 32-bit unsigned integer' do
26
- expect(packet.error_status).to be_a BinData::Uint32le
25
+ it 'is a NdrUint32' do
26
+ expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
27
27
  end
28
28
  end
29
29
 
@@ -2,7 +2,6 @@ RSpec.describe RubySMB::Dcerpc::Winreg::QueryInfoKeyResponse do
2
2
  subject(:packet) { described_class.new }
3
3
 
4
4
  it { is_expected.to respond_to :lp_class }
5
- it { is_expected.to respond_to :pad }
6
5
  it { is_expected.to respond_to :lpc_sub_keys }
7
6
  it { is_expected.to respond_to :lpc_max_sub_key_len }
8
7
  it { is_expected.to respond_to :lpc_max_class_len }
@@ -23,73 +22,62 @@ RSpec.describe RubySMB::Dcerpc::Winreg::QueryInfoKeyResponse do
23
22
  expect(packet.lp_class).to be_a RubySMB::Dcerpc::RrpUnicodeString
24
23
  end
25
24
 
26
- it 'has an initial value of 0' do
27
- expect(packet.lp_class).to eq(0)
28
- end
29
- end
30
-
31
- describe '#pad' do
32
- it 'is a string' do
33
- expect(packet.pad).to be_a BinData::String
34
- end
35
-
36
- it 'should keep #lpc_sub_keys 4-byte aligned' do
37
- packet.lp_class = 'test'
38
- expect(packet.lpc_sub_keys.abs_offset % 4).to eq 0
25
+ it 'has the expected initial value' do
26
+ expect(packet.lp_class).to eq({:buffer_length=>0, :maximum_length=>0, :buffer=>:null})
39
27
  end
40
28
  end
41
29
 
42
30
  describe '#lpc_sub_keys' do
43
- it 'is a 32-bit unsigned integer' do
44
- expect(packet.lpc_sub_keys).to be_a BinData::Uint32le
31
+ it 'is a NdrUint32' do
32
+ expect(packet.lpc_sub_keys).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
45
33
  end
46
34
  end
47
35
 
48
36
  describe '#lpc_max_sub_key_len' do
49
- it 'is a 32-bit unsigned integer' do
50
- expect(packet.lpc_max_sub_key_len).to be_a BinData::Uint32le
37
+ it 'is a NdrUint32' do
38
+ expect(packet.lpc_max_sub_key_len).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
51
39
  end
52
40
  end
53
41
 
54
42
  describe '#lpc_max_class_len' do
55
- it 'is a 32-bit unsigned integer' do
56
- expect(packet.lpc_max_class_len).to be_a BinData::Uint32le
43
+ it 'is a NdrUint32' do
44
+ expect(packet.lpc_max_class_len).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
57
45
  end
58
46
  end
59
47
 
60
48
  describe '#lpc_values' do
61
- it 'is a 32-bit unsigned integer' do
62
- expect(packet.lpc_values).to be_a BinData::Uint32le
49
+ it 'is a NdrUint32' do
50
+ expect(packet.lpc_values).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
63
51
  end
64
52
  end
65
53
 
66
54
  describe '#lpcb_max_value_name_len' do
67
- it 'is a 32-bit unsigned integer' do
68
- expect(packet.lpcb_max_value_name_len).to be_a BinData::Uint32le
55
+ it 'is a NdrUint32' do
56
+ expect(packet.lpcb_max_value_name_len).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
69
57
  end
70
58
  end
71
59
 
72
60
  describe '#lpcb_max_value_len' do
73
- it 'is a 32-bit unsigned integer' do
74
- expect(packet.lpcb_max_value_len).to be_a BinData::Uint32le
61
+ it 'is a NdrUint32' do
62
+ expect(packet.lpcb_max_value_len).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
75
63
  end
76
64
  end
77
65
 
78
66
  describe '#lpcb_security_descriptor' do
79
- it 'is a 32-bit unsigned integer' do
80
- expect(packet.lpcb_security_descriptor).to be_a BinData::Uint32le
67
+ it 'is a NdrUint32' do
68
+ expect(packet.lpcb_security_descriptor).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
81
69
  end
82
70
  end
83
71
 
84
72
  describe '#lpft_last_write_time' do
85
- it 'is a FileTime structure' do
86
- expect(packet.lpft_last_write_time).to be_a RubySMB::Field::FileTime
73
+ it 'is a NdrFileTime structure' do
74
+ expect(packet.lpft_last_write_time).to be_a RubySMB::Dcerpc::Ndr::NdrFileTime
87
75
  end
88
76
  end
89
77
 
90
78
  describe '#error_status' do
91
- it 'is a 32-bit unsigned integer' do
92
- expect(packet.error_status).to be_a BinData::Uint32le
79
+ it 'is a NdrUint32' do
80
+ expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
93
81
  end
94
82
  end
95
83
 
@@ -98,16 +86,4 @@ RSpec.describe RubySMB::Dcerpc::Winreg::QueryInfoKeyResponse do
98
86
  expect(packet.opnum).to eq(RubySMB::Dcerpc::Winreg::REG_QUERY_INFO_KEY)
99
87
  end
100
88
  end
101
-
102
- describe '#pad_length' do
103
- it 'returns 0 when #lpc_sub_keys is already 4-byte aligned' do
104
- packet.lp_class = 'align'
105
- expect(packet.pad_length).to eq 0
106
- end
107
-
108
- it 'returns 2 when #lpc_sub_keys is only 2-byte aligned' do
109
- packet.lp_class = 'align' + 'A'
110
- expect(packet.pad_length).to eq 2
111
- end
112
- end
113
89
  end
@@ -9,10 +9,8 @@ RSpec.describe RubySMB::Dcerpc::Winreg::QueryValueRequest do
9
9
 
10
10
  it { is_expected.to respond_to :hkey }
11
11
  it { is_expected.to respond_to :lp_value_name }
12
- it { is_expected.to respond_to :pad1 }
13
12
  it { is_expected.to respond_to :lp_type }
14
13
  it { is_expected.to respond_to :lp_data }
15
- it { is_expected.to respond_to :pad2 }
16
14
  it { is_expected.to respond_to :lpcb_data }
17
15
  it { is_expected.to respond_to :lpcb_len }
18
16
  it { is_expected.to respond_to :opnum }
@@ -33,49 +31,27 @@ RSpec.describe RubySMB::Dcerpc::Winreg::QueryValueRequest do
33
31
  end
34
32
  end
35
33
 
36
- describe '#pad1' do
37
- it 'is a string' do
38
- expect(packet.pad1).to be_a BinData::String
39
- end
40
-
41
- it 'should keep #lp_type 4-byte aligned' do
42
- packet.lp_value_name = 'test'
43
- expect(packet.lp_type.abs_offset % 4).to eq 0
44
- end
45
- end
46
-
47
34
  describe '#lp_type' do
48
- it 'is a NdrLpDword structure' do
49
- expect(packet.lp_type).to be_a RubySMB::Dcerpc::Ndr::NdrLpDword
35
+ it 'is a Ndr::NdrUint32Ptr structure' do
36
+ expect(packet.lp_type).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
50
37
  end
51
38
  end
52
39
 
53
40
  describe '#lp_data' do
54
- it 'is a NdrLpByteArray structure' do
55
- expect(packet.lp_data).to be_a RubySMB::Dcerpc::Ndr::NdrLpByteArray
41
+ it 'is a Ndr::NdrByteArrayPtr structure' do
42
+ expect(packet.lp_data).to be_a RubySMB::Dcerpc::Ndr::NdrByteArrayPtr
56
43
  end
57
44
  end
58
45
 
59
46
  describe '#lpcb_data' do
60
- it 'is a NdrLpDword structure' do
61
- expect(packet.lpcb_data).to be_a RubySMB::Dcerpc::Ndr::NdrLpDword
62
- end
63
- end
64
-
65
- describe '#pad2' do
66
- it 'is a string' do
67
- expect(packet.pad2).to be_a BinData::String
68
- end
69
-
70
- it 'should keep #lpcb_data 4-byte aligned' do
71
- packet.lp_data = [1, 2]
72
- expect(packet.lpcb_data.abs_offset % 4).to eq 0
47
+ it 'is a Ndr::NdrUint32Ptr structure' do
48
+ expect(packet.lpcb_data).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
73
49
  end
74
50
  end
75
51
 
76
52
  describe '#lpcb_len' do
77
- it 'is a NdrLpDword structure' do
78
- expect(packet.lpcb_len).to be_a RubySMB::Dcerpc::Ndr::NdrLpDword
53
+ it 'is a Ndr::NdrUint32Ptr structure' do
54
+ expect(packet.lpcb_len).to be_a RubySMB::Dcerpc::Ndr::NdrUint32Ptr
79
55
  end
80
56
  end
81
57