vagrant-unbundled 2.1.4.0 → 2.2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +58 -1
  3. data/Gemfile.lock +9 -5
  4. data/contrib/bash/completion.sh +16 -2
  5. data/contrib/sudoers/osx +1 -1
  6. data/lib/vagrant/environment.rb +16 -21
  7. data/lib/vagrant/errors.rb +28 -0
  8. data/lib/vagrant/machine.rb +1 -1
  9. data/lib/vagrant/plugin/manager.rb +35 -1
  10. data/lib/vagrant/plugin/v2/trigger.rb +23 -0
  11. data/lib/vagrant/util/curl_helper.rb +96 -0
  12. data/lib/vagrant/util/downloader.rb +2 -79
  13. data/lib/vagrant/util/guest_inspection.rb +18 -5
  14. data/lib/vagrant/util/platform.rb +33 -8
  15. data/lib/vagrant/util/uploader.rb +103 -0
  16. data/lib/vagrant/vagrantfile.rb +5 -1
  17. data/lib/vagrant.rb +39 -13
  18. data/plugins/commands/cloud/auth/login.rb +90 -0
  19. data/plugins/commands/cloud/auth/logout.rb +42 -0
  20. data/plugins/commands/cloud/auth/plugin.rb +20 -0
  21. data/plugins/commands/cloud/auth/root.rb +73 -0
  22. data/plugins/commands/cloud/auth/whoami.rb +62 -0
  23. data/plugins/commands/cloud/box/create.rb +75 -0
  24. data/plugins/commands/cloud/box/delete.rb +65 -0
  25. data/plugins/commands/cloud/box/plugin.rb +19 -0
  26. data/plugins/commands/cloud/box/root.rb +77 -0
  27. data/plugins/commands/cloud/box/show.rb +74 -0
  28. data/plugins/commands/cloud/box/update.rb +71 -0
  29. data/plugins/commands/cloud/client/client.rb +264 -0
  30. data/plugins/commands/cloud/errors.rb +28 -0
  31. data/plugins/commands/cloud/list.rb +52 -0
  32. data/plugins/commands/cloud/locales/en.yml +159 -0
  33. data/plugins/commands/cloud/plugin.rb +30 -0
  34. data/plugins/commands/cloud/provider/create.rb +73 -0
  35. data/plugins/commands/cloud/provider/delete.rb +70 -0
  36. data/plugins/commands/cloud/provider/plugin.rb +19 -0
  37. data/plugins/commands/cloud/provider/root.rb +77 -0
  38. data/plugins/commands/cloud/provider/update.rb +73 -0
  39. data/plugins/commands/cloud/provider/upload.rb +75 -0
  40. data/plugins/commands/cloud/publish.rb +165 -0
  41. data/plugins/commands/cloud/root.rb +104 -0
  42. data/plugins/commands/cloud/search.rb +83 -0
  43. data/plugins/commands/cloud/util.rb +206 -0
  44. data/plugins/commands/cloud/version/create.rb +69 -0
  45. data/plugins/commands/cloud/version/delete.rb +68 -0
  46. data/plugins/commands/cloud/version/plugin.rb +19 -0
  47. data/plugins/commands/cloud/version/release.rb +69 -0
  48. data/plugins/commands/cloud/version/revoke.rb +69 -0
  49. data/plugins/commands/cloud/version/root.rb +81 -0
  50. data/plugins/commands/cloud/version/update.rb +69 -0
  51. data/plugins/commands/init/command.rb +1 -1
  52. data/plugins/commands/login/plugin.rb +4 -3
  53. data/plugins/commands/powershell/command.rb +3 -0
  54. data/plugins/commands/powershell/plugin.rb +1 -0
  55. data/plugins/commands/upload/command.rb +236 -0
  56. data/plugins/commands/upload/plugin.rb +17 -0
  57. data/plugins/commands/winrm/command.rb +69 -0
  58. data/plugins/commands/winrm/plugin.rb +17 -0
  59. data/plugins/commands/winrm_config/command.rb +125 -0
  60. data/plugins/commands/winrm_config/plugin.rb +17 -0
  61. data/plugins/guests/bsd/cap/file_system.rb +77 -0
  62. data/plugins/guests/bsd/plugin.rb +15 -0
  63. data/plugins/guests/linux/cap/file_system.rb +79 -0
  64. data/plugins/guests/linux/cap/network_interfaces.rb +13 -2
  65. data/plugins/guests/linux/plugin.rb +15 -0
  66. data/plugins/guests/redhat/cap/change_host_name.rb +21 -13
  67. data/plugins/guests/solaris/cap/file_system.rb +77 -0
  68. data/plugins/guests/solaris/plugin.rb +15 -0
  69. data/plugins/guests/windows/cap/file_system.rb +65 -0
  70. data/plugins/guests/windows/cap/mount_shared_folder.rb +1 -1
  71. data/plugins/guests/windows/plugin.rb +10 -0
  72. data/plugins/kernel_v2/config/vm.rb +3 -0
  73. data/plugins/kernel_v2/config/vm_trigger.rb +49 -1
  74. data/plugins/providers/docker/action/build.rb +23 -8
  75. data/plugins/providers/docker/action/is_build.rb +1 -1
  76. data/plugins/providers/docker/config.rb +50 -10
  77. data/plugins/providers/hyperv/scripts/configure_vm.ps1 +16 -2
  78. data/plugins/providers/virtualbox/action/match_mac_address.rb +8 -5
  79. data/plugins/providers/virtualbox/driver/version_5_0.rb +1 -0
  80. data/plugins/provisioners/ansible/provisioner/guest.rb +2 -8
  81. data/plugins/provisioners/puppet/provisioner/puppet.rb +4 -2
  82. data/plugins/provisioners/salt/bootstrap-salt.sh +1 -1
  83. data/plugins/provisioners/salt/provisioner.rb +19 -4
  84. data/plugins/synced_folders/rsync/helper.rb +2 -1
  85. data/templates/commands/ssh_config/config.erb +1 -1
  86. data/templates/commands/winrm_config/config.erb +11 -0
  87. data/templates/guests/openbsd/network_static6.erb +1 -0
  88. data/templates/locales/en.yml +60 -1
  89. data/templates/locales/providers_docker.yml +11 -3
  90. data/vagrant.gemspec +3 -1
  91. data/vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-94a9d31ba18b/vagrant-spec.gemspec +1 -1
  92. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/LICENSE +22 -0
  93. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/README.md +67 -0
  94. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/bin/vagrant_cloud +5 -0
  95. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/account.rb +190 -0
  96. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/box.rb +185 -0
  97. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/client.rb +73 -0
  98. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/errors.rb +25 -0
  99. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/provider.rb +149 -0
  100. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/search.rb +31 -0
  101. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/version.rb +188 -0
  102. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud.rb +11 -0
  103. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/.gitignore +10 -0
  104. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/.rubocop.yml +38 -0
  105. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/.travis.yml +10 -0
  106. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/Gemfile +2 -0
  107. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/LICENSE +202 -0
  108. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/README.md +276 -0
  109. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/Rakefile +33 -0
  110. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/Vagrantfile +6 -0
  111. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/WinrmAppveyor.psm1 +32 -0
  112. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/appveyor.yml +50 -0
  113. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/bin/rwinrm +90 -0
  114. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/changelog.md +133 -0
  115. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/connection.rb +84 -0
  116. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/connection_opts.rb +90 -0
  117. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/exceptions.rb +88 -0
  118. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/http/response_handler.rb +127 -0
  119. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/http/transport.rb +462 -0
  120. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/http/transport_factory.rb +64 -0
  121. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/output.rb +58 -0
  122. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/create_pipeline.xml.erb +167 -0
  123. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/fragment.rb +68 -0
  124. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/init_runspace_pool.xml.erb +224 -0
  125. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message.rb +128 -0
  126. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/base.rb +47 -0
  127. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/error_record.rb +66 -0
  128. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/pipeline_host_call.rb +30 -0
  129. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/pipeline_output.rb +48 -0
  130. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/pipeline_state.rb +38 -0
  131. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/runspacepool_host_call.rb +30 -0
  132. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/runspacepool_state.rb +37 -0
  133. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/session_capability.rb +34 -0
  134. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data.rb +40 -0
  135. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_defragmenter.rb +62 -0
  136. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_factory.rb +74 -0
  137. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_fragmenter.rb +58 -0
  138. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/powershell_output_decoder.rb +142 -0
  139. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/receive_response_reader.rb +95 -0
  140. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/session_capability.xml.erb +7 -0
  141. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/uuid.rb +39 -0
  142. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/shells/base.rb +187 -0
  143. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/shells/cmd.rb +63 -0
  144. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/shells/power_shell.rb +207 -0
  145. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/shells/retryable.rb +44 -0
  146. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/shells/shell_factory.rb +56 -0
  147. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/version.rb +5 -0
  148. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/base.rb +57 -0
  149. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/cleanup_command.rb +60 -0
  150. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/close_shell.rb +49 -0
  151. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/command.rb +100 -0
  152. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/command_output.rb +75 -0
  153. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/command_output_decoder.rb +54 -0
  154. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/configuration.rb +44 -0
  155. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/create_pipeline.rb +64 -0
  156. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/create_shell.rb +115 -0
  157. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/header.rb +213 -0
  158. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/init_runspace_pool.rb +96 -0
  159. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/iso8601_duration.rb +58 -0
  160. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/keep_alive.rb +66 -0
  161. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/receive_response_reader.rb +128 -0
  162. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/send_data.rb +66 -0
  163. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/soap.rb +49 -0
  164. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/wql_pull.rb +54 -0
  165. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/wql_query.rb +98 -0
  166. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/write_stdin.rb +86 -0
  167. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm.rb +37 -0
  168. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/preamble +17 -0
  169. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/auth_timeout_spec.rb +17 -0
  170. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/cmd_spec.rb +130 -0
  171. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/config-example.yml +16 -0
  172. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/issue_59_spec.rb +25 -0
  173. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/powershell_spec.rb +164 -0
  174. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/spec_helper.rb +62 -0
  175. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/transport_spec.rb +98 -0
  176. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/wql_spec.rb +33 -0
  177. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/matchers.rb +59 -0
  178. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/configuration_spec.rb +183 -0
  179. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/connection_spec.rb +37 -0
  180. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/exception_spec.rb +49 -0
  181. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/http/transport_factory_spec.rb +66 -0
  182. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/http/transport_spec.rb +43 -0
  183. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/output_spec.rb +128 -0
  184. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/fragment_spec.rb +60 -0
  185. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/base_spec.rb +11 -0
  186. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/error_record_spec.rb +39 -0
  187. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/pipeline_host_call_spec.rb +23 -0
  188. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/pipeline_output_spec.rb +30 -0
  189. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/pipeline_state_spec.rb +38 -0
  190. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/runspace_pool_host_call_spec.rb +23 -0
  191. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/runspacepool_state_spec.rb +14 -0
  192. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/session_capability_spec.rb +28 -0
  193. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data_spec.rb +33 -0
  194. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_defragmenter_spec.rb +45 -0
  195. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_fragmenter_spec.rb +103 -0
  196. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/powershell_output_decoder_spec.rb +98 -0
  197. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/psrp_message_spec.rb +73 -0
  198. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/recieve_response_reader_spec.rb +170 -0
  199. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/uuid_spec.rb +28 -0
  200. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/response_handler_spec.rb +69 -0
  201. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/shells/base_spec.rb +227 -0
  202. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/shells/cmd_spec.rb +75 -0
  203. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/shells/powershell_spec.rb +221 -0
  204. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/spec_helper.rb +46 -0
  205. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/clixml/error_record.xml.erb +84 -0
  206. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/clixml/pipeline_state.xml.erb +88 -0
  207. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_command_output_response.xml.erb +13 -0
  208. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_command_output_response_not_done.xml.erb +10 -0
  209. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_omi_command_output_response.xml.erb +23 -0
  210. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_omi_command_output_response_not_done.xml.erb +24 -0
  211. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_omi_config_response.xml +45 -0
  212. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_omi_powershell_keepalive_response.xml.erb +33 -0
  213. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_powershell_keepalive_response.xml.erb +10 -0
  214. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_powershell_output_response.xml.erb +12 -0
  215. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_powershell_output_response_not_done.xml.erb +9 -0
  216. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/open_shell_omi.xml +43 -0
  217. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/open_shell_v1.xml +19 -0
  218. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/open_shell_v2.xml +20 -0
  219. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/soap_fault_omi.xml +31 -0
  220. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/soap_fault_v1.xml +36 -0
  221. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/soap_fault_v2.xml +42 -0
  222. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/wmi_error_v2.xml +41 -0
  223. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/cleanup_command_spec.rb +20 -0
  224. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/close_shell_spec.rb +15 -0
  225. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/command_output_decoder_spec.rb +35 -0
  226. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/command_output_spec.rb +43 -0
  227. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/command_spec.rb +17 -0
  228. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/configuration_spec.rb +15 -0
  229. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/create_pipeline_spec.rb +30 -0
  230. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/create_shell_spec.rb +39 -0
  231. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/init_runspace_pool_spec.rb +38 -0
  232. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/keep_alive_spec.rb +21 -0
  233. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/receive_response_reader_spec.rb +124 -0
  234. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/send_data_spec.rb +30 -0
  235. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/wql_query_spec.rb +11 -0
  236. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/write_stdin_spec.rb +20 -0
  237. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/winrm.gemspec +46 -0
  238. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/.gitignore +11 -0
  239. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/.rspec +2 -0
  240. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/.rubocop.yml +17 -0
  241. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/.rubocop_todo.yml +65 -0
  242. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/.travis.yml +10 -0
  243. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/Gemfile +4 -0
  244. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/LICENSE +202 -0
  245. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/README.md +82 -0
  246. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/Rakefile +27 -0
  247. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/VERSION +1 -0
  248. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/Vagrantfile +8 -0
  249. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/appveyor.yml +38 -0
  250. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/bin/rwinrmcp +85 -0
  251. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/changelog.md +74 -0
  252. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/core/file_transporter.rb +566 -0
  253. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/core/tmp_zip.rb +176 -0
  254. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/exceptions.rb +27 -0
  255. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/file_manager.rb +156 -0
  256. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/check_files.ps1.erb +49 -0
  257. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/checksum.ps1.erb +13 -0
  258. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/create_dir.ps1.erb +6 -0
  259. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/delete.ps1.erb +6 -0
  260. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/download.ps1.erb +17 -0
  261. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/exists.ps1.erb +10 -0
  262. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/extract_files.ps1.erb +52 -0
  263. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/scripts.rb +31 -0
  264. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs.rb +27 -0
  265. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/config-example.yml +3 -0
  266. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/integration/file_manager_spec.rb +303 -0
  267. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/integration/tmp_zip_spec.rb +26 -0
  268. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/matchers.rb +57 -0
  269. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/spec_helper.rb +66 -0
  270. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/unit/tmp_zip_spec.rb +78 -0
  271. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/winrm-fs.gemspec +36 -0
  272. data/vendor/bundle/ruby/2.5.0/specifications/vagrant_cloud-2.0.1.gemspec +45 -0
  273. data/vendor/bundle/ruby/2.5.0/specifications/winrm-2.3.0.gemspec +73 -0
  274. data/vendor/bundle/ruby/2.5.0/specifications/winrm-fs-1.3.1.gemspec +57 -0
  275. data/version.txt +1 -1
  276. metadata +268 -4
@@ -0,0 +1,128 @@
1
+ describe WinRM::Output do
2
+ subject { WinRM::Output.new }
3
+
4
+ context 'when there is no output' do
5
+ describe '#stdout' do
6
+ it 'is empty' do
7
+ expect(subject.stdout).to be_empty
8
+ end
9
+ end
10
+
11
+ describe '#stderr' do
12
+ it 'is empty' do
13
+ expect(subject.stderr).to be_empty
14
+ end
15
+ end
16
+
17
+ describe '#output' do
18
+ it 'is empty' do
19
+ expect(subject.output).to be_empty
20
+ end
21
+ end
22
+ end
23
+
24
+ context 'when there is only one line' do
25
+ describe '#stdout' do
26
+ it 'is equal to that line' do
27
+ subject << { stdout: 'foo' }
28
+ expect(subject.stdout).to eq('foo')
29
+ end
30
+ end
31
+
32
+ describe '#stderr' do
33
+ it 'is equal to that line' do
34
+ subject << { stderr: 'foo' }
35
+ expect(subject.stderr).to eq('foo')
36
+ end
37
+ end
38
+
39
+ describe '#output' do
40
+ it 'is equal to stdout' do
41
+ subject << { stdout: 'foo' }
42
+ expect(subject.output).to eq('foo')
43
+ end
44
+
45
+ it 'is equal to stderr' do
46
+ subject << { stderr: 'foo' }
47
+ expect(subject.output).to eq('foo')
48
+ end
49
+ end
50
+ end
51
+
52
+ context 'when there is one line of each type' do
53
+ before(:each) do
54
+ subject << { stdout: 'foo' }
55
+ subject << { stderr: 'bar' }
56
+ end
57
+
58
+ describe '#stdout' do
59
+ it 'is equal to that line' do
60
+ expect(subject.stdout).to eq('foo')
61
+ end
62
+ end
63
+
64
+ describe '#stderr' do
65
+ it 'is equal to that line' do
66
+ expect(subject.stderr).to eq('bar')
67
+ end
68
+ end
69
+
70
+ describe '#output' do
71
+ it 'is equal to stdout + stderr' do
72
+ expect(subject.output).to eq('foobar')
73
+ end
74
+ end
75
+ end
76
+
77
+ context 'when there are multiple lines' do
78
+ before(:each) do
79
+ subject << { stdout: 'I can have a newline\nanywhere, ' }
80
+ subject << { stderr: 'I can also have stderr' }
81
+ subject << { stdout: 'or stdout', stderr: ' and stderr' }
82
+ subject << {}
83
+ subject << { stdout: ' or nothing! (above)' }
84
+ end
85
+
86
+ describe '#stdout' do
87
+ it 'is equal to that line' do
88
+ expect(subject.stdout).to eq(
89
+ 'I can have a newline\nanywhere, or stdout or nothing! (above)'
90
+ )
91
+ end
92
+ end
93
+
94
+ describe '#stderr' do
95
+ it 'is equal to that line' do
96
+ expect(subject.stderr).to eq('I can also have stderr and stderr')
97
+ end
98
+ end
99
+
100
+ describe '#output' do
101
+ it 'is equal to stdout + stderr' do
102
+ expect(subject.output).to eq(
103
+ 'I can have a newline\nanywhere, I can also have stderror stdout ' \
104
+ 'and stderr or nothing! (above)'
105
+ )
106
+ end
107
+ end
108
+ end
109
+
110
+ describe '#exitcode' do
111
+ let(:exitcode) { 0 }
112
+
113
+ context 'when a valid exit code is set' do
114
+ it 'sets the exit code' do
115
+ subject.exitcode = exitcode
116
+ expect(subject.exitcode).to eq exitcode
117
+ end
118
+ end
119
+
120
+ context 'when an invalid exit code is set' do
121
+ let(:exitcode) { 'bad' }
122
+
123
+ it 'sets the exit code' do
124
+ expect { subject.exitcode = exitcode }.to raise_error WinRM::InvalidExitCode
125
+ end
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,60 @@
1
+ require 'winrm/psrp/fragment'
2
+
3
+ describe WinRM::PSRP::Fragment do
4
+ let(:id) { 1 }
5
+ let(:message) { 'blah blah blah' }
6
+
7
+ context 'called with just id and blob' do
8
+ subject { described_class.new(id, message.bytes) }
9
+
10
+ it 'sets the message id to 1' do
11
+ expect(subject.bytes[0..7]).to eq([0, 0, 0, 0, 0, 0, 0, id])
12
+ end
13
+ it 'sets the fragment id to 0' do
14
+ expect(subject.bytes[8..15]).to eq([0, 0, 0, 0, 0, 0, 0, 0])
15
+ end
16
+ it 'sets the last 2 bits of the end/start fragment' do
17
+ expect(subject.bytes[16]).to eq(3)
18
+ end
19
+ it 'sets message blob length to 3640' do
20
+ expect(subject.bytes[17..20]).to eq([0, 0, 0, message.bytes.length])
21
+ end
22
+ it 'sets message blob' do
23
+ expect(subject.bytes[21..-1]).to eq(message.bytes)
24
+ end
25
+ end
26
+
27
+ context 'specifying a fragment id' do
28
+ let(:fragment_id) { 1 }
29
+
30
+ subject { described_class.new(id, message.bytes, fragment_id) }
31
+
32
+ it 'sets the fragment id' do
33
+ expect(subject.bytes[8..15]).to eq([0, 0, 0, 0, 0, 0, 0, fragment_id])
34
+ end
35
+ end
36
+
37
+ context 'middle fragment' do
38
+ subject { described_class.new(id, message.bytes, 1, false, false) }
39
+
40
+ it 'sets the last 2 bits of the end/start fragment to 0' do
41
+ expect(subject.bytes[16]).to eq(0)
42
+ end
43
+ end
44
+
45
+ context 'end fragment' do
46
+ subject { described_class.new(id, message.bytes, 1, true, false) }
47
+
48
+ it 'sets the end fragment bit' do
49
+ expect(subject.bytes[16]).to eq(1)
50
+ end
51
+ end
52
+
53
+ context 'start fragment' do
54
+ subject { described_class.new(id, message.bytes, 1, false, true) }
55
+
56
+ it 'sets the start fragment bit' do
57
+ expect(subject.bytes[16]).to eq(2)
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,11 @@
1
+ require 'winrm/psrp/message_data/base'
2
+
3
+ describe WinRM::PSRP::MessageData::Base do
4
+ let(:raw_data) { 'raw_data' }
5
+
6
+ subject { WinRM::PSRP::MessageData::Base.new(raw_data) }
7
+
8
+ it 'holds raw message data' do
9
+ expect(subject.raw).to eq(raw_data)
10
+ end
11
+ end
@@ -0,0 +1,39 @@
1
+ require 'winrm/psrp/message_data/base'
2
+ require 'winrm/psrp/message_data/error_record'
3
+
4
+ describe WinRM::PSRP::MessageData::ErrorRecord do
5
+ let(:test_data_xml_template) do
6
+ ERB.new(stubbed_clixml('error_record.xml.erb'))
7
+ end
8
+ let(:error_message) { 'an error' }
9
+ let(:script_root) { 'script_root' }
10
+ let(:category_message) { 'category message' }
11
+ let(:stack_trace) { 'stack trace' }
12
+ let(:error_id) { 'Microsoft.PowerShell.Commands.WriteErrorException' }
13
+ let(:raw_data) { test_data_xml_template.result(binding) }
14
+ subject { described_class.new(raw_data) }
15
+
16
+ it 'returns the exception' do
17
+ expect(subject.exception[:message]).to eq(error_message)
18
+ end
19
+
20
+ it 'returns the FullyQualifiedErrorId' do
21
+ expect(subject.fully_qualified_error_id).to eq(error_id)
22
+ end
23
+
24
+ it 'returns the invocation info' do
25
+ expect(subject.invocation_info[:line]).to eq("write-error '#{error_message}'")
26
+ end
27
+
28
+ it 'converts camel case properties to underscore' do
29
+ expect(subject.invocation_info[:ps_script_root]).to eq(script_root)
30
+ end
31
+
32
+ it 'returns the error category message' do
33
+ expect(subject.error_category_message).to eq(category_message)
34
+ end
35
+
36
+ it 'returns the script stack trace' do
37
+ expect(subject.error_details_script_stack_trace).to eq(stack_trace)
38
+ end
39
+ end
@@ -0,0 +1,23 @@
1
+ require 'winrm/psrp/message_data/base'
2
+ require 'winrm/psrp/message_data/pipeline_host_call'
3
+
4
+ describe WinRM::PSRP::MessageData::PipelineHostCall do
5
+ let(:raw_data) do
6
+ "\xEF\xBB\xBF<Obj RefId=\"0\"><MS><I64 N=\"ci\">-100</I64><Obj N=\"mi\" RefId=\"1\">"\
7
+ '<TN RefId="0"><T>System.Management.Automation.Remoting.RemoteHostMethodId</T>'\
8
+ '<T>System.Enum</T><T>System.ValueType</T><T>System.Object</T></TN>'\
9
+ '<ToString>WriteLine3</ToString><I32>17</I32></Obj><Obj N="mp" RefId="2">'\
10
+ '<TN RefId="1"><T>System.Collections.ArrayList</T><T>System.Object</T></TN><LST>'\
11
+ '<I32>7</I32><I32>0</I32><S>hello</S></LST></Obj></MS></Obj>'
12
+ end
13
+
14
+ subject { described_class.new(raw_data) }
15
+
16
+ it 'parses method identifier' do
17
+ expect(subject.method_identifier).to eq('WriteLine3')
18
+ end
19
+
20
+ it 'parses method parameters' do
21
+ expect(subject.method_parameters[:s]).to eq('hello')
22
+ end
23
+ end
@@ -0,0 +1,30 @@
1
+ require 'winrm/psrp/message_data/base'
2
+ require 'winrm/psrp/message_data/pipeline_output'
3
+
4
+ describe WinRM::PSRP::MessageData::PipelineOutput do
5
+ subject { described_class.new(raw_data) }
6
+
7
+ context 'receiving output with BOM and no new line' do
8
+ let(:raw_data) { "\xEF\xBB\xBF<obj><S>some data</S></obj>" }
9
+
10
+ it 'output removes BOM and adds newline' do
11
+ expect(subject.output).to eq("some data\r\n")
12
+ end
13
+ end
14
+
15
+ context 'receiving output with encoded new line' do
16
+ let(:raw_data) { '<obj><S>some data_x000D__x000A_</S></obj>' }
17
+
18
+ it 'decodes without double newline' do
19
+ expect(subject.output).to eq("some data\r\n")
20
+ end
21
+ end
22
+
23
+ context 'receiving output with new line in middle' do
24
+ let(:raw_data) { '<obj><S>some_x000D__x000A_data</S></obj>' }
25
+
26
+ it 'decodes and replaces newline' do
27
+ expect(subject.output).to eq("some\r\ndata\r\n")
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,38 @@
1
+ require 'winrm/psrp/message_data/base'
2
+ require 'winrm/psrp/message_data/pipeline_state'
3
+
4
+ describe WinRM::PSRP::MessageData::PipelineState do
5
+ let(:test_data_xml_template) do
6
+ ERB.new(stubbed_clixml('pipeline_state.xml.erb'))
7
+ end
8
+ let(:pipeline_state) { WinRM::PSRP::MessageData::PipelineState::FAILED }
9
+ let(:error_message) { 'an error occured' }
10
+ let(:category_message) { 'category message' }
11
+ let(:error_id) { 'an error occured' }
12
+ let(:raw_data) { test_data_xml_template.result(binding) }
13
+ subject { described_class.new(raw_data) }
14
+
15
+ it 'returns the state' do
16
+ expect(subject.pipeline_state).to eq(pipeline_state)
17
+ end
18
+
19
+ it 'returns the exception' do
20
+ expect(subject.exception_as_error_record.exception[:message]).to eq(error_message)
21
+ end
22
+
23
+ it 'returns the FullyQualifiedErrorId' do
24
+ expect(subject.exception_as_error_record.fully_qualified_error_id).to eq(error_id)
25
+ end
26
+
27
+ it 'returns the error category message' do
28
+ expect(subject.exception_as_error_record.error_category_message).to eq(category_message)
29
+ end
30
+
31
+ context 'state is not failed' do
32
+ let(:pipeline_state) { WinRM::PSRP::MessageData::PipelineState::COMPLETED }
33
+
34
+ it 'has a nil exception' do
35
+ expect(subject.exception_as_error_record).to be(nil)
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,23 @@
1
+ require 'winrm/psrp/message_data/base'
2
+ require 'winrm/psrp/message_data/runspacepool_host_call'
3
+
4
+ describe WinRM::PSRP::MessageData::RunspacepoolHostCall do
5
+ let(:raw_data) do
6
+ "\xEF\xBB\xBF<Obj RefId=\"0\"><MS><I64 N=\"ci\">-100</I64><Obj N=\"mi\" RefId=\"1\">"\
7
+ '<TN RefId="0"><T>System.Management.Automation.Remoting.RemoteHostMethodId</T>'\
8
+ '<T>System.Enum</T><T>System.ValueType</T><T>System.Object</T></TN>'\
9
+ '<ToString>WriteLine3</ToString><I32>17</I32></Obj><Obj N="mp" RefId="2">'\
10
+ '<TN RefId="1"><T>System.Collections.ArrayList</T><T>System.Object</T></TN><LST>'\
11
+ '<I32>7</I32><I32>0</I32><S>hello</S></LST></Obj></MS></Obj>'
12
+ end
13
+
14
+ subject { described_class.new(raw_data) }
15
+
16
+ it 'parses method identifier' do
17
+ expect(subject.method_identifier).to eq('WriteLine3')
18
+ end
19
+
20
+ it 'parses method parameters' do
21
+ expect(subject.method_parameters[:s]).to eq('hello')
22
+ end
23
+ end
@@ -0,0 +1,14 @@
1
+ require 'winrm/psrp/message_data/base'
2
+ require 'winrm/psrp/message_data/runspacepool_state'
3
+
4
+ describe WinRM::PSRP::MessageData::RunspacepoolState do
5
+ let(:raw_data) do
6
+ "\xEF\xBB\xBF<Obj RefId=\"0\"><MS><I32 N=\"RunspaceState\">2</I32></MS></Obj>"
7
+ end
8
+
9
+ subject { described_class.new(raw_data) }
10
+
11
+ it 'parses runspace state' do
12
+ expect(subject.runspace_state).to eq(WinRM::PSRP::MessageData::RunspacepoolState::OPENED)
13
+ end
14
+ end
@@ -0,0 +1,28 @@
1
+ require 'winrm/psrp/message_data/base'
2
+ require 'winrm/psrp/message_data/session_capability'
3
+
4
+ describe WinRM::PSRP::MessageData::SessionCapability do
5
+ let(:protocol_version) { '2.2' }
6
+ let(:ps_version) { '2.0' }
7
+ let(:serialization_version) { '1.1.0.1' }
8
+ let(:raw_data) do
9
+ "\xEF\xBB\xBF<Obj RefId=\"0\"><MS>"\
10
+ "<Version N=\"protocolversion\">#{protocol_version}</Version>"\
11
+ "<Version N=\"PSVersion\">#{ps_version}</Version>"\
12
+ "<Version N=\"SerializationVersion\">#{serialization_version}</Version></MS></Obj>"
13
+ end
14
+
15
+ subject { described_class.new(raw_data) }
16
+
17
+ it 'parses protocol version' do
18
+ expect(subject.protocol_version).to eq(protocol_version)
19
+ end
20
+
21
+ it 'parses ps version' do
22
+ expect(subject.ps_version).to eq(ps_version)
23
+ end
24
+
25
+ it 'parses serialization version' do
26
+ expect(subject.serialization_version).to eq(serialization_version)
27
+ end
28
+ end
@@ -0,0 +1,33 @@
1
+ require 'winrm/psrp/message'
2
+ require 'winrm/psrp/message_data'
3
+
4
+ describe WinRM::PSRP::MessageData do
5
+ describe '#parse' do
6
+ let(:raw_data) { 'raw_data' }
7
+ let(:message) do
8
+ WinRM::PSRP::Message.new(
9
+ '00000000-0000-0000-0000-000000000000',
10
+ message_type,
11
+ raw_data
12
+ )
13
+ end
14
+
15
+ subject { WinRM::PSRP::MessageData.parse(message) }
16
+
17
+ context 'defined message type' do
18
+ let(:message_type) { WinRM::PSRP::Message::MESSAGE_TYPES[:pipeline_output] }
19
+
20
+ it 'creates correct message data type' do
21
+ expect(subject).to be_a(WinRM::PSRP::MessageData::PipelineOutput)
22
+ end
23
+ end
24
+
25
+ context 'undefined message type' do
26
+ let(:message_type) { WinRM::PSRP::Message::MESSAGE_TYPES[:pipeline_input] }
27
+
28
+ it 'returns nill' do
29
+ expect(subject).to be nil
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,45 @@
1
+ require 'winrm/psrp/message_defragmenter'
2
+
3
+ describe WinRM::PSRP::MessageDefragmenter do
4
+ context 'a real life fragment' do
5
+ let(:bytes) do
6
+ "\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x01\x03\x00\x00\x00I\x01"\
7
+ "\x00\x00\x00\x04\x10\x04\x00Kk/=Z\xD3-E\x81v\xA0+6\xB1\xD3\x88\n\xED\x90\x9Cj\xE7PG"\
8
+ "\x9F\xA2\xB2\xC99to9\xEF\xBB\xBF<S>some data_x000D__x000A_</S>".to_byte_string
9
+ end
10
+ subject { described_class.new.defragment(Base64.encode64(bytes)) }
11
+
12
+ it 'parses the data' do
13
+ expect(subject.data).to eq("\xEF\xBB\xBF<S>some data_x000D__x000A_</S>".to_byte_string)
14
+ end
15
+
16
+ it 'parses the destination' do
17
+ expect(subject.destination).to eq(1)
18
+ end
19
+
20
+ it 'parses the message type' do
21
+ expect(subject.type).to eq(WinRM::PSRP::Message::MESSAGE_TYPES[:pipeline_output])
22
+ end
23
+ end
24
+
25
+ context 'multiple fragments' do
26
+ let(:blob) do
27
+ WinRM::PSRP::Message.new(
28
+ 'bc1bfbba-8215-4a04-b2df-7a3ac0310e16',
29
+ WinRM::PSRP::Message::MESSAGE_TYPES[:session_capability],
30
+ 'This is a fragmented message'
31
+ )
32
+ end
33
+ let(:fragment1) { WinRM::PSRP::Fragment.new(1, blob.bytes[0..5], 0, true, false) }
34
+ let(:fragment2) { WinRM::PSRP::Fragment.new(1, blob.bytes[6..10], 1, false, false) }
35
+ let(:fragment3) { WinRM::PSRP::Fragment.new(1, blob.bytes[11..-1], 2, false, true) }
36
+
37
+ it 'pieces the message together' do
38
+ subject.defragment(Base64.strict_encode64(fragment1.bytes.pack('C*')))
39
+ subject.defragment(Base64.strict_encode64(fragment2.bytes.pack('C*')))
40
+ message = subject.defragment(Base64.strict_encode64(fragment3.bytes.pack('C*')))
41
+
42
+ expect(message.data[3..-1]).to eq(blob.data)
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,103 @@
1
+ require 'winrm/psrp/message'
2
+ require 'winrm/psrp/message_fragmenter'
3
+
4
+ describe WinRM::PSRP::MessageFragmenter do
5
+ let(:message) do
6
+ WinRM::PSRP::Message.new(
7
+ 'bc1bfbba-8215-4a04-b2df-7a3ac0310e16',
8
+ WinRM::PSRP::Message::MESSAGE_TYPES[:session_capability],
9
+ data
10
+ )
11
+ end
12
+
13
+ subject do
14
+ fragmenter = described_class.new(45)
15
+ fragments = []
16
+ fragmenter.fragment(message) do |fragment|
17
+ fragments.push(fragment)
18
+ end
19
+ fragments
20
+ end
21
+
22
+ context 'one fragment' do
23
+ let(:data) { 'th' }
24
+
25
+ it 'returns 1 fragment' do
26
+ expect(subject.length).to eq(1)
27
+ end
28
+
29
+ it 'has blob data equal to the message bytes' do
30
+ expect(subject[0].blob.length).to eq(message.bytes.length)
31
+ end
32
+
33
+ it 'identifies the fragment as start and end' do
34
+ expect(subject[0].start_fragment).to eq(true)
35
+ expect(subject[0].end_fragment).to eq(true)
36
+ end
37
+
38
+ it 'assigns fragment id correctly' do
39
+ expect(subject[0].fragment_id).to eq(0)
40
+ end
41
+ end
42
+
43
+ context 'two fragments' do
44
+ let(:data) { 'This is a fragmented message' }
45
+
46
+ it 'splits the message' do
47
+ expect(subject.length).to eq(2)
48
+ end
49
+
50
+ it 'has a sum of blob data equal to the message bytes' do
51
+ expect(subject[0].blob.length + subject[1].blob.length).to eq(message.bytes.length)
52
+ end
53
+
54
+ it 'identifies the first fragment as start and not end' do
55
+ expect(subject[0].start_fragment).to eq(true)
56
+ expect(subject[0].end_fragment).to eq(false)
57
+ end
58
+
59
+ it 'identifies the first fragment as start and not end' do
60
+ expect(subject[1].start_fragment).to eq(false)
61
+ expect(subject[1].end_fragment).to eq(true)
62
+ end
63
+
64
+ it 'assigns incementing fragment ids' do
65
+ expect(subject[0].fragment_id).to eq(0)
66
+ expect(subject[1].fragment_id).to eq(1)
67
+ end
68
+ end
69
+
70
+ context 'three fragments' do
71
+ let(:data) { 'This is a fragmented message because framents are lovely' }
72
+
73
+ it 'splits the message' do
74
+ expect(subject.length).to eq(3)
75
+ end
76
+
77
+ it 'has a sum of blob data equal to the message bytes' do
78
+ expect(subject[0].blob.length + subject[1].blob.length + subject[2].blob.length)
79
+ .to eq(message.bytes.length)
80
+ end
81
+
82
+ it 'identifies the first fragment as start and not end' do
83
+ expect(subject[0].start_fragment).to eq(true)
84
+ expect(subject[0].end_fragment).to eq(false)
85
+ end
86
+
87
+ it 'identifies the first fragment as start and not end' do
88
+ expect(subject[1].start_fragment).to eq(false)
89
+ expect(subject[1].end_fragment).to eq(false)
90
+ end
91
+
92
+ it 'identifies the third fragment as not start and end' do
93
+ expect(subject[2].start_fragment).to eq(false)
94
+ expect(subject[2].end_fragment).to eq(true)
95
+ end
96
+
97
+ it 'assigns incementing fragment ids' do
98
+ expect(subject[0].fragment_id).to eq(0)
99
+ expect(subject[1].fragment_id).to eq(1)
100
+ expect(subject[2].fragment_id).to eq(2)
101
+ end
102
+ end
103
+ end