Sha256: 134c6b52fdc5e2e0b0d73af1184e298358b4b780f664864a72bc75f03eed484d
Contents?: true
Size: 1.52 KB
Versions: 20
Compression:
Stored size: 1.52 KB
Contents
require 'yaml' require 'ssh_scan/attribute' module SSHScan # Policy methods that deal with key exchange, macs, encryption methods, # compression methods and more. class Policy attr_reader :name, :kex, :macs, :encryption, :compression, :references, :auth_methods, :ssh_version def initialize(opts = {}) @name = opts['name'] || [] @kex = opts['kex'] || [] @macs = opts['macs'] || [] @encryption = opts['encryption'] || [] @compression = opts['compression'] || [] @references = opts['references'] || [] @auth_methods = opts['auth_methods'] || [] @ssh_version = opts['ssh_version'] || nil end # Generate a {SSHScan::Policy} object from YAML file. # @param file [String] filepath # @return [SSHScan::Policy] new instance with parameters loaded # from YAML file def self.from_file(file) opts = YAML.load_file(file) self.new(opts) end def kex_attributes SSHScan.make_attributes(@kex) end def mac_attributes SSHScan.make_attributes(@macs) end def encryption_attributes SSHScan.make_attributes(@encryption) end def compression_attributes SSHScan.make_attributes(@compression) end # Generate a {SSHScan::Policy} object from YAML string. # @param string [String] YAML string # @return [SSHScan::Policy] new instance with parameters loaded # from given string def self.from_string(string) opts = YAML.load(string) self.new(opts) end end end
Version data entries
20 entries across 20 versions & 1 rubygems