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 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/metasploit/framework/login_scanner/ssh.rb
Original file line number Diff line number Diff line change
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
3 changes: 2 additions & 1 deletion lib/msf/base/serializer/readable_text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -768,8 +768,9 @@ def self.dump_sessions_verbose(framework, opts={})
sess_checkin = "<none>"
sess_registration = "No"

# to_s is required incase something bugged earlier and .platform is nil
if session.respond_to?(:platform)
sess_type << " " + session.platform
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
10 changes: 10 additions & 0 deletions lib/msf/core/module/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -576,4 +576,14 @@ 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
Alias = "unknown"
h00die marked this conversation as resolved.
Show resolved Hide resolved
end

end