winrm 1.3.5 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,46 +1,49 @@
1
- # WinRM Gem Changelog
2
-
3
- # 1.3.5
4
- - Widen logging version constraints to include 2.0
5
- - Use codepage 65001 (UTF-8)
6
-
7
- # 1.3.4
8
- - Relaxed version pins on dev dependencies
9
-
10
- # 1.3.3
11
- - Fixed issue 133, rwinrm allow hostnames with dashes
12
- - Use duck typing for powershell script read
13
-
14
- # 1.3.2
15
- - Add spec.license attribute to gemspec
16
- - Bump RSpec dependency 3.0 to 3.2
17
-
18
- # 1.3.1
19
- - Fixed issue 129, long running commands could cause a stackoverflow exception
20
- - Fixed use of sub! in run_command results in spurious capture/replacement of \& sequences
21
- - Fixed issue 124 rwinrm won't take '.' characters in username
22
-
23
- # 1.3.0
24
- - Fixed multiple issues with WinRMHTTPTransportError incorrectly being raised
25
- - Refactored and added more unit and integration tests
26
- - Added ability to write to stdin
27
- - Added rwinrm binary to launch remote shell
28
- - Added WINRM_LOG env var to set log level
29
- - Retry Kerberos auth once if 401 response is received
30
- - Remove Savon dependency and use newer versions of underlying dependencies
31
- - Remove Nokogiri dependency and replace with native Ruby XML
32
- - Fixed issue 85, ensure WQL response is not nil
33
- - All WinRM library errors inherit from base class WinRMError
34
- - Integrations tests should now pass on Windows Server 2008+
35
- - Bump Ruby NTLM gem version dependency
36
- - HTTP client receive timeout is now configurable via set_timeout
37
- - Added backwards compatible Output class to make it easier to collect output
38
- - Bumped gssapi dependency from 1.0 to 1.2 and fixed issue 54
39
- - Added Rubocop to build
40
- - Fixed error when commands contain a newline character
41
-
42
- # 1.2.0
43
- - Allow user to disable SSL peer ceritifcate validation #44
44
- - Allow commands with "'" chars on Ruby 2.x, fixes #69
45
- - Fixed uninitialized constant Module::Kconv in Ruby 2.x, fixes #65
46
- - Commands with non-ASCII chars should work, #70
1
+ # WinRM Gem Changelog
2
+
3
+ # 1.3.6
4
+ - Remove BOM from response (Issue #159) added by Windows 2008R2
5
+
6
+ # 1.3.5
7
+ - Widen logging version constraints to include 2.0
8
+ - Use codepage 65001 (UTF-8)
9
+
10
+ # 1.3.4
11
+ - Relaxed version pins on dev dependencies
12
+
13
+ # 1.3.3
14
+ - Fixed issue 133, rwinrm allow hostnames with dashes
15
+ - Use duck typing for powershell script read
16
+
17
+ # 1.3.2
18
+ - Add spec.license attribute to gemspec
19
+ - Bump RSpec dependency 3.0 to 3.2
20
+
21
+ # 1.3.1
22
+ - Fixed issue 129, long running commands could cause a stackoverflow exception
23
+ - Fixed use of sub! in run_command results in spurious capture/replacement of \& sequences
24
+ - Fixed issue 124 rwinrm won't take '.' characters in username
25
+
26
+ # 1.3.0
27
+ - Fixed multiple issues with WinRMHTTPTransportError incorrectly being raised
28
+ - Refactored and added more unit and integration tests
29
+ - Added ability to write to stdin
30
+ - Added rwinrm binary to launch remote shell
31
+ - Added WINRM_LOG env var to set log level
32
+ - Retry Kerberos auth once if 401 response is received
33
+ - Remove Savon dependency and use newer versions of underlying dependencies
34
+ - Remove Nokogiri dependency and replace with native Ruby XML
35
+ - Fixed issue 85, ensure WQL response is not nil
36
+ - All WinRM library errors inherit from base class WinRMError
37
+ - Integrations tests should now pass on Windows Server 2008+
38
+ - Bump Ruby NTLM gem version dependency
39
+ - HTTP client receive timeout is now configurable via set_timeout
40
+ - Added backwards compatible Output class to make it easier to collect output
41
+ - Bumped gssapi dependency from 1.0 to 1.2 and fixed issue 54
42
+ - Added Rubocop to build
43
+ - Fixed error when commands contain a newline character
44
+
45
+ # 1.2.0
46
+ - Allow user to disable SSL peer ceritifcate validation #44
47
+ - Allow commands with "'" chars on Ruby 2.x, fixes #69
48
+ - Fixed uninitialized constant Module::Kconv in Ruby 2.x, fixes #65
49
+ - Commands with non-ASCII chars should work, #70
@@ -1,41 +1,41 @@
1
- # encoding: UTF-8
2
- #
3
- # Copyright 2010 Dan Wanek <dan.wanek@gmail.com>
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- require 'date'
18
- require 'logging'
19
-
20
- # Main WinRM module entry point
21
- module WinRM
22
- # Enable logging if it is requested. We do this before
23
- # anything else so that we can setup the output before
24
- # any logging occurs.
25
- if ENV['WINRM_LOG'] && ENV['WINRM_LOG'] != ''
26
- begin
27
- Logging.logger.root.level = ENV['WINRM_LOG']
28
- Logging.logger.root.appenders = Logging.appenders.stderr
29
- rescue ArgumentError
30
- # This means that the logging level wasn't valid
31
- $stderr.puts "Invalid WINRM_LOG level is set: #{ENV['WINRM_LOG']}"
32
- $stderr.puts ''
33
- $stderr.puts 'Please use one of the standard log levels: ' \
34
- 'debug, info, warn, or error'
35
- end
36
- end
37
- end
38
-
39
- require 'winrm/output'
40
- require 'winrm/helpers/iso8601_duration'
41
- require 'winrm/soap_provider'
1
+ # encoding: UTF-8
2
+ #
3
+ # Copyright 2010 Dan Wanek <dan.wanek@gmail.com>
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require 'date'
18
+ require 'logging'
19
+
20
+ # Main WinRM module entry point
21
+ module WinRM
22
+ # Enable logging if it is requested. We do this before
23
+ # anything else so that we can setup the output before
24
+ # any logging occurs.
25
+ if ENV['WINRM_LOG'] && ENV['WINRM_LOG'] != ''
26
+ begin
27
+ Logging.logger.root.level = ENV['WINRM_LOG']
28
+ Logging.logger.root.appenders = Logging.appenders.stderr
29
+ rescue ArgumentError
30
+ # This means that the logging level wasn't valid
31
+ $stderr.puts "Invalid WINRM_LOG level is set: #{ENV['WINRM_LOG']}"
32
+ $stderr.puts ''
33
+ $stderr.puts 'Please use one of the standard log levels: ' \
34
+ 'debug, info, warn, or error'
35
+ end
36
+ end
37
+ end
38
+
39
+ require 'winrm/output'
40
+ require 'winrm/helpers/iso8601_duration'
41
+ require 'winrm/soap_provider'
@@ -1,57 +1,57 @@
1
- # encoding: UTF-8
2
- #
3
- # Copyright 2010 Dan Wanek <dan.wanek@gmail.com>
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- module WinRM
18
- # WinRM base class for errors
19
- class WinRMError < StandardError; end
20
-
21
- # Authorization Error
22
- class WinRMAuthorizationError < WinRMError; end
23
-
24
- # A Fault returned in the SOAP response. The XML node is a WSManFault
25
- class WinRMWSManFault < WinRMError
26
- attr_reader :fault_code
27
- attr_reader :fault_description
28
-
29
- def initialize(fault_description, fault_code)
30
- @fault_description = fault_description
31
- @fault_code = fault_code
32
- super("[WSMAN ERROR CODE: #{fault_code}]: #{fault_description}")
33
- end
34
- end
35
-
36
- # A Fault returned in the SOAP response. The XML node is a MSFT_WmiError
37
- class WinRMWMIError < WinRMError
38
- attr_reader :error_code
39
- attr_reader :error
40
-
41
- def initialize(error, error_code)
42
- @error = error
43
- @error_code = error_code
44
- super("[WMI ERROR CODE: #{error_code}]: #{error}")
45
- end
46
- end
47
-
48
- # non-200 response without a SOAP fault
49
- class WinRMHTTPTransportError < WinRMError
50
- attr_reader :status_code
51
-
52
- def initialize(msg, status_code)
53
- @status_code = status_code
54
- super(msg + " (#{status_code}).")
55
- end
56
- end
57
- end
1
+ # encoding: UTF-8
2
+ #
3
+ # Copyright 2010 Dan Wanek <dan.wanek@gmail.com>
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ module WinRM
18
+ # WinRM base class for errors
19
+ class WinRMError < StandardError; end
20
+
21
+ # Authorization Error
22
+ class WinRMAuthorizationError < WinRMError; end
23
+
24
+ # A Fault returned in the SOAP response. The XML node is a WSManFault
25
+ class WinRMWSManFault < WinRMError
26
+ attr_reader :fault_code
27
+ attr_reader :fault_description
28
+
29
+ def initialize(fault_description, fault_code)
30
+ @fault_description = fault_description
31
+ @fault_code = fault_code
32
+ super("[WSMAN ERROR CODE: #{fault_code}]: #{fault_description}")
33
+ end
34
+ end
35
+
36
+ # A Fault returned in the SOAP response. The XML node is a MSFT_WmiError
37
+ class WinRMWMIError < WinRMError
38
+ attr_reader :error_code
39
+ attr_reader :error
40
+
41
+ def initialize(error, error_code)
42
+ @error = error
43
+ @error_code = error_code
44
+ super("[WMI ERROR CODE: #{error_code}]: #{error}")
45
+ end
46
+ end
47
+
48
+ # non-200 response without a SOAP fault
49
+ class WinRMHTTPTransportError < WinRMError
50
+ attr_reader :status_code
51
+
52
+ def initialize(msg, status_code)
53
+ @status_code = status_code
54
+ super(msg + " (#{status_code}).")
55
+ end
56
+ end
57
+ end
@@ -1,58 +1,58 @@
1
- # encoding: UTF-8
2
- #
3
- # Copyright 2010 Dan Wanek <dan.wanek@gmail.com>
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- # rubocop:disable Metrics/MethodLength
18
- # rubocop:disable Metrics/AbcSize
19
-
20
- # Format an ISO8601 Duration
21
- module Iso8601Duration
22
- # Convert the number of seconds to an ISO8601 duration format
23
- # @see http://tools.ietf.org/html/rfc2445#section-4.3.6
24
- # @param [Fixnum] seconds The amount of seconds for this duration
25
- def self.sec_to_dur(seconds)
26
- seconds = seconds.to_i
27
- iso_str = 'P'
28
- if seconds > 604_800 # more than a week
29
- weeks = seconds / 604_800
30
- seconds -= (604_800 * weeks)
31
- iso_str << "#{weeks}W"
32
- end
33
- if seconds > 86_400 # more than a day
34
- days = seconds / 86_400
35
- seconds -= (86_400 * days)
36
- iso_str << "#{days}D"
37
- end
38
- if seconds > 0
39
- iso_str << 'T'
40
- if seconds > 3600 # more than an hour
41
- hours = seconds / 3600
42
- seconds -= (3600 * hours)
43
- iso_str << "#{hours}H"
44
- end
45
- if seconds > 60 # more than a minute
46
- minutes = seconds / 60
47
- seconds -= (60 * minutes)
48
- iso_str << "#{minutes}M"
49
- end
50
- iso_str << "#{seconds}S"
51
- end
52
-
53
- iso_str
54
- end
55
- end
56
-
57
- # rubocop:enable Metrics/MethodLength
58
- # rubocop:enable Metrics/AbcSize
1
+ # encoding: UTF-8
2
+ #
3
+ # Copyright 2010 Dan Wanek <dan.wanek@gmail.com>
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # rubocop:disable Metrics/MethodLength
18
+ # rubocop:disable Metrics/AbcSize
19
+
20
+ # Format an ISO8601 Duration
21
+ module Iso8601Duration
22
+ # Convert the number of seconds to an ISO8601 duration format
23
+ # @see http://tools.ietf.org/html/rfc2445#section-4.3.6
24
+ # @param [Fixnum] seconds The amount of seconds for this duration
25
+ def self.sec_to_dur(seconds)
26
+ seconds = seconds.to_i
27
+ iso_str = 'P'
28
+ if seconds > 604_800 # more than a week
29
+ weeks = seconds / 604_800
30
+ seconds -= (604_800 * weeks)
31
+ iso_str << "#{weeks}W"
32
+ end
33
+ if seconds > 86_400 # more than a day
34
+ days = seconds / 86_400
35
+ seconds -= (86_400 * days)
36
+ iso_str << "#{days}D"
37
+ end
38
+ if seconds > 0
39
+ iso_str << 'T'
40
+ if seconds > 3600 # more than an hour
41
+ hours = seconds / 3600
42
+ seconds -= (3600 * hours)
43
+ iso_str << "#{hours}H"
44
+ end
45
+ if seconds > 60 # more than a minute
46
+ minutes = seconds / 60
47
+ seconds -= (60 * minutes)
48
+ iso_str << "#{minutes}M"
49
+ end
50
+ iso_str << "#{seconds}S"
51
+ end
52
+
53
+ iso_str
54
+ end
55
+ end
56
+
57
+ # rubocop:enable Metrics/MethodLength
58
+ # rubocop:enable Metrics/AbcSize
@@ -1,37 +1,37 @@
1
- # encoding: UTF-8
2
- #
3
- # Copyright 2014 Shawn Neal <sneal@sneal.net>
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- module WinRM
18
- # Wraps a PowerShell script to make it easy to Base64 encode for transport
19
- class PowershellScript
20
- attr_reader :text
21
-
22
- # Creates a new PowershellScript object which can be used to encode
23
- # PS scripts for safe transport over WinRM.
24
- # @param [String] The PS script text content
25
- def initialize(script)
26
- @text = script
27
- end
28
-
29
- # Encodes the script so that it can be passed to the PowerShell
30
- # --EncodedCommand argument.
31
- # @return [String] The UTF-16LE base64 encoded script
32
- def encoded
33
- encoded_script = text.encode('UTF-16LE', 'UTF-8')
34
- Base64.strict_encode64(encoded_script)
35
- end
36
- end
37
- end
1
+ # encoding: UTF-8
2
+ #
3
+ # Copyright 2014 Shawn Neal <sneal@sneal.net>
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ module WinRM
18
+ # Wraps a PowerShell script to make it easy to Base64 encode for transport
19
+ class PowershellScript
20
+ attr_reader :text
21
+
22
+ # Creates a new PowershellScript object which can be used to encode
23
+ # PS scripts for safe transport over WinRM.
24
+ # @param [String] The PS script text content
25
+ def initialize(script)
26
+ @text = script
27
+ end
28
+
29
+ # Encodes the script so that it can be passed to the PowerShell
30
+ # --EncodedCommand argument.
31
+ # @return [String] The UTF-16LE base64 encoded script
32
+ def encoded
33
+ encoded_script = text.encode('UTF-16LE', 'UTF-8')
34
+ Base64.strict_encode64(encoded_script)
35
+ end
36
+ end
37
+ end