winrm 2.3.0 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/lib/winrm/http/response_handler.rb +1 -1
  3. data/lib/winrm/http/transport.rb +2 -2
  4. data/lib/winrm/psrp/message.rb +128 -128
  5. data/lib/winrm/psrp/message_data/error_record.rb +2 -0
  6. data/lib/winrm/psrp/message_data/pipeline_output.rb +1 -1
  7. data/lib/winrm/psrp/message_factory.rb +14 -2
  8. data/lib/winrm/psrp/powershell_output_decoder.rb +142 -142
  9. data/lib/winrm/shells/base.rb +1 -0
  10. data/lib/winrm/shells/power_shell.rb +4 -4
  11. data/lib/winrm/version.rb +1 -1
  12. metadata +16 -90
  13. data/.gitignore +0 -10
  14. data/.rubocop.yml +0 -38
  15. data/.travis.yml +0 -10
  16. data/Gemfile +0 -2
  17. data/Rakefile +0 -33
  18. data/Vagrantfile +0 -6
  19. data/WinrmAppveyor.psm1 +0 -32
  20. data/appveyor.yml +0 -50
  21. data/changelog.md +0 -133
  22. data/preamble +0 -17
  23. data/tests/integration/auth_timeout_spec.rb +0 -17
  24. data/tests/integration/cmd_spec.rb +0 -130
  25. data/tests/integration/config-example.yml +0 -16
  26. data/tests/integration/issue_59_spec.rb +0 -25
  27. data/tests/integration/powershell_spec.rb +0 -164
  28. data/tests/integration/spec_helper.rb +0 -62
  29. data/tests/integration/transport_spec.rb +0 -98
  30. data/tests/integration/wql_spec.rb +0 -33
  31. data/tests/matchers.rb +0 -59
  32. data/tests/spec/configuration_spec.rb +0 -183
  33. data/tests/spec/connection_spec.rb +0 -37
  34. data/tests/spec/exception_spec.rb +0 -49
  35. data/tests/spec/http/transport_factory_spec.rb +0 -66
  36. data/tests/spec/http/transport_spec.rb +0 -43
  37. data/tests/spec/output_spec.rb +0 -128
  38. data/tests/spec/psrp/fragment_spec.rb +0 -60
  39. data/tests/spec/psrp/message_data/base_spec.rb +0 -11
  40. data/tests/spec/psrp/message_data/error_record_spec.rb +0 -39
  41. data/tests/spec/psrp/message_data/pipeline_host_call_spec.rb +0 -23
  42. data/tests/spec/psrp/message_data/pipeline_output_spec.rb +0 -30
  43. data/tests/spec/psrp/message_data/pipeline_state_spec.rb +0 -38
  44. data/tests/spec/psrp/message_data/runspace_pool_host_call_spec.rb +0 -23
  45. data/tests/spec/psrp/message_data/runspacepool_state_spec.rb +0 -14
  46. data/tests/spec/psrp/message_data/session_capability_spec.rb +0 -28
  47. data/tests/spec/psrp/message_data_spec.rb +0 -33
  48. data/tests/spec/psrp/message_defragmenter_spec.rb +0 -45
  49. data/tests/spec/psrp/message_fragmenter_spec.rb +0 -103
  50. data/tests/spec/psrp/powershell_output_decoder_spec.rb +0 -98
  51. data/tests/spec/psrp/psrp_message_spec.rb +0 -73
  52. data/tests/spec/psrp/recieve_response_reader_spec.rb +0 -170
  53. data/tests/spec/psrp/uuid_spec.rb +0 -28
  54. data/tests/spec/response_handler_spec.rb +0 -69
  55. data/tests/spec/shells/base_spec.rb +0 -227
  56. data/tests/spec/shells/cmd_spec.rb +0 -75
  57. data/tests/spec/shells/powershell_spec.rb +0 -221
  58. data/tests/spec/spec_helper.rb +0 -46
  59. data/tests/spec/stubs/clixml/error_record.xml.erb +0 -84
  60. data/tests/spec/stubs/clixml/pipeline_state.xml.erb +0 -88
  61. data/tests/spec/stubs/responses/get_command_output_response.xml.erb +0 -13
  62. data/tests/spec/stubs/responses/get_command_output_response_not_done.xml.erb +0 -10
  63. data/tests/spec/stubs/responses/get_omi_command_output_response.xml.erb +0 -23
  64. data/tests/spec/stubs/responses/get_omi_command_output_response_not_done.xml.erb +0 -24
  65. data/tests/spec/stubs/responses/get_omi_config_response.xml +0 -45
  66. data/tests/spec/stubs/responses/get_omi_powershell_keepalive_response.xml.erb +0 -33
  67. data/tests/spec/stubs/responses/get_powershell_keepalive_response.xml.erb +0 -10
  68. data/tests/spec/stubs/responses/get_powershell_output_response.xml.erb +0 -12
  69. data/tests/spec/stubs/responses/get_powershell_output_response_not_done.xml.erb +0 -9
  70. data/tests/spec/stubs/responses/open_shell_omi.xml +0 -43
  71. data/tests/spec/stubs/responses/open_shell_v1.xml +0 -19
  72. data/tests/spec/stubs/responses/open_shell_v2.xml +0 -20
  73. data/tests/spec/stubs/responses/soap_fault_omi.xml +0 -31
  74. data/tests/spec/stubs/responses/soap_fault_v1.xml +0 -36
  75. data/tests/spec/stubs/responses/soap_fault_v2.xml +0 -42
  76. data/tests/spec/stubs/responses/wmi_error_v2.xml +0 -41
  77. data/tests/spec/wsmv/cleanup_command_spec.rb +0 -20
  78. data/tests/spec/wsmv/close_shell_spec.rb +0 -15
  79. data/tests/spec/wsmv/command_output_decoder_spec.rb +0 -35
  80. data/tests/spec/wsmv/command_output_spec.rb +0 -43
  81. data/tests/spec/wsmv/command_spec.rb +0 -17
  82. data/tests/spec/wsmv/configuration_spec.rb +0 -15
  83. data/tests/spec/wsmv/create_pipeline_spec.rb +0 -30
  84. data/tests/spec/wsmv/create_shell_spec.rb +0 -39
  85. data/tests/spec/wsmv/init_runspace_pool_spec.rb +0 -38
  86. data/tests/spec/wsmv/keep_alive_spec.rb +0 -21
  87. data/tests/spec/wsmv/receive_response_reader_spec.rb +0 -124
  88. data/tests/spec/wsmv/send_data_spec.rb +0 -30
  89. data/tests/spec/wsmv/wql_query_spec.rb +0 -11
  90. data/tests/spec/wsmv/write_stdin_spec.rb +0 -20
  91. data/winrm.gemspec +0 -46
@@ -1,19 +0,0 @@
1
- <s:Envelope xml:lang='en-US' xmlns:s='http://www.w3.org/2003/05/soap-envelope' xmlns:a='http://schemas.xmlsoap.org/ws/2004/08/addressing' xmlns:w='http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd'>
2
- <s:Header>
3
- <a:Action>http://schemas.xmlsoap.org/ws/2004/09/transfer/CreateResponse</a:Action>
4
- <a:MessageID>uuid:94D35B73-3DD8-428D-9495-7AF3F0559428</a:MessageID>
5
- <a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
6
- <a:RelatesTo>uuid:EEF803CE-B9A6-48C1-BF00-90C6F077EC2A</a:RelatesTo>
7
- </s:Header>
8
- <s:Body>
9
- <x:ResourceCreated xmlns:w='http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd' xmlns:a='http://schemas.xmlsoap.org/ws/2004/08/addressing' xmlns:x='http://schemas.xmlsoap.org/ws/2004/09/transfer' xmlns:rsp='http://schemas.microsoft.com/wbem/wsman/1/windows/shell'>
10
- <a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
11
- <a:ReferenceParameters>
12
- <w:ResourceURI>http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd</w:ResourceURI>
13
- <w:SelectorSet>
14
- <w:Selector Name='ShellId'>uuid:739990FF-1492-4CDD-80BB-6E07ADB06D85</w:Selector>
15
- </w:SelectorSet>
16
- </a:ReferenceParameters>
17
- </x:ResourceCreated>
18
- </s:Body>
19
- </s:Envelope>
@@ -1,20 +0,0 @@
1
- <?xml version="1.0"?>
2
- <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:x="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:rsp="http://schemas.microsoft.com/wbem/wsman/1/windows/shell" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd" xml:lang="en-US">
3
- <s:Header>
4
- <a:Action>http://schemas.xmlsoap.org/ws/2004/09/transfer/CreateResponse</a:Action>
5
- <a:MessageID>uuid:9FF5B7FE-CC97-4FA4-B51F-E4220C016AE7</a:MessageID>
6
- <a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
7
- <a:RelatesTo>uuid:EA2A7785-D8E6-4E28-8AD8-FC27156537B3</a:RelatesTo>
8
- </s:Header>
9
- <s:Body>
10
- <x:ResourceCreated>
11
- <a:Address>http://localhost:5985/wsman</a:Address>
12
- <a:ReferenceParameters>
13
- <w:ResourceURI>http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd</w:ResourceURI>
14
- <w:SelectorSet>
15
- <w:Selector Name="ShellId">62DE33F0-8674-43D9-B6A5-3298012CC4CD</w:Selector>
16
- </w:SelectorSet>
17
- </a:ReferenceParameters>
18
- </x:ResourceCreated>
19
- </s:Body>
20
- </s:Envelope>
@@ -1,31 +0,0 @@
1
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
2
- xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
3
- xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration"
4
- xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"
5
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
- xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd"
7
- xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"
8
- xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer"
9
- xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common"
10
- xmlns:msftwinrm="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd"
11
- xmlns:wsmid="http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd">
12
- <SOAP-ENV:Header>
13
- <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
14
- <wsa:Action>http://schemas.dmtf.org/wbem/wsman/1/wsman/fault</wsa:Action>
15
- <wsa:MessageID>uuid:F803101F-76B9-0005-0000-000000010000</wsa:MessageID>
16
- <wsa:RelatesTo>uuid:AC61AF91-4AA9-428E-9294-670B4C5752A8</wsa:RelatesTo>
17
- </SOAP-ENV:Header>
18
- <SOAP-ENV:Body>
19
- <SOAP-ENV:Fault>
20
- <SOAP-ENV:Code>
21
- <SOAP-ENV:Value>SOAP-ENV:Receiver</SOAP-ENV:Value>
22
- <SOAP-ENV:Subcode>
23
- <SOAP-ENV:Value>wsman:InternalError</SOAP-ENV:Value>
24
- </SOAP-ENV:Subcode>
25
- </SOAP-ENV:Code>
26
- <SOAP-ENV:Reason>
27
- <SOAP-ENV:Text xml:lang="en-US">get-instance: instance name parameter is missing</SOAP-ENV:Text>
28
- </SOAP-ENV:Reason>
29
- </SOAP-ENV:Fault>
30
- </SOAP-ENV:Body>
31
- </SOAP-ENV:Envelope>
@@ -1,36 +0,0 @@
1
- <s:Envelope xml:lang='en-US' xmlns:s='http://www.w3.org/2003/05/soap-envelope' xmlns:a='http://schemas.xmlsoap.org/ws/2004/08/addressing' xmlns:x='http://schemas.xmlsoap.org/ws/2004/09/transfer' xmlns:e='http://schemas.xmlsoap.org/ws/2004/08/eventing' xmlns:n='http://schemas.xmlsoap.org/ws/2004/09/enumeration' xmlns:w='http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd'>
2
- <s:Header>
3
- <a:Action>http://schemas.xmlsoap.org/ws/2004/09/enumeration/fault</a:Action>
4
- <a:MessageID>uuid:AF8907B2-F47E-4DE5-A4AA-E1EC36EA0E49</a:MessageID>
5
- <a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
6
- <a:RelatesTo>uuid:B90EC4BB-4484-4ADA-920B-019517747915</a:RelatesTo>
7
- </s:Header>
8
- <s:Body>
9
- <s:Fault>
10
- <s:Code>
11
- <s:Value>s:Sender</s:Value>
12
- <s:Subcode>
13
- <s:Value>n:CannotProcessFilter</s:Value>
14
- </s:Subcode>
15
- </s:Code>
16
- <s:Reason>
17
- <s:Text xml:lang='en-US'>
18
- The data source could not process the filter. The filter might be
19
- missing or it might be invalid. Change the filter and try the request
20
- again.
21
- </s:Text>
22
- </s:Reason>
23
- <s:Detail>
24
- <f:WSManFault xmlns:f='http://schemas.microsoft.com/wbem/wsman/1/wsmanfault' Code='2150858778' Machine=''>
25
- <f:Message>
26
- <f:ProviderFault provider='WMIv1 plugin for Windows Remote Management ' path='%systemroot%\system32\WsmWmiPl.dll'>
27
- <f:WSManFault xmlns:f='http://schemas.microsoft.com/wbem/wsman/1/wsmanfault' Code='2150858778' Machine='' xml:lang='en-US'>
28
- <f:Message>The specified class does not exist in the given namespace. </f:Message>
29
- </f:WSManFault>
30
- </f:ProviderFault>
31
- </f:Message>
32
- </f:WSManFault>
33
- </s:Detail>
34
- </s:Fault>
35
- </s:Body>
36
- </s:Envelope>
@@ -1,42 +0,0 @@
1
- <?xml version="1.0"?>
2
- <s:Envelope xml:lang="en-US" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:n="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:x="http://schemas.xmlsoap.org/ws/2004/09/transfer">
3
- <s:Header>
4
- <a:Action>http://schemas.xmlsoap.org/ws/2004/09/enumeration/fault</a:Action>
5
- <a:MessageID>uuid:CC816664-896D-46C7-9227-AE6E1231CE49</a:MessageID>
6
- <a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
7
- <a:RelatesTo>uuid:0CB1C49A-5054-4C12-AF30-FC60BE995DD9</a:RelatesTo>
8
- </s:Header>
9
- <s:Body>
10
- <s:Fault>
11
- <s:Code>
12
- <s:Value>s:Sender</s:Value>
13
- <s:Subcode>
14
- <s:Value>n:CannotProcessFilter</s:Value>
15
- </s:Subcode>
16
- </s:Code>
17
- <s:Reason>
18
- <s:Text xml:lang="en-US">The data source could not process the filter. The filter might be missing or it might be invalid. Change the filter and try the request again. </s:Text>
19
- </s:Reason>
20
- <s:Detail>
21
- <f:WSManFault Code="2150858778" Machine="localhost" xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault">
22
- <f:Message>
23
- <f:ProviderFault path="%systemroot%\system32\WsmWmiPl.dll" provider="WMI Provider">
24
- <f:WSManFault Code="2150858778" Machine="vagrant-2008R2" xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault">
25
- <f:Message>The specified class does not exist in the given namespace. </f:Message>
26
- </f:WSManFault>
27
- <f:ExtendedError>
28
- <p:__ExtendedStatus xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/__ExtendedStatus" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="p:__ExtendedStatus_Type">
29
- <p:Description xsi:nil="true"/>
30
- <p:Operation>ExecQuery</p:Operation>
31
- <p:ParameterInfo>Select * from Win32_Processa where name=&quot;sshd.exe&quot;</p:ParameterInfo>
32
- <p:ProviderName>WinMgmt</p:ProviderName>
33
- <p:StatusCode xsi:nil="true"/>
34
- </p:__ExtendedStatus>
35
- </f:ExtendedError>
36
- </f:ProviderFault>
37
- </f:Message>
38
- </f:WSManFault>
39
- </s:Detail>
40
- </s:Fault>
41
- </s:Body>
42
- </s:Envelope>
@@ -1,41 +0,0 @@
1
- <s:Envelope xmlns:a='http://schemas.xmlsoap.org/ws/2004/08/addressing' xmlns:e='http://schemas.xmlsoap.org/ws/2004/08/eventing' xml:lang='en-US' xmlns:n='http://schemas.xmlsoap.org/ws/2004/09/enumeration' xmlns:p='http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd' xmlns:s='http://www.w3.org/2003/05/soap-envelope' xmlns:w='http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd' xmlns:x='http://schemas.xmlsoap.org/ws/2004/09/transfer'>
2
- <s:Header>
3
- <a:Action>http://schemas.dmtf.org/wbem/wsman/1/wsman/fault</a:Action>
4
- <a:MessageID>uuid:B8829021-48C3-4F27-B94B-491DAC4F29B1</a:MessageID>
5
- <a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
6
- </s:Header>
7
- <s:Body>
8
- <s:Fault>
9
- <s:Code>
10
- <s:Value>s:Sender</s:Value>
11
- <s:Subcode>
12
- <s:Value>w:QuotaLimit</s:Value>
13
- </s:Subcode>
14
- </s:Code>
15
- <s:Reason>
16
- <s:Text xml:lang='en-US'>The WS-Management service cannot process the request. The maximum number of concurrent shells for this user has been exceeded. Close existing shells or raise the quota for this user. </s:Text>
17
- </s:Reason>
18
- <s:Detail>
19
- <p:MSFT_WmiError b:IsCIM_Error='true' xmlns:b='http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd' xmlns:cim='http://schemas.dmtf.org/wbem/wscim/1/common' xmlns:p='http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/MSFT_WmiError' xsi:type='p:MSFT_WmiError_Type' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
20
- <p:CIMStatusCode xsi:type='cim:cimUnsignedInt'>27</p:CIMStatusCode>
21
- <p:CIMStatusCodeDescription xsi:nil='true' xsi:type='cim:cimString'/>
22
- <p:ErrorSource xsi:nil='true' xsi:type='cim:cimString'/>
23
- <p:ErrorSourceFormat xsi:type='cim:cimUnsignedShort'>0</p:ErrorSourceFormat>
24
- <p:ErrorType xsi:type='cim:cimUnsignedShort'>0</p:ErrorType>
25
- <p:Message xsi:type='cim:cimString'>The WS-Management service cannot process the request. This user is allowed a maximum number of 30 concurrent shells, which has been exceeded. Close existing shells or raise the quota for this user. </p:Message>
26
- <p:MessageID xsi:type='cim:cimString'>HRESULT 0x803381a5</p:MessageID>
27
- <p:OtherErrorSourceFormat xsi:nil='true' xsi:type='cim:cimString'/>
28
- <p:OtherErrorType xsi:nil='true' xsi:type='cim:cimString'/>
29
- <p:OwningEntity xsi:nil='true' xsi:type='cim:cimString'/>
30
- <p:PerceivedSeverity xsi:type='cim:cimUnsignedShort'>0</p:PerceivedSeverity>
31
- <p:ProbableCause xsi:type='cim:cimUnsignedShort'>0</p:ProbableCause>
32
- <p:ProbableCauseDescription xsi:nil='true' xsi:type='cim:cimString'/>
33
- <p:error_Category xsi:type='cim:cimUnsignedInt'>30</p:error_Category>
34
- <p:error_Code xsi:type='cim:cimUnsignedInt'>2150859173</p:error_Code>
35
- <p:error_Type xsi:type='cim:cimString'>HRESULT</p:error_Type>
36
- <p:error_WindowsErrorMessage xsi:type='cim:cimString'>The WS-Management service cannot process the request. This user is allowed a maximum number of 30 concurrent shells, which has been exceeded. Close existing shells or raise the quota for this user. </p:error_WindowsErrorMessage>
37
- </p:MSFT_WmiError>
38
- </s:Detail>
39
- </s:Fault>
40
- </s:Body>
41
- </s:Envelope>
@@ -1,20 +0,0 @@
1
- require 'winrm/wsmv/cleanup_command'
2
-
3
- describe WinRM::WSMV::CleanupCommand do
4
- context 'default session options' do
5
- let(:cmd_opts) do
6
- {
7
- shell_id: 'F4A2622B-B842-4EB8-8A78-0225C8A993DF',
8
- command_id: 'A2A2622B-B842-4EB8-8A78-0225C8A993DF'
9
- }
10
- end
11
- subject { described_class.new(default_connection_opts, cmd_opts) }
12
- let(:xml) { subject.build }
13
- it 'creates a well formed message' do
14
- expect(xml).to include('<w:OperationTimeout>PT60S</w:OperationTimeout>')
15
- expect(xml).to include('<rsp:Signal CommandId="A2A2622B-B842-4EB8-8A78-0225C8A993DF">' \
16
- '<rsp:Code>http://schemas.microsoft.com/wbem/wsman/1/windows/shell/signal/terminate' \
17
- '</rsp:Code></rsp:Signal>')
18
- end
19
- end
20
- end
@@ -1,15 +0,0 @@
1
- require 'winrm/wsmv/close_shell'
2
-
3
- describe WinRM::WSMV::CloseShell do
4
- context 'default session options' do
5
- subject do
6
- described_class.new(default_connection_opts, shell_id: 'F4A2622B-B842-4EB8-8A78-0225C8A993DF')
7
- end
8
- let(:xml) { subject.build }
9
- it 'creates a well formed message' do
10
- expect(xml).to include('<w:OperationTimeout>PT60S</w:OperationTimeout>')
11
- expect(xml).to include('<a:Action mustUnderstand="true">' \
12
- 'http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action>')
13
- end
14
- end
15
- end
@@ -1,35 +0,0 @@
1
- require 'winrm/wsmv/command_output_decoder'
2
-
3
- describe WinRM::WSMV::CommandOutputDecoder do
4
- let(:raw_output_with_bom) do
5
- '77u/' \
6
- 'ICAgQ29ubmVjdGlvbi1zcGVjaWZpYyBETlMgU3VmZml4ICAuIDogDQogICBMaW5rLWxvY2FsIElQdjYgQWRkcmVzcyA' \
7
- 'uIC4gLiAuIC4gOiBmZTgwOjo5MTFkOjE2OTQ6NTcwNDo1YjI5JTEyDQogICBJUHY0IEFkZHJlc3MuIC4gLiAuIC4gLi' \
8
- 'AuIC4gLiAuIC4gOiAxMC4wLjIuMTUNCiAgIFN1Ym5ldCBNYXNrIC4gLiAuIC4gLiAuIC4gLiAuIC4gLiA6IDI1NS4yN' \
9
- 'TUuMjU1LjANCiAgIERlZmF1bHQgR2F0ZXdheSAuIC4gLiAuIC4gLiAuIC4gLiA6IDEwLjAuMi4yDQoNClR1bm5lbCBh' \
10
- 'ZGFwdGVyIGlzYXRhcC57RjBENTY2RDgtNzlCMS00QUYwLUJENUQtMkM5RkVEOEI3MTE3fToNCg0KICAgTWVkaWEgU3R' \
11
- 'hdGUgLiAuIC4gLiAuIC4gLiAuIC4gLiAuIDogTWVkaWEgZGlzY29ubmVjdGVkDQogICBDb25uZWN0aW9uLXNwZWNpZm' \
12
- 'ljIEROUyBTdWZmaXggIC4gOiANCg0KVHVubmVsIGFkYXB0ZXIgVGVyZWRvIFR1bm5lbGluZyBQc2V1ZG8tSW50ZXJmY' \
13
- 'WNlOg0KDQogICBDb25uZWN0aW9uLXNwZWNpZmljIEROUyBTdWZmaXggIC4gOiANCiAgIElQdjYgQWRkcmVzcy4gLiAu' \
14
- 'IC4gLiAuIC4gLiAuIC4gLiA6IDIwMDE6MDo5ZDM4OjZhYmQ6NGJiOjI4YjU6ZjVmZjpmZGYwDQogICBMaW5rLWxvY2F' \
15
- 'sIElQdjYgQWRkcmVzcyAuIC4gLiAuIC4gOiBmZTgwOjo0YmI6MjhiNTpmNWZmOmZkZjAlMTQNCiAgIERlZmF1bHQgR2' \
16
- 'F0ZXdheSAuIC4gLiAuIC4gLiAuIC4gLiA6IDo6DQo='
17
- end
18
- let(:expected) do
19
- " Connection-specific DNS Suffix . : \r\n Link-local IPv6 Address . . . . . : fe80::911" \
20
- "d:1694:5704:5b29%12\r\n IPv4 Address. . . . . . . . . . . : 10.0.2.15\r\n Subnet Mask ." \
21
- " . . . . . . . . . . : 255.255.255.0\r\n Default Gateway . . . . . . . . . : 10.0.2.2\r\n" \
22
- "\r\nTunnel adapter isatap.{F0D566D8-79B1-4AF0-BD5D-2C9FED8B7117}:\r\n\r\n Media State . ." \
23
- " . . . . . . . . . : Media disconnected\r\n Connection-specific DNS Suffix . : \r\n\r\nT" \
24
- "unnel adapter Teredo Tunneling Pseudo-Interface:\r\n\r\n Connection-specific DNS Suffix " \
25
- ". : \r\n IPv6 Address. . . . . . . . . . . : 2001:0:9d38:6abd:4bb:28b5:f5ff:fdf0\r\n Li" \
26
- "nk-local IPv6 Address . . . . . : fe80::4bb:28b5:f5ff:fdf0%14\r\n Default Gateway . . . ." \
27
- " . . . . . : ::\r\n"
28
- end
29
- subject { described_class.new }
30
- context 'valid UTF-8 raw output' do
31
- it 'decodes' do
32
- expect(subject.decode(raw_output_with_bom)).to eq(expected)
33
- end
34
- end
35
- end
@@ -1,43 +0,0 @@
1
- require 'winrm/wsmv/command_output'
2
- require 'winrm/wsmv/header'
3
-
4
- describe WinRM::WSMV::CommandOutput do
5
- context 'default session options' do
6
- let(:cmd_out_opts) do
7
- {
8
- shell_id: 'F4A2622B-B842-4EB8-8A78-0225C8A993DF',
9
- command_id: 'A2A2622B-B842-4EB8-8A78-0225C8A993DF'
10
- }
11
- end
12
- subject { described_class.new(default_connection_opts, cmd_out_opts) }
13
- let(:xml) { subject.build }
14
- it 'creates a well formed message' do
15
- expect(xml).to include('<w:OperationTimeout>PT60S</w:OperationTimeout>')
16
- expect(xml).to include('<w:Option Name="WSMAN_CMDSHELL_OPTION_KEEPALIVE">TRUE</w:Option>')
17
- expect(xml).to include('w:ResourceURI mustUnderstand="true">' \
18
- 'http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd</w:ResourceURI>')
19
- expect(xml).to include('<rsp:DesiredStream ' \
20
- 'CommandId="A2A2622B-B842-4EB8-8A78-0225C8A993DF">stdout stderr</rsp:DesiredStream>')
21
- end
22
- end
23
- context 'powershell' do
24
- let(:cmd_out_opts) do
25
- {
26
- shell_id: 'F4A2622B-B842-4EB8-8A78-0225C8A993DF',
27
- command_id: 'A2A2622B-B842-4EB8-8A78-0225C8A993DF',
28
- shell_uri: WinRM::WSMV::Header::RESOURCE_URI_POWERSHELL,
29
- out_streams: %w[stdout]
30
- }
31
- end
32
- subject { described_class.new(default_connection_opts, cmd_out_opts) }
33
- let(:xml) { subject.build }
34
- it 'creates a well formed message' do
35
- expect(xml).to include('<w:OperationTimeout>PT60S</w:OperationTimeout>')
36
- expect(xml).to include('<w:Option Name="WSMAN_CMDSHELL_OPTION_KEEPALIVE">TRUE</w:Option>')
37
- expect(xml).to include('w:ResourceURI mustUnderstand="true">' \
38
- 'http://schemas.microsoft.com/powershell/Microsoft.PowerShell</w:ResourceURI>')
39
- expect(xml).to include('<rsp:DesiredStream ' \
40
- 'CommandId="A2A2622B-B842-4EB8-8A78-0225C8A993DF">stdout</rsp:DesiredStream>')
41
- end
42
- end
43
- end
@@ -1,17 +0,0 @@
1
- require 'winrm/wsmv/command'
2
-
3
- describe WinRM::WSMV::Command do
4
- context 'default session options' do
5
- let(:cmd_opts) do
6
- {
7
- shell_id: 'D5A2622B-B842-4EB8-8A78-0225C8A993DF',
8
- command: 'ipconfig'
9
- }
10
- end
11
- subject { described_class.new(default_connection_opts, cmd_opts) }
12
- let(:xml) { subject.build }
13
- it 'creates a well formed message' do
14
- expect(xml).to include('<w:OperationTimeout>PT60S</w:OperationTimeout>')
15
- end
16
- end
17
- end
@@ -1,15 +0,0 @@
1
- require 'winrm/wsmv/configuration'
2
-
3
- describe WinRM::WSMV::Configuration do
4
- subject do
5
- described_class.new(default_connection_opts)
6
- end
7
- let(:xml) { subject.build }
8
- it 'creates a well formed message' do
9
- expect(xml).to include('<w:OperationTimeout>PT60S</w:OperationTimeout>')
10
- expect(xml).to include('<a:Action mustUnderstand="true">' \
11
- 'http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>')
12
- expect(xml).to include('w:ResourceURI mustUnderstand="true">' \
13
- 'http://schemas.microsoft.com/wbem/wsman/1/config</w:ResourceURI>')
14
- end
15
- end
@@ -1,30 +0,0 @@
1
- require 'winrm/wsmv/create_pipeline'
2
-
3
- describe WinRM::WSMV::CreatePipeline do
4
- context 'default session options' do
5
- let(:shell_id) { 'D5A2622B-B842-4EB8-8A78-0225C8A993DF' }
6
- let(:command_id) { 'D5A2622B-B842-4EB8-8A78-0225C8A993DF' }
7
- let(:fragment) { WinRM::PSRP::Fragment.new(0, [1, 2, 3]) }
8
- let(:pipeline) { Base64.strict_encode64(fragment.bytes.pack('C*')) }
9
-
10
- subject do
11
- WinRM::WSMV::CreatePipeline.new(
12
- default_connection_opts,
13
- shell_id,
14
- command_id,
15
- fragment
16
- )
17
- end
18
- let(:xml) { subject.build }
19
- it 'creates a well formed message' do
20
- expect(xml).to include('<w:OperationTimeout>PT60S</w:OperationTimeout>')
21
- expect(xml).to include(
22
- '<w:SelectorSet><w:Selector Name="ShellId">' \
23
- "#{shell_id}</w:Selector></w:SelectorSet>"
24
- )
25
- expect(xml).to include("<rsp:CommandLine CommandId=\"#{command_id}\">")
26
- expect(xml).to include('<rsp:Command>Invoke-Expression</rsp:Command>')
27
- expect(xml).to include("<rsp:Arguments>#{pipeline}</rsp:Arguments>")
28
- end
29
- end
30
- end
@@ -1,39 +0,0 @@
1
- require 'winrm/wsmv/create_shell'
2
-
3
- describe WinRM::WSMV::CreateShell do
4
- context 'default session options' do
5
- subject { described_class.new(default_connection_opts) }
6
- let(:xml) { subject.build }
7
- it 'creates a well formed message' do
8
- expect(xml).to include('<w:OperationTimeout>PT60S</w:OperationTimeout>')
9
- expect(xml).to include('<w:Locale xml:lang="en-US" mustUnderstand="false"/>')
10
- expect(xml).to include('<p:DataLocale xml:lang="en-US" mustUnderstand="false"/>')
11
- expect(xml).to include(
12
- '<p:SessionId mustUnderstand="false">' \
13
- 'uuid:05A2622B-B842-4EB8-8A78-0225C8A993DF</p:SessionId>'
14
- )
15
- expect(xml).to include('<w:MaxEnvelopeSize mustUnderstand="true">153600</w:MaxEnvelopeSize>')
16
- expect(xml).to include('<a:To>http://localhost:5985/wsman</a:To>')
17
- expect(xml).to include('<rsp:InputStreams>stdin</rsp:InputStreams>')
18
- expect(xml).to include('<rsp:OutputStreams>stdout stderr</rsp:OutputStreams>')
19
- expect(xml).to include(
20
- '<w:ResourceURI mustUnderstand="true">' \
21
- 'http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd</w:ResourceURI>'
22
- )
23
- end
24
- context 'shell options w/env vars' do
25
- let(:shell_opts) do
26
- {
27
- env_vars: { 'FOO' => 'BAR' }
28
- }
29
- end
30
- subject { described_class.new(default_connection_opts, shell_opts) }
31
- let(:xml) { subject.build }
32
- it 'includes environemt vars' do
33
- expect(xml).to include(
34
- '<rsp:Environment><rsp:Variable Name="FOO">BAR</rsp:Variable></rsp:Environment>'
35
- )
36
- end
37
- end
38
- end
39
- end
@@ -1,38 +0,0 @@
1
- require 'winrm/wsmv/init_runspace_pool'
2
-
3
- describe WinRM::WSMV::InitRunspacePool do
4
- context 'default session options' do
5
- let(:shell_id) { SecureRandom.uuid.to_s.upcase }
6
- let(:payload) { 'blah'.bytes }
7
-
8
- subject { described_class.new(default_connection_opts, shell_id, payload) }
9
-
10
- it 'creates a well formed message' do
11
- xml = subject.build
12
- expect(xml).to include('<w:OperationTimeout>PT60S</w:OperationTimeout>')
13
- expect(xml).to include('<w:Locale xml:lang="en-US" mustUnderstand="false"/>')
14
- expect(xml).to include('<p:DataLocale xml:lang="en-US" mustUnderstand="false"/>')
15
- expect(xml).to include(
16
- '<p:SessionId mustUnderstand="false">' \
17
- 'uuid:05A2622B-B842-4EB8-8A78-0225C8A993DF</p:SessionId>'
18
- )
19
- expect(xml).to include('<w:MaxEnvelopeSize mustUnderstand="true">153600</w:MaxEnvelopeSize>')
20
- expect(xml).to include('<a:To>http://localhost:5985/wsman</a:To>')
21
- expect(xml).to include(
22
- '<w:OptionSet env:mustUnderstand="true">' \
23
- '<w:Option Name="protocolversion" MustComply="true">2.3</w:Option></w:OptionSet>'
24
- )
25
- expect(xml).to include('<rsp:InputStreams>stdin pr</rsp:InputStreams>')
26
- expect(xml).to include('<rsp:OutputStreams>stdout</rsp:OutputStreams>')
27
- expect(xml).to include("<rsp:Shell ShellId=\"#{subject.shell_id}\" Name=\"Runspace\">")
28
- expect(xml).to include(
29
- '<w:ResourceURI mustUnderstand="true">' \
30
- 'http://schemas.microsoft.com/powershell/Microsoft.PowerShell'
31
- )
32
- expect(xml).to include(
33
- '<creationXml xmlns="http://schemas.microsoft.com/powershell">' \
34
- "#{Base64.strict_encode64(payload.pack('C*'))}</creationXml>"
35
- )
36
- end
37
- end
38
- end