diff --git a/lib/msf/base/serializer/readable_text.rb b/lib/msf/base/serializer/readable_text.rb index edd82099e9..1c170f8ce6 100644 --- a/lib/msf/base/serializer/readable_text.rb +++ b/lib/msf/base/serializer/readable_text.rb @@ -165,6 +165,7 @@ class ReadableText output << " Name: #{mod.name}\n" output << " Module: #{mod.fullname}\n" output << " Platform: #{mod.platform_to_s}\n" + output << " Arch: #{mod.arch_to_s}\n" output << " Privileged: " + (mod.privileged? ? "Yes" : "No") + "\n" output << " License: #{mod.license}\n" output << " Rank: #{mod.rank_to_s.capitalize}\n" @@ -275,11 +276,20 @@ class ReadableText # Authors output << "Provided by:\n" - mod.each_author { |author| + mod.each_author.each do |author| output << indent + author.to_s + "\n" - } + end output << "\n" + # Compatible session types + if mod.session_types + output << "Compatible session types:\n" + mod.session_types.sort.each do |type| + output << indent + type.capitalize + "\n" + end + output << "\n" + end + # Actions if mod.action output << "Available actions:\n" diff --git a/lib/msf/core/post.rb b/lib/msf/core/post.rb index 2e042a3160..6a7a2486e9 100644 --- a/lib/msf/core/post.rb +++ b/lib/msf/core/post.rb @@ -29,9 +29,13 @@ class Msf::Post < Msf::Module def setup m = replicant + if m.actions.length > 0 && !m.action raise Msf::MissingActionError, "Please use: #{m.actions.collect {|e| e.name} * ", "}" end + + # PostMixin + super end def type diff --git a/lib/msf/core/post_mixin.rb b/lib/msf/core/post_mixin.rb index 1319bd42b2..f1859ece16 100644 --- a/lib/msf/core/post_mixin.rb +++ b/lib/msf/core/post_mixin.rb @@ -20,7 +20,8 @@ module Msf::PostMixin ] , Msf::Post) # Default stance is active - self.passive = (info['Passive'] and info['Passive'] == true) || false + self.passive = info['Passive'] || false + self.session_types = info['SessionTypes'] || [] end # @@ -38,8 +39,6 @@ module Msf::PostMixin print_warning('SESSION may not be compatible with this module.') end - super - check_for_session_readiness() if session.type == "meterpreter" @session.init_ui(self.user_input, self.user_output) @@ -161,8 +160,8 @@ module Msf::PostMixin return false if s.nil? # Can't be compatible if it's the wrong type - if self.module_info["SessionTypes"] - return false unless self.module_info["SessionTypes"].include?(s.type) + if session_types + return false unless session_types.include?(s.type) end # Types are okay, now check the platform. @@ -189,9 +188,16 @@ module Msf::PostMixin # @see passive? attr_reader :passive + # + # A list of compatible session types + # + # @return [Array] + attr_reader :session_types + protected attr_writer :passive + attr_writer :session_types def session_changed? @ds_session ||= datastore["SESSION"]