Sha256: abf00660ac47ff8b5ae508134cb4deb45e9ec9438c1337ec5ed550b758593355

Contents?: true

Size: 830 Bytes

Versions: 56

Compression:

Stored size: 830 Bytes

Contents

module Dap
module Filter

require 'digest/md5'

class FilterDecodeSSHKeyscan
  include BaseDecoder

  def decode(data)
    save  = {}

    data.split(/\n/).each do |line|
      case line.strip
      when /^# [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\s+(.*)/m
        banner = $1
        save['banner'] = banner
        if banner =~ /^SSH-([\d\.]+)-([^\s]+)\s+(.*)/m
          save['ssh-protocol'] = $1
          save['ssh-version']  = $2
          save['ssh-vendor']   = $3
          save['ssh-recog']    = $2 + " " + $3
        end

      when /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\s+((ssh|ecdsa)[^\s]+)\s+(.*)/m
        ktype = $1
        kdata = $3
        save['hkey-' + ktype] = kdata
        save['hkey-' + ktype + '-fp'] = Digest::MD5.hexdigest(kdata.unpack('m*').first).scan(/../).join(':')
      end
    end

    save
  end
end

end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
dap-1.3.1 lib/dap/filter/ssh_keyscan.rb
dap-1.3.0 lib/dap/filter/ssh_keyscan.rb
dap-1.2.9 lib/dap/filter/ssh_keyscan.rb
dap-1.2.8 lib/dap/filter/ssh_keyscan.rb
dap-1.2.7 lib/dap/filter/ssh_keyscan.rb
dap-1.2.6 lib/dap/filter/ssh_keyscan.rb
dap-1.2.5 lib/dap/filter/ssh_keyscan.rb
dap-1.2.4 lib/dap/filter/ssh_keyscan.rb
dap-1.2.3 lib/dap/filter/ssh_keyscan.rb
dap-1.2.2 lib/dap/filter/ssh_keyscan.rb
dap-1.2.1 lib/dap/filter/ssh_keyscan.rb
dap-1.2.0 lib/dap/filter/ssh_keyscan.rb
dap-1.0.2 lib/dap/filter/ssh_keyscan.rb
dap-1.0.1 lib/dap/filter/ssh_keyscan.rb
dap-1.0.0 lib/dap/filter/ssh_keyscan.rb
dap-0.1.24 lib/dap/filter/ssh_keyscan.rb
dap-0.1.23 lib/dap/filter/ssh_keyscan.rb
dap-0.1.22 lib/dap/filter/ssh_keyscan.rb
dap-0.1.21 lib/dap/filter/ssh_keyscan.rb
dap-0.1.20 lib/dap/filter/ssh_keyscan.rb