Class: Ronin::Exploits::Advisory
- Inherits:
-
Object
- Object
- Ronin::Exploits::Advisory
- Defined in:
- lib/ronin/exploits/advisory.rb
Overview
Represents a security advisory.
Instance Attribute Summary collapse
-
#id ⇒ String
readonly
The advisory ID.
-
#url ⇒ String
readonly
The advisory URL.
Class Method Summary collapse
-
.url_for(id) ⇒ String?
Generates a default URL for the given advisory ID.
Instance Method Summary collapse
-
#initialize(id, url = self.class.url_for(id)) ⇒ Advisory
constructor
Initializes the advisory.
-
#to_s ⇒ String
Converts the advisory to a String.
Constructor Details
#initialize(id, url = self.class.url_for(id)) ⇒ Advisory
Initializes the advisory.
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
#id ⇒ String (readonly)
The advisory ID.
36 37 38 |
# File 'lib/ronin/exploits/advisory.rb', line 36 def id @id end |
#url ⇒ String (readonly)
The advisory URL.
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.
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_s ⇒ String
Converts the advisory to a String.
79 80 81 |
# File 'lib/ronin/exploits/advisory.rb', line 79 def to_s @id.to_s end |