Land #9898, Fix target NOP generator not passed to payload

4.x
Brent Cook 2018-04-20 18:11:49 -05:00 committed by Metasploit
parent a44bcff2d8
commit 505eff4403
No known key found for this signature in database
GPG Key ID: CDFB5FA52007B954
2 changed files with 23 additions and 1 deletions

View File

@ -551,7 +551,7 @@ class Exploit < Msf::Module
reqs['MaxNops'] = payload_max_nops(explicit_target)
reqs['MinNops'] = payload_min_nops(explicit_target)
reqs['Encoder'] = datastore['ENCODER'] || payload_encoder(explicit_target)
reqs['Nop'] = datastore['NOP'] # TODO: Make like the others
reqs['Nop'] = datastore['NOP'] || payload_nop(explicit_target)
reqs['EncoderType'] = payload_encoder_type(explicit_target)
reqs['EncoderOptions'] = payload_encoder_options(explicit_target)
reqs['ExtendedOptions'] = payload_extended_options(explicit_target)
@ -930,6 +930,20 @@ class Exploit < Msf::Module
end
end
#
# Returns the payload NOP generator that is associated with either the
# current target or the exploit in general.
#
def payload_nop(explicit_target = nil)
explicit_target ||= target
if (explicit_target and explicit_target.payload_nop)
explicit_target.payload_nop
else
payload_info['Nop']
end
end
#
# Returns the payload encoder type that is associated with either the
# current target or the exploit in general.

View File

@ -241,6 +241,14 @@ class Msf::Module::Target
opts['Payload'] ? opts['Payload']['Encoder'] : nil
end
#
# The payload NOP generator or generators that can be used when generating the
# encoded payload (such as x86/opty2 and so on).
#
def payload_nop
opts['Payload'] ? opts['Payload']['Nop'] : nil
end
#
# The payload encoder type or types that can be used when generating the
# encoded payload (such as alphanum, unicode, xor, and so on).