From e2428b5c200c45b7e9950934fa7a69c752511dec Mon Sep 17 00:00:00 2001 From: William Vu Date: Wed, 5 Sep 2018 18:07:54 -0500 Subject: [PATCH] Fix target DisableNops not being passed to payload --- lib/msf/core/exploit.rb | 14 ++++++++++++++ lib/msf/core/module/target.rb | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/lib/msf/core/exploit.rb b/lib/msf/core/exploit.rb index a5f05cd8f3..e1060a4263 100644 --- a/lib/msf/core/exploit.rb +++ b/lib/msf/core/exploit.rb @@ -557,6 +557,7 @@ class Exploit < Msf::Module reqs['BadChars'] = payload_badchars(explicit_target) reqs['Append'] = payload_append(explicit_target) reqs['AppendEncoder'] = payload_append_encoder(explicit_target) + reqs['DisableNops'] = payload_disable_nops(explicit_target) reqs['MaxNops'] = payload_max_nops(explicit_target) reqs['MinNops'] = payload_min_nops(explicit_target) reqs['Encoder'] = datastore['ENCODER'] || payload_encoder(explicit_target) @@ -879,6 +880,19 @@ class Exploit < Msf::Module p end + # + # Whether NOP generation should be enabled or disabled + # + def payload_disable_nops(explicit_target = nil) + explicit_target ||= target + + if (explicit_target and explicit_target.payload_disable_nops) + explicit_target.payload_disable_nops + else + payload_info['DisableNops'] + end + end + # # Maximum number of nops to use as a hint to the framework. # Nil signifies that the framework should decide. diff --git a/lib/msf/core/module/target.rb b/lib/msf/core/module/target.rb index 76e088f3a5..2dac963092 100644 --- a/lib/msf/core/module/target.rb +++ b/lib/msf/core/module/target.rb @@ -219,6 +219,13 @@ class Msf::Module::Target opts['Payload'] ? opts['Payload']['StackAdjustment'] : nil end + # + # Whether NOP generation should be enabled or disabled + # + def payload_disable_nops + opts['Payload'] ? opts['Payload']['DisableNops'] : nil + end + # # Payload max nops information for this target. #