winrm 0.0.3 → 0.0.4
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.
- data/README +5 -2
- data/VERSION +1 -1
- data/lib/soap/winrm_service.rb +9 -1
- data/lib/winrm.rb +4 -0
- metadata +3 -11
data/README
CHANGED
@@ -38,8 +38,11 @@ require 'winrm'
|
|
38
38
|
WinRM::WinRM.endpoint = 'http://mywinrmhost:5985/wsman'
|
39
39
|
WinRM::WinRM.set_auth('user','password')
|
40
40
|
winrm = WinRM::WinRM.instance
|
41
|
-
|
42
|
-
|
41
|
+
outputps = winrm.powershell 'script.ps1'
|
42
|
+
outputcmd = winrm.cmd 'ipconfig'
|
43
|
+
|
44
|
+
To specify manually where your CA certificate store is use this:
|
45
|
+
WinRM::WinRM.set_ca_trust_path('/etc/ssl/certs')
|
43
46
|
|
44
47
|
--------------------------------------------------------------------------
|
45
48
|
DISCLAIMER: If you see something that could be done better or would like
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/lib/soap/winrm_service.rb
CHANGED
@@ -39,6 +39,10 @@ module WinRM
|
|
39
39
|
@@pass = pass
|
40
40
|
end
|
41
41
|
|
42
|
+
def self.set_ca_trust_path(file_or_dir)
|
43
|
+
@@ca_trust_store = file_or_dir
|
44
|
+
end
|
45
|
+
|
42
46
|
# Turn off parsing and just return the soap response
|
43
47
|
def self.raw_soap!
|
44
48
|
@@raw_soap = true
|
@@ -97,6 +101,7 @@ module WinRM
|
|
97
101
|
def on_after_create_http_request(req)
|
98
102
|
req.set_auth @@user, @@pass
|
99
103
|
req.set_header('Content-Type','application/soap+xml;charset=UTF-8')
|
104
|
+
req.set_trust_ca_file(@@ca_trust_store) if defined?(@@ca_trust_store)
|
100
105
|
#puts "SOAP DOCUMENT=\n#{req.body}"
|
101
106
|
end
|
102
107
|
|
@@ -237,8 +242,11 @@ module WinRM
|
|
237
242
|
script = script.chars.to_a.join("\x00").chomp
|
238
243
|
if(defined?(script.encode))
|
239
244
|
script = script.encode('ASCII-8BIT')
|
245
|
+
script = Base64.strict_encode64(script)
|
246
|
+
else
|
247
|
+
script = Base64.encode64(script).chomp
|
240
248
|
end
|
241
|
-
|
249
|
+
|
242
250
|
|
243
251
|
shell_id = open_shell
|
244
252
|
command_id = run_command(shell_id, "powershell -encodedCommand #{script}")
|
data/lib/winrm.rb
CHANGED
@@ -61,6 +61,10 @@ module WinRM
|
|
61
61
|
SOAP::WinRMWebService.set_auth(user,pass)
|
62
62
|
end
|
63
63
|
|
64
|
+
def self.set_ca_trust_path(path)
|
65
|
+
SOAP::WinRMWebService.set_ca_trust_path(path)
|
66
|
+
end
|
67
|
+
|
64
68
|
# Set the http driver that the SOAP back-end will use.
|
65
69
|
# @param [Symbol] driver The HTTP driver. Available drivers:
|
66
70
|
# :curb, :net_http, :http_client(Default)
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: winrm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 25
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Dan Wanek
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-09-
|
17
|
+
date: 2010-09-10 00:00:00 -05:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
@@ -26,7 +25,6 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
28
|
segments:
|
31
29
|
- 0
|
32
30
|
version: "0"
|
@@ -40,7 +38,6 @@ dependencies:
|
|
40
38
|
requirements:
|
41
39
|
- - ">="
|
42
40
|
- !ruby/object:Gem::Version
|
43
|
-
hash: 3
|
44
41
|
segments:
|
45
42
|
- 0
|
46
43
|
version: "0"
|
@@ -54,7 +51,6 @@ dependencies:
|
|
54
51
|
requirements:
|
55
52
|
- - ">="
|
56
53
|
- !ruby/object:Gem::Version
|
57
|
-
hash: 3
|
58
54
|
segments:
|
59
55
|
- 0
|
60
56
|
version: "0"
|
@@ -68,7 +64,6 @@ dependencies:
|
|
68
64
|
requirements:
|
69
65
|
- - ">="
|
70
66
|
- !ruby/object:Gem::Version
|
71
|
-
hash: 3
|
72
67
|
segments:
|
73
68
|
- 0
|
74
69
|
version: "0"
|
@@ -82,7 +77,6 @@ dependencies:
|
|
82
77
|
requirements:
|
83
78
|
- - ">="
|
84
79
|
- !ruby/object:Gem::Version
|
85
|
-
hash: 3
|
86
80
|
segments:
|
87
81
|
- 0
|
88
82
|
version: "0"
|
@@ -129,7 +123,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
123
|
requirements:
|
130
124
|
- - ">="
|
131
125
|
- !ruby/object:Gem::Version
|
132
|
-
hash: 57
|
133
126
|
segments:
|
134
127
|
- 1
|
135
128
|
- 8
|
@@ -140,7 +133,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
133
|
requirements:
|
141
134
|
- - ">="
|
142
135
|
- !ruby/object:Gem::Version
|
143
|
-
hash: 3
|
144
136
|
segments:
|
145
137
|
- 0
|
146
138
|
version: "0"
|