Skip to content

Commit e787d43

Browse files
author
RageLtMan
committed
Implement wrap_double_quotes in Msf PSH namespace
This is the Msf side of Rex Powershell #7
1 parent 33a06fa commit e787d43

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/msf/core/exploit/powershell.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def initialize(info = {})
1818
OptBool.new('Powershell::noninteractive', [true, 'Execute powershell without interaction', true]),
1919
OptBool.new('Powershell::encode_final_payload', [true, 'Encode final payload for -EncodedCommand', false]),
2020
OptBool.new('Powershell::encode_inner_payload', [true, 'Encode inner payload for -EncodedCommand', false]),
21+
OptBool.new('Powershell::wrap_double_quotes', [true, 'Wraps the -Command argument in single quotes', true]),
2122
OptBool.new('Powershell::no_equals', [true, 'Pad base64 until no "=" remains', false]),
2223
OptEnum.new('Powershell::method', [true, 'Payload delivery method', 'reflection', %w[net reflection old msil]])
2324
]
@@ -216,13 +217,13 @@ def run_hidden_psh(ps_code, payload_arch, encoded)
216217
# powershell script
217218
# @option opts [Boolean] :remove_comspec Removes the %COMSPEC%
218219
# environment variable at the start of the command line
219-
# @option opts [Boolean] :use_single_quotes Wraps the -Command
220-
# argument in single quotes unless :encode_final_payload
220+
# @option opts [Boolean] :wrap_double_quotes Wraps the -Command
221+
# argument in double quotes unless :encode_final_payload
221222
#
222223
# @return [String] Powershell command line with payload
223224
def cmd_psh_payload(pay, payload_arch, opts = {})
224225
%i[persist prepend_sleep exec_in_place encode_final_payload encode_inner_payload
225-
remove_comspec noninteractive no_equals method].map do |opt|
226+
remove_comspec noninteractive wrap_double_quotes no_equals method].map do |opt|
226227
opts[opt] ||= datastore["Powershell::#{opt}"]
227228
end
228229

0 commit comments

Comments
 (0)