Class: SSHScan::Policy
- Inherits:
-
Object
- Object
- SSHScan::Policy
- Defined in:
- lib/ssh_scan/policy.rb
Overview
Policy methods that deal with key exchange, macs, encryption methods, compression methods and more.
Instance Attribute Summary collapse
-
#auth_methods ⇒ Object
readonly
Returns the value of attribute auth_methods.
-
#compression ⇒ Object
readonly
Returns the value of attribute compression.
-
#encryption ⇒ Object
readonly
Returns the value of attribute encryption.
-
#kex ⇒ Object
readonly
Returns the value of attribute kex.
-
#macs ⇒ Object
readonly
Returns the value of attribute macs.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#references ⇒ Object
readonly
Returns the value of attribute references.
-
#ssh_version ⇒ Object
readonly
Returns the value of attribute ssh_version.
Class Method Summary collapse
-
.from_file(file) ⇒ SSHScan::Policy
Generate a Policy object from YAML file.
-
.from_string(string) ⇒ SSHScan::Policy
Generate a Policy object from YAML string.
Instance Method Summary collapse
- #compression_attributes ⇒ Object
- #encryption_attributes ⇒ Object
-
#initialize(opts = {}) ⇒ Policy
constructor
A new instance of Policy.
- #kex_attributes ⇒ Object
- #mac_attributes ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Policy
Returns a new instance of Policy.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ssh_scan/policy.rb', line 11 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 |
Instance Attribute Details
#auth_methods ⇒ Object (readonly)
Returns the value of attribute auth_methods.
8 9 10 |
# File 'lib/ssh_scan/policy.rb', line 8 def auth_methods @auth_methods end |
#compression ⇒ Object (readonly)
Returns the value of attribute compression.
8 9 10 |
# File 'lib/ssh_scan/policy.rb', line 8 def compression @compression end |
#encryption ⇒ Object (readonly)
Returns the value of attribute encryption.
8 9 10 |
# File 'lib/ssh_scan/policy.rb', line 8 def encryption @encryption end |
#kex ⇒ Object (readonly)
Returns the value of attribute kex.
8 9 10 |
# File 'lib/ssh_scan/policy.rb', line 8 def kex @kex end |
#macs ⇒ Object (readonly)
Returns the value of attribute macs.
8 9 10 |
# File 'lib/ssh_scan/policy.rb', line 8 def macs @macs end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/ssh_scan/policy.rb', line 8 def name @name end |
#references ⇒ Object (readonly)
Returns the value of attribute references.
8 9 10 |
# File 'lib/ssh_scan/policy.rb', line 8 def references @references end |
#ssh_version ⇒ Object (readonly)
Returns the value of attribute ssh_version.
8 9 10 |
# File 'lib/ssh_scan/policy.rb', line 8 def ssh_version @ssh_version end |
Class Method Details
.from_file(file) ⇒ SSHScan::Policy
Generate a SSHScan::Policy object from YAML file.
26 27 28 29 |
# File 'lib/ssh_scan/policy.rb', line 26 def self.from_file(file) opts = YAML.load_file(file) self.new(opts) end |
.from_string(string) ⇒ SSHScan::Policy
Generate a SSHScan::Policy object from YAML string.
51 52 53 54 |
# File 'lib/ssh_scan/policy.rb', line 51 def self.from_string(string) opts = YAML.load(string) self.new(opts) end |
Instance Method Details
#compression_attributes ⇒ Object
43 44 45 |
# File 'lib/ssh_scan/policy.rb', line 43 def compression_attributes SSHScan.make_attributes(@compression) end |
#encryption_attributes ⇒ Object
39 40 41 |
# File 'lib/ssh_scan/policy.rb', line 39 def encryption_attributes SSHScan.make_attributes(@encryption) end |
#kex_attributes ⇒ Object
31 32 33 |
# File 'lib/ssh_scan/policy.rb', line 31 def kex_attributes SSHScan.make_attributes(@kex) end |
#mac_attributes ⇒ Object
35 36 37 |
# File 'lib/ssh_scan/policy.rb', line 35 def mac_attributes SSHScan.make_attributes(@macs) end |