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 << " 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"

View File

@ -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

View File

@ -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"]