Class: SSHScan::SSHLib::OpenSSH

Inherits:
Object
  • Object
show all
Defined in:
lib/ssh_scan/ssh_lib/openssh.rb

Defined Under Namespace

Classes: Version

Instance Method Summary collapse

Constructor Details

#initialize(banner = nil) ⇒ OpenSSH

Returns a new instance of OpenSSH.



14
15
16
# File 'lib/ssh_scan/ssh_lib/openssh.rb', line 14

def initialize(banner = nil)
  @banner = banner
end

Instance Method Details

#commonObject



25
26
27
# File 'lib/ssh_scan/ssh_lib/openssh.rb', line 25

def common
  "openssh"
end

#cpeObject



29
30
31
# File 'lib/ssh_scan/ssh_lib/openssh.rb', line 29

def cpe
  "a:openssh:openssh" << (":" + version.to_s) unless version.nil?
end

#versionObject



18
19
20
21
22
23
# File 'lib/ssh_scan/ssh_lib/openssh.rb', line 18

def version()
  return nil if @banner.nil?
  match = @banner.match(/OpenSSH_(\d+[\.\d+]+(p)?(\d+)?)/)
  return nil if match.nil?
  return OpenSSH::Version.new(match[1])
end