Class: Vulnerability

Inherits:
Object
  • Object
show all
Includes:
Output
Defined in:
lib/common/models/vulnerability.rb,
lib/common/models/vulnerability/output.rb

Defined Under Namespace

Modules: Output

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from Output

metasploit_module_url, #output

Constructor Details

- (Vulnerability) initialize(title, type, references, metasploit_modules = [], fixed_in = '')



18
19
20
21
22
23
24
# File 'lib/common/models/vulnerability.rb', line 18

def initialize(title, type, references, metasploit_modules = [], fixed_in = '')
  @title              = title
  @type               = type
  @references         = references
  @metasploit_modules = metasploit_modules
  @fixed_in						= fixed_in
end

Instance Attribute Details

- (Object) fixed_in

Returns the value of attribute fixed_in



8
9
10
# File 'lib/common/models/vulnerability.rb', line 8

def fixed_in
  @fixed_in
end

- (Object) metasploit_modules

Returns the value of attribute metasploit_modules



8
9
10
# File 'lib/common/models/vulnerability.rb', line 8

def metasploit_modules
  @metasploit_modules
end

- (Object) references

Returns the value of attribute references



8
9
10
# File 'lib/common/models/vulnerability.rb', line 8

def references
  @references
end

- (Object) title

Returns the value of attribute title



8
9
10
# File 'lib/common/models/vulnerability.rb', line 8

def title
  @title
end

- (Object) type

Returns the value of attribute type



8
9
10
# File 'lib/common/models/vulnerability.rb', line 8

def type
  @type
end

Class Method Details

+ (Vulnerability) load_from_xml_node(xml_node)

Create the Vulnerability from the xml_node

Parameters:

  • xml_node (Nokogiri::XML::Node)

Returns:



44
45
46
47
48
49
50
51
52
# File 'lib/common/models/vulnerability.rb', line 44

def self.load_from_xml_node(xml_node)
  new(
    xml_node.search('title').text,
    xml_node.search('type').text,
    xml_node.search('reference').map(&:text),
    xml_node.search('metasploit').map(&:text),
    xml_node.search('fixed_in').text
  )
end

Instance Method Details

- (Boolean) ==(other)

:nocov:

Parameters:

Returns:

  • (Boolean)


30
31
32
33
34
35
36
# File 'lib/common/models/vulnerability.rb', line 30

def ==(other)
  title == other.title &&
      type == other.type &&
      references == other.references &&
      fixed_in == other.fixed_in &&
      metasploit_modules == other.metasploit_modules
end