Class: SSHScan::SSHLib::Dropbear

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

Defined Under Namespace

Classes: Version

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(banner) ⇒ Dropbear

Returns a new instance of Dropbear.



19
20
21
22
# File 'lib/ssh_scan/ssh_lib/dropbear.rb', line 19

def initialize(banner)
  @banner = banner
  @version = Dropbear::Version.new(dropbear_version_guess)
end

Instance Attribute Details

#versionObject (readonly)

Returns the value of attribute version.



4
5
6
# File 'lib/ssh_scan/ssh_lib/dropbear.rb', line 4

def version
  @version
end

Instance Method Details

#commonObject



31
32
33
# File 'lib/ssh_scan/ssh_lib/dropbear.rb', line 31

def common
  "dropbear"
end

#cpeObject



35
36
37
# File 'lib/ssh_scan/ssh_lib/dropbear.rb', line 35

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

#dropbear_version_guessObject



24
25
26
27
28
29
# File 'lib/ssh_scan/ssh_lib/dropbear.rb', line 24

def dropbear_version_guess
  return nil if @banner.nil?
  match = @banner.match(/SSH-2.0-dropbear_(\d+.\d+(?:.\d)?(?:test(:?\d)?)?)/)
  return nil if match.nil?
  return match[1]
end