winrm-elevated 1.2.2 → 1.2.3
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.
- checksums.yaml +4 -4
- data/lib/winrm-elevated/scripts/elevated_shell.ps1 +20 -6
- data/lib/winrm/shells/elevated.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee0adbdb22c257558248a863ab41505ef63bbe664150084be3cd57ecc56eef3e
|
|
4
|
+
data.tar.gz: d3442d4883f6617827977d6c2538f8d4961a1bf45de3e45be4c249e34ec548c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 439dfd36cc9777886088dccb8172885844f319f3e808fb951b2eac31e115367e500f97b9d6fc2d0006588a7c1a8bedbb034d8af1678bc6d39d10647c6db2a958
|
|
7
|
+
data.tar.gz: 63935500fcb295b1359c2222cb1860788fbb2f7859c2f303c8928b61b478197c72e4fa2163070873e333e45d822a7164ea365947cdb5b7c3a6ca117ff20bdbc5
|
|
@@ -88,14 +88,28 @@ try {
|
|
|
88
88
|
|
|
89
89
|
function SlurpOutput($file, $cur_line, $out_type) {
|
|
90
90
|
if (Test-Path $file) {
|
|
91
|
-
|
|
92
|
-
$
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
$fs = New-Object -TypeName System.IO.FileStream -ArgumentList @(
|
|
92
|
+
$file,
|
|
93
|
+
[system.io.filemode]::Open,
|
|
94
|
+
[System.io.FileAccess]::Read,
|
|
95
|
+
[System.IO.FileShare]::ReadWrite
|
|
96
|
+
)
|
|
97
|
+
try {
|
|
98
|
+
$enc = [System.Text.Encoding]::GetEncoding($Host.CurrentCulture.TextInfo.OEMCodePage)
|
|
99
|
+
$bytes = [System.Byte[]]::CreateInstance([System.Byte], $fs.Length)
|
|
100
|
+
if ($fs.Read($bytes, 0, $fs.Length) -gt 0) {
|
|
101
|
+
$text = $enc.GetString($bytes)
|
|
102
|
+
$text.TrimEnd("`n").TrimEnd("`r").Split(@("`r`n", "`n"), [StringSplitOptions]::None) | Select-Object -skip $cur_line | ForEach-Object {
|
|
103
|
+
$cur_line += 1
|
|
104
|
+
if ($out_type -eq 'err') {
|
|
105
|
+
$host.ui.WriteErrorLine("$_")
|
|
106
|
+
} else {
|
|
107
|
+
$host.ui.WriteLine("$_")
|
|
108
|
+
}
|
|
109
|
+
}
|
|
97
110
|
}
|
|
98
111
|
}
|
|
112
|
+
finally { $fs.Close() }
|
|
99
113
|
}
|
|
100
114
|
return $cur_line
|
|
101
115
|
}
|
|
@@ -73,7 +73,9 @@ module WinRM
|
|
|
73
73
|
|
|
74
74
|
def upload_elevated_shell_script(script_text)
|
|
75
75
|
elevated_shell_path = 'c:/windows/temp/winrm-elevated-shell-' + SecureRandom.uuid + '.ps1'
|
|
76
|
-
|
|
76
|
+
# Prepend the content of the file with an UTF-8 BOM for Windows to read it as such instead of the default
|
|
77
|
+
# Windows-XXXX encoding, and convert script_text accordingly if needed.
|
|
78
|
+
script_text_with_exit = "\uFEFF#{script_text.encode(Encoding::UTF_8)}\r\n$Host.SetShouldExit($LASTEXITCODE)"
|
|
77
79
|
@winrm_file_transporter.upload(StringIO.new(script_text_with_exit), elevated_shell_path)
|
|
78
80
|
elevated_shell_path
|
|
79
81
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: winrm-elevated
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shawn Neal
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-11-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: erubi
|