Class: SSHScan::OS::Raspbian

Inherits:
Object
  • Object
show all
Defined in:
lib/ssh_scan/os/raspbian.rb

Defined Under Namespace

Classes: Version

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(banner) ⇒ Raspbian

Returns a new instance of Raspbian.



16
17
18
19
# File 'lib/ssh_scan/os/raspbian.rb', line 16

def initialize(banner)
  @banner = banner
  @version = Raspbian::Version.new(raspbian_version_guess)
end

Instance Attribute Details

#versionObject (readonly)

Returns the value of attribute version.



4
5
6
# File 'lib/ssh_scan/os/raspbian.rb', line 4

def version
  @version
end

Instance Method Details

#commonObject



33
34
35
# File 'lib/ssh_scan/os/raspbian.rb', line 33

def common
  "raspbian"
end

#cpeObject



37
38
39
# File 'lib/ssh_scan/os/raspbian.rb', line 37

def cpe
  "o:raspbian:raspbian"
end

#raspbian_version_guessString

Guess Raspbian OS version. Typically, Raspbian banners are like “SSH-2.0-Raspbian-something”, where something is the Raspbian version.

Returns:

  • (String)

    version string matched from banner, nil if not matched



26
27
28
29
30
31
# File 'lib/ssh_scan/os/raspbian.rb', line 26

def raspbian_version_guess
  return nil if @banner.nil?
  match = @banner.match(/SSH-2.0-Raspbian-(\d+)/)
  return nil if match.nil?
  return match[1]
end