Class: Ronin::Exploits::Advisory

Inherits:
Object
  • Object
show all
Defined in:
lib/ronin/exploits/advisory.rb

Overview

Represents a security advisory.

Since:

  • 1.0.0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, url = self.class.url_for(id)) ⇒ Advisory

Initializes the advisory.

Parameters:

  • id (String)

    The advisory ID.

  • url (String) (defaults to: self.class.url_for(id))

    The advisory URL.

Since:

  • 1.0.0



52
53
54
55
# File 'lib/ronin/exploits/advisory.rb', line 52

def initialize(id,url=self.class.url_for(id))
  @id  = id
  @url = url
end

Instance Attribute Details

#idString (readonly)

The advisory ID.

Returns:

  • (String)

Since:

  • 1.0.0



36
37
38
# File 'lib/ronin/exploits/advisory.rb', line 36

def id
  @id
end

#urlString (readonly)

The advisory URL.

Returns:

  • (String)

Since:

  • 1.0.0



41
42
43
# File 'lib/ronin/exploits/advisory.rb', line 41

def url
  @url
end

Class Method Details

.url_for(id) ⇒ String?

Generates a default URL for the given advisory ID.

Parameters:

  • id (String)

    The advisory ID.

Returns:

  • (String, nil)

    The URL for the advisory.

Since:

  • 1.0.0



66
67
68
69
70
71
# File 'lib/ronin/exploits/advisory.rb', line 66

def self.url_for(id)
  case id
  when /\ACVE-/  then "https://nvd.nist.gov/vuln/detail/#{id}"
  when /\AGHSA-/ then "https://github.com/advisories/#{id}"
  end
end

Instance Method Details

#to_sString

Converts the advisory to a String.

Returns:

  • (String)

    The advisory ID.

Since:

  • 1.0.0



79
80
81
# File 'lib/ronin/exploits/advisory.rb', line 79

def to_s
  @id.to_s
end