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 = [])

Parameters:

  • title (String)

    The title of the vulnerability

  • type (String)

    The type of the vulnerability

  • references (Array)

    References urls

  • metasploit_modules (Array) (defaults to: [])

    Metasploit modules for the vulnerability



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

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

Instance Attribute Details

- (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:



38
39
40
41
42
43
44
45
# File 'lib/common/models/vulnerability.rb', line 38

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)
  )
end

Instance Method Details

- (Boolean) ==(other)

:nocov:

Parameters:

Returns:

  • (Boolean)


28
29
30
# File 'lib/common/models/vulnerability.rb', line 28

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