Land #9075, missing setup fix for post modules

bug/bundler_fix
William Vu 2017-10-12 12:24:46 -05:00
commit 5b40febdc5
No known key found for this signature in database
GPG Key ID: 68BD00CE25866743
3 changed files with 27 additions and 7 deletions

View File

@ -165,6 +165,7 @@ class ReadableText
output << " Name: #{mod.name}\n" output << " Name: #{mod.name}\n"
output << " Module: #{mod.fullname}\n" output << " Module: #{mod.fullname}\n"
output << " Platform: #{mod.platform_to_s}\n" output << " Platform: #{mod.platform_to_s}\n"
output << " Arch: #{mod.arch_to_s}\n"
output << " Privileged: " + (mod.privileged? ? "Yes" : "No") + "\n" output << " Privileged: " + (mod.privileged? ? "Yes" : "No") + "\n"
output << " License: #{mod.license}\n" output << " License: #{mod.license}\n"
output << " Rank: #{mod.rank_to_s.capitalize}\n" output << " Rank: #{mod.rank_to_s.capitalize}\n"
@ -275,11 +276,20 @@ class ReadableText
# Authors # Authors
output << "Provided by:\n" output << "Provided by:\n"
mod.each_author { |author| mod.each_author.each do |author|
output << indent + author.to_s + "\n" output << indent + author.to_s + "\n"
} end
output << "\n" 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 # Actions
if mod.action if mod.action
output << "Available actions:\n" output << "Available actions:\n"

View File

@ -29,9 +29,13 @@ class Msf::Post < Msf::Module
def setup def setup
m = replicant m = replicant
if m.actions.length > 0 && !m.action if m.actions.length > 0 && !m.action
raise Msf::MissingActionError, "Please use: #{m.actions.collect {|e| e.name} * ", "}" raise Msf::MissingActionError, "Please use: #{m.actions.collect {|e| e.name} * ", "}"
end end
# PostMixin
super
end end
def type def type

View File

@ -20,7 +20,8 @@ module Msf::PostMixin
] , Msf::Post) ] , Msf::Post)
# Default stance is active # Default stance is active
self.passive = (info['Passive'] and info['Passive'] == true) || false self.passive = info['Passive'] || false
self.session_types = info['SessionTypes'] || []
end end
# #
@ -38,8 +39,6 @@ module Msf::PostMixin
print_warning('SESSION may not be compatible with this module.') print_warning('SESSION may not be compatible with this module.')
end end
super
check_for_session_readiness() if session.type == "meterpreter" check_for_session_readiness() if session.type == "meterpreter"
@session.init_ui(self.user_input, self.user_output) @session.init_ui(self.user_input, self.user_output)
@ -161,8 +160,8 @@ module Msf::PostMixin
return false if s.nil? return false if s.nil?
# Can't be compatible if it's the wrong type # Can't be compatible if it's the wrong type
if self.module_info["SessionTypes"] if session_types
return false unless self.module_info["SessionTypes"].include?(s.type) return false unless session_types.include?(s.type)
end end
# Types are okay, now check the platform. # Types are okay, now check the platform.
@ -189,9 +188,16 @@ module Msf::PostMixin
# @see passive? # @see passive?
attr_reader :passive attr_reader :passive
#
# A list of compatible session types
#
# @return [Array]
attr_reader :session_types
protected protected
attr_writer :passive attr_writer :passive
attr_writer :session_types
def session_changed? def session_changed?
@ds_session ||= datastore["SESSION"] @ds_session ||= datastore["SESSION"]