Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeError in sessions -v and add an "unknown" platform class #10773

Merged
merged 4 commits into from Oct 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/metasploit/framework/login_scanner/ssh.rb
Expand Up @@ -165,12 +165,14 @@ def get_platform(proof)
'aix'
when /Win32|Windows/
'windows'
when /Unknown command or computer name/
when /Unknown command or computer name/, /Line has invalid autocommand/
'cisco-ios'
when /unknown keyword/ # ScreenOS
'juniper'
when /JUNOS Base OS/ #JunOS
'juniper'
else
'unknown'
end
end

Expand Down
5 changes: 3 additions & 2 deletions lib/msf/base/serializer/readable_text.rb
Expand Up @@ -768,8 +768,9 @@ def self.dump_sessions_verbose(framework, opts={})
sess_checkin = "<none>"
sess_registration = "No"

if session.respond_to?(:platform)
sess_type << " " + session.platform
# to_s is required incase something bugged earlier and .platform is nil
if session.respond_to?(:platform) && !session.platform.nil?
sess_type << " " + session.platform.to_s
h00die marked this conversation as resolved.
Show resolved Hide resolved
end

if session.respond_to?(:last_checkin) && session.last_checkin
Expand Down
11 changes: 11 additions & 0 deletions lib/msf/core/module/platform.rb
Expand Up @@ -576,4 +576,15 @@ class Apple_iOS < Msf::Module::Platform
Alias = "apple_ios"
end

#
# Unknown
# This is a special case for when we're completely unsure of the
# platform, such as a crash or default case in code. Only
# utilize this as a catch-all.
#
class Unknown < Msf::Module::Platform
Rank = 0 # safeguard with 0 since the platform is completely unknown
Alias = "unknown"
h00die marked this conversation as resolved.
Show resolved Hide resolved
end

end