Skip to content

Commit 0be166e

Browse files
committed
update session_compatible? for changes from PR#7507
1 parent ff8141c commit 0be166e

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

lib/msf/core/post_mixin.rb

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -160,34 +160,18 @@ def session_compatible?(sess_or_sid)
160160
return false unless self.module_info["SessionTypes"].include?(s.type)
161161
end
162162

163-
# Types are okay, now check the platform. This is kind of a ghetto
164-
# workaround for session platforms being ad-hoc and Platform being
165-
# inflexible.
163+
# Types are okay, now check the platform.
166164
if self.platform and self.platform.kind_of?(Msf::Module::PlatformList)
167-
[
168-
# Add as necessary
169-
'win', 'linux', 'osx'
170-
].each do |name|
171-
if self.platform =~ /#{name}/
172-
p = Msf::Module::PlatformList.transform(name)
173-
return false unless self.platform.supports? p
174-
end
175-
end
176-
elsif self.platform and self.platform.kind_of?(Msf::Module::Platform)
177-
p_klass = Msf::Module::Platform
178-
case self.platform
179-
when 'win'
180-
return false unless self.platform.kind_of?(p_klass::Windows)
181-
when 'osx'
182-
return false unless self.platform.kind_of?(p_klass::OSX)
183-
when 'linux'
184-
return false unless self.platform.kind_of?(p_klass::Linux)
185-
end
165+
return false unless self.platform.supports?(Msf::Module::PlatformList.transform(s.base_platform))
186166
end
187167

188168
# Check to make sure architectures match
189169
mod_arch = self.module_info['Arch']
170+
unless mod_arch.nil?
190171
mod_arch = [mod_arch] unless mod_arch.kind_of?(Array)
172+
# this looks incomplete like there should have been more testing done here
173+
return false unless mod_arch.include? s.base_arch
174+
end
191175

192176
# If we got here, we haven't found anything that definitely
193177
# disqualifies this session. Assume that means we can use it.

0 commit comments

Comments
 (0)