Skip to content

Commit 4321aaf

Browse files
committed
Land #18547, Update ssh login pubkey module
Update ssh login pubkey module to correctly identify windows ssh platform
2 parents bccd906 + 1b12dc3 commit 4321aaf

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

lib/metasploit/framework/ssh/platform.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def self.get_platform_from_info(info)
101101
'hpux'
102102
when /AIX/i
103103
'aix'
104-
when /cygwin|Win32|Windows|Microsoft/i
104+
when /MSYS_NT|cygwin|Win32|Windows|Microsoft/i
105105
'windows'
106106
when /Unknown command or computer name|Line has invalid autocommand/i
107107
'cisco-ios'
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require 'spec_helper'
2+
require 'metasploit/framework/ssh/platform'
3+
4+
RSpec.describe Metasploit::Framework::Ssh::Platform do
5+
describe '.get_platform_from_info' do
6+
[
7+
{
8+
info: 'uid=197616(vagrant) gid=197121(None) groups=197121(None),11(Authenticated Users),66048(LOCAL),66049(CONSOLE LOGON),4(INTERACTIVE),15(This Organization),545(Users),4095(CurrentSession),544(Administrators),559(Performance Log Users),405504(High Mandatory Level) MSYS_NT-10.0-17763 EC2AMAZ-PDSMQ8L 3.4.9.x86_64 2023-09-15 12:15 UTC x86_64 Msys ',
9+
expected: 'windows'
10+
}
11+
].each do |test|
12+
it "correctly identifies #{test[:info]} as #{test[:expected]}" do
13+
expect(described_class.get_platform_from_info(test[:info])).to eq(test[:expected])
14+
end
15+
end
16+
end
17+
end

spec/spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@
169169
# https://github.com/rapid7/rex-text/blob/11e59416f7d8cce18b8b8b9893b3277e6ad0bea1/lib/rex/text/wrapped_table.rb#L74
170170
# This can cause some integration tests to fail if the tests are run from smaller consoles
171171
# This mock will ensure that the tests run without word-wrapping.
172+
require 'bigdecimal'
172173
config.before(:each) do
173174
mock_io_console = double(:console, winsize: { rows: 30, columns: ::BigDecimal::INFINITY }.values)
174175
allow(::IO).to receive(:console).and_return(mock_io_console)

0 commit comments

Comments
 (0)