@@ -14,6 +14,10 @@ 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::encode_final_payload' , [ true , 'Encode final payload for -EncodedCommand' , false ] ) ,
18
+ 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 ] ) ,
20
+ OptBool . new ( 'Powershell::no_equals' , [ true , 'Pad base64 until no "=" remains' , false ] ) ,
17
21
OptEnum . new ( 'Powershell::method' , [ true , 'Payload delivery method' , 'reflection' , %w( net reflection old msil ) ] ) ,
18
22
] , self . class )
19
23
end
@@ -188,11 +192,12 @@ def run_hidden_psh(ps_code, payload_arch, encoded)
188
192
#
189
193
# @return [String] Powershell command line with payload
190
194
def cmd_psh_payload ( pay , payload_arch , opts = { } )
191
- options . validate ( datastore )
192
- opts [ :persist ] ||= datastore [ 'Powershell::persist' ]
193
- opts [ :prepend_sleep ] ||= datastore [ 'Powershell::prepend_sleep' ]
194
- opts [ :method ] ||= datastore [ 'Powershell::method' ]
195
- opts [ :exec_in_place ] ||= datastore [ 'Powershell::exec_in_place' ]
195
+ options . validate ( datastore )
196
+
197
+ [ :persist , :prepend_sleep , :exec_in_place , :encode_final_payload ,
198
+ :encode_inner_payload , :use_single_quotes , :no_equals , :method ] . map { |opt |
199
+ opts [ opt ] ||= datastore [ "Powershell::#{ opt } " ]
200
+ }
196
201
197
202
unless opts . key? :shorten
198
203
opts [ :shorten ] = ( datastore [ 'Powershell::method' ] != 'old' )
0 commit comments