Choose fallback if stage encoding fail
parent
7485d9172a
commit
c71428be50
|
@ -16,7 +16,8 @@ module Msf::Payload::Stager
|
|||
[
|
||||
Msf::OptBool.new("EnableStageEncoding", [ false, "Encode the second stage payload", false ]),
|
||||
Msf::OptString.new("StageEncoder", [ false, "Encoder to use if EnableStageEncoding is set", nil ]),
|
||||
Msf::OptString.new("StageEncoderSaveRegisters", [ false, "Additional registers to preserve in the staged payload if EnableStageEncoding is set", "" ])
|
||||
Msf::OptString.new("StageEncoderSaveRegisters", [ false, "Additional registers to preserve in the staged payload if EnableStageEncoding is set", "" ]),
|
||||
Msf::OptBool.new("FallbackToNoStageEncoding", [ false, "If encoders choosen in StageEncoder are not compatible to stage encoding fallback to no encoding otherwise fallback to automatic selected one", true ])
|
||||
], Msf::Payload::Stager)
|
||||
|
||||
end
|
||||
|
@ -100,7 +101,7 @@ module Msf::Payload::Stager
|
|||
# @return [Boolean]
|
||||
def encode_stage?
|
||||
# Convert to string in case it hasn't been normalized
|
||||
!!(datastore['EnableStageEncoding'].to_s == "true" || !datastore["StageEncoder"].blank?)
|
||||
datastore['EnableStageEncoding'] == "true" || !datastore["StageEncoder"].to_s.empty?
|
||||
end
|
||||
|
||||
#
|
||||
|
@ -236,7 +237,14 @@ module Msf::Payload::Stager
|
|||
'ForceSaveRegisters' => true,
|
||||
'ForceEncode' => true)
|
||||
if (encp.encoder == nil)
|
||||
print_warning("#{encoder} didn't succeed")
|
||||
print_warning("Encoder #{encoder} did not succeed")
|
||||
if !datastore['FallbackToNoStageEncoding']
|
||||
print_warning("Fallback to automatic StageEncoder selection")
|
||||
encoder = nil
|
||||
redo
|
||||
else
|
||||
print_warning("Fallback to no encoder")
|
||||
end
|
||||
else
|
||||
print_status("Encoded stage with #{encp.encoder.refname}")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue