@@ -14,9 +14,11 @@ def initialize(info = {})
14
14
OptBool . new ( 'Powershell::sub_vars' , [ true , 'Substitute variable names' , false ] ) ,
15
15
OptBool . new ( 'Powershell::sub_funcs' , [ true , 'Substitute function names' , false ] ) ,
16
16
OptBool . new ( 'Powershell::exec_in_place' , [ true , 'Produce PSH without executable wrapper' , false ] ) ,
17
+ OptBool . new ( 'Powershell::remove_comspec' , [ true , 'Produce script calling powershell directly' , false ] ) ,
18
+ OptBool . new ( 'Powershell::noninteractive' , [ true , 'Execute powershell without interaction' , true ] ) ,
17
19
OptBool . new ( 'Powershell::encode_final_payload' , [ true , 'Encode final payload for -EncodedCommand' , false ] ) ,
18
20
OptBool . new ( 'Powershell::encode_inner_payload' , [ true , 'Encode inner payload for -EncodedCommand' , false ] ) ,
19
- OptBool . new ( 'Powershell::use_single_quotes ' , [ true , 'Wraps the -Command argument in single quotes' , false ] ) ,
21
+ OptBool . new ( 'Powershell::wrap_double_quotes ' , [ true , 'Wraps the -Command argument in single quotes' , true ] ) ,
20
22
OptBool . new ( 'Powershell::no_equals' , [ true , 'Pad base64 until no "=" remains' , false ] ) ,
21
23
OptEnum . new ( 'Powershell::method' , [ true , 'Payload delivery method' , 'reflection' , %w[ net reflection old msil ] ] )
22
24
]
@@ -215,14 +217,13 @@ def run_hidden_psh(ps_code, payload_arch, encoded)
215
217
# powershell script
216
218
# @option opts [Boolean] :remove_comspec Removes the %COMSPEC%
217
219
# environment variable at the start of the command line
218
- # @option opts [Boolean] :use_single_quotes Wraps the -Command
219
- # 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
220
222
#
221
223
# @return [String] Powershell command line with payload
222
224
def cmd_psh_payload ( pay , payload_arch , opts = { } )
223
- options . validate ( datastore )
224
-
225
- %i[ persist prepend_sleep exec_in_place encode_final_payload encode_inner_payload use_single_quotes no_equals method ] . map do |opt |
225
+ %i[ persist prepend_sleep exec_in_place encode_final_payload encode_inner_payload
226
+ remove_comspec noninteractive wrap_double_quotes no_equals method ] . map do |opt |
226
227
opts [ opt ] ||= datastore [ "Powershell::#{ opt } " ]
227
228
end
228
229
0 commit comments