Skip to content

Commit 1098bc6

Browse files
committed
Warn user when session not compat instead of failing
This commit changes the post mixin so that the session compat check only shows a warning rather than throwing an exception and stopping the module from working completely. This is off the back of the discussion involved with rapid7#7736
1 parent fa016de commit 1098bc6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/msf/core/post_mixin.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def initialize(info={})
3030
# @raise [OptionValidateError] if {#session} returns nil
3131
def setup
3232
unless session_compatible?(session)
33-
raise Msf::OptionValidateError.new(["SESSION (type not valid for this module)"])
33+
print_warning('SESSION may not be compatible with this module.')
3434
end
3535

3636
super
@@ -168,8 +168,8 @@ def session_compatible?(sess_or_sid)
168168
# Check to make sure architectures match
169169
mod_arch = self.module_info['Arch']
170170
unless mod_arch.nil?
171-
mod_arch = [mod_arch] unless mod_arch.kind_of?(Array)
172-
return false unless mod_arch.include? s.arch
171+
mod_arch = [mod_arch] unless mod_arch.kind_of?(Array)
172+
return false unless mod_arch.include?(s.arch)
173173
end
174174

175175
# If we got here, we haven't found anything that definitely

0 commit comments

Comments
 (0)