Skip to content

Commit f556a5f

Browse files
committed
Add compatible session types to post module info
1 parent 8cfd492 commit f556a5f

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

lib/msf/base/serializer/readable_text.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ def self.dump_exploit_module(mod, indent = '')
165165
output << " Name: #{mod.name}\n"
166166
output << " Module: #{mod.fullname}\n"
167167
output << " Platform: #{mod.platform_to_s}\n"
168+
output << " Arch: #{mod.arch_to_s}\n"
168169
output << " Privileged: " + (mod.privileged? ? "Yes" : "No") + "\n"
169170
output << " License: #{mod.license}\n"
170171
output << " Rank: #{mod.rank_to_s.capitalize}\n"
@@ -275,11 +276,20 @@ def self.dump_post_module(mod, indent = '')
275276

276277
# Authors
277278
output << "Provided by:\n"
278-
mod.each_author { |author|
279+
mod.each_author.each do |author|
279280
output << indent + author.to_s + "\n"
280-
}
281+
end
281282
output << "\n"
282283

284+
# Compatible session types
285+
if mod.session_types
286+
output << "Compatible session types:\n"
287+
mod.session_types.sort.each do |type|
288+
output << indent + type.capitalize + "\n"
289+
end
290+
output << "\n"
291+
end
292+
283293
# Actions
284294
if mod.action
285295
output << "Available actions:\n"

lib/msf/core/post_mixin.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def initialize(info={})
2020
] , Msf::Post)
2121

2222
# Default stance is active
23-
self.passive = (info['Passive'] and info['Passive'] == true) || false
23+
self.passive = info['Passive'] || false
24+
self.session_types = info['SessionTypes'] || []
2425
end
2526

2627
#
@@ -161,8 +162,8 @@ def session_compatible?(sess_or_sid)
161162
return false if s.nil?
162163

163164
# Can't be compatible if it's the wrong type
164-
if self.module_info["SessionTypes"]
165-
return false unless self.module_info["SessionTypes"].include?(s.type)
165+
if session_types
166+
return false unless session_types.include?(s.type)
166167
end
167168

168169
# Types are okay, now check the platform.
@@ -189,9 +190,16 @@ def session_compatible?(sess_or_sid)
189190
# @see passive?
190191
attr_reader :passive
191192

193+
#
194+
# A list of compatible session types
195+
#
196+
# @return [Array]
197+
attr_reader :session_types
198+
192199
protected
193200

194201
attr_writer :passive
202+
attr_writer :session_types
195203

196204
def session_changed?
197205
@ds_session ||= datastore["SESSION"]

0 commit comments

Comments
 (0)