Skip to content

Commit 548efc3

Browse files
committed
Land rapid7#7374, use templates from the gem for psh
2 parents 63ed562 + a68e9d3 commit 548efc3

File tree

6 files changed

+5
-90
lines changed

6 files changed

+5
-90
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ GEM
256256
rex-arch
257257
rex-ole (0.1.2)
258258
rex-text
259-
rex-powershell (0.1.64)
259+
rex-powershell (0.1.65)
260260
rex-random_identifier
261261
rex-text
262262
rex-random_identifier (0.1.0)

data/templates/scripts/to_mem_dotnet.ps1.template

Lines changed: 0 additions & 30 deletions
This file was deleted.

data/templates/scripts/to_mem_old.ps1.template

Lines changed: 0 additions & 20 deletions
This file was deleted.

data/templates/scripts/to_mem_pshreflection.ps1.template

Lines changed: 0 additions & 27 deletions
This file was deleted.

lib/msf/core/exploit/powershell.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,7 @@ def cmd_psh_payload(pay, payload_arch, opts = {})
194194
unless opts.key? :shorten
195195
opts[:shorten] = (datastore['Powershell::method'] != 'old')
196196
end
197-
template_path = File.join(Msf::Config.data_directory,
198-
"templates",
199-
"scripts")
197+
template_path = Rex::Powershell::Templates::TEMPLATE_DIR
200198

201199
command = Rex::Powershell::Command.cmd_psh_payload(pay,
202200
payload_arch,

lib/msf/util/exe.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,9 +1227,7 @@ def self.to_vba(framework,code,opts = {})
12271227
# @param code [String]
12281228
#
12291229
def self.to_powershell_vba(framework, arch, code)
1230-
template_path = File.join(Msf::Config.data_directory,
1231-
"templates",
1232-
"scripts")
1230+
template_path = Rex::Powershell::Templates::TEMPLATE_DIR
12331231

12341232
powershell = Rex::Powershell::Command.cmd_psh_payload(code,
12351233
arch,
@@ -1374,9 +1372,7 @@ def self.to_win32pe_psh_reflection(framework, code, opts = {})
13741372
end
13751373

13761374
def self.to_powershell_command(framework, arch, code)
1377-
template_path = File.join(Msf::Config.data_directory,
1378-
"templates",
1379-
"scripts")
1375+
template_path = Rex::Powershell::Templates::TEMPLATE_DIR
13801376
Rex::Powershell::Command.cmd_psh_payload(code,
13811377
arch,
13821378
template_path,
@@ -1385,9 +1381,7 @@ def self.to_powershell_command(framework, arch, code)
13851381
end
13861382

13871383
def self.to_powershell_hta(framework, arch, code)
1388-
template_path = File.join(Msf::Config.data_directory,
1389-
"templates",
1390-
"scripts")
1384+
template_path = Rex::Powershell::Templates::TEMPLATE_DIR
13911385

13921386
powershell = Rex::Powershell::Command.cmd_psh_payload(code,
13931387
arch,

0 commit comments

Comments
 (0)