Sha256: 944bb6e681070de8ad3b526b17436de16ec1d31bbf3bd749f3c530c25e413ad5

Contents?: true

Size: 947 Bytes

Versions: 25

Compression:

Stored size: 947 Bytes

Contents

module SSHScan
  module OS
    class Raspbian
      attr_reader :version

      class Version
        def initialize(version_string)
          @version_string = version_string
        end

        def to_s
          @version_string
        end
      end

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

      # Guess Raspbian OS version. Typically, Raspbian banners 
      # are like "SSH-2.0-Raspbian-something", where something 
      # is the Raspbian version.
      # @return [String] version string matched from banner, nil
      #   if not matched
      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

      def common
        "raspbian"
      end

      def cpe
        "o:raspbian:raspbian"
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
ssh_scan-0.0.44 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.43 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.42 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.41 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.40 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.39 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.38 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.38.pre lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.37 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.36 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.35 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.34 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.33 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.32 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.31 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.30 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.29 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.28 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.27 lib/ssh_scan/os/raspbian.rb
ssh_scan-0.0.26 lib/ssh_scan/os/raspbian.rb