Class: Ronin::DB::Advisory
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Ronin::DB::Advisory
- Includes:
- Model, Model::Importable
- Defined in:
- lib/ronin/db/advisory.rb
Overview
Represents a vulnerability Advisory, with a Publisher, Number and URL.
Defined Under Namespace
Modules: ID
Instance Attribute Summary collapse
-
#host_names ⇒ Array<HostName>
The host names that are vulnerable to this advisory.
-
#id ⇒ String
Primary key of the advisory.
-
#identifier ⇒ String
The advisory identifier.
-
#ip_addresses ⇒ Array<IPAddress>
The IP Addresses that are vulnerable to this advisory.
-
#mac_addresses ⇒ Array<MACAddress>
The MAC Addresses that are vulnerable to this advisory.
-
#notes ⇒ Array<Note>
The associated notes.
-
#open_ports ⇒ Array<OpenPort>
The open ports that are vulnerable to this advisory.
-
#prefix ⇒ String
The ID prefix (ex:
CVE
orGHSA
). -
#urls ⇒ Array<URL>
The URLs that are vulnerable to this advisory.
-
#vulnerabilities ⇒ Array<Vulnerability>
The vulnerabilities which reference the advisory.
-
#year ⇒ Integer
The year the advisory was published in.
Class Method Summary collapse
-
.import(id) ⇒ Advisory
Parses an Advisory ID String.
-
.lookup(id) ⇒ Advisory?
Looks up the advisory.
Instance Method Summary collapse
-
#to_s ⇒ String
Converts the advisory to a String.
-
#url ⇒ String?
Generates a URL for the advisory.
Methods included from Model::Importable
Methods included from Model
Instance Attribute Details
#host_names ⇒ Array<HostName>
The host names that are vulnerable to this advisory.
108 |
# File 'lib/ronin/db/advisory.rb', line 108 has_many :host_names, through: :vulnerabilities |
#id ⇒ String
Primary key of the advisory.
43 |
# File 'lib/ronin/db/advisory.rb', line 43 attribute :id, :string |
#identifier ⇒ String
The advisory identifier
67 |
# File 'lib/ronin/db/advisory.rb', line 67 attribute :identifier, :string |
#ip_addresses ⇒ Array<IPAddress>
The IP Addresses that are vulnerable to this advisory.
92 |
# File 'lib/ronin/db/advisory.rb', line 92 has_many :ip_addresses, through: :vulnerabilities |
#mac_addresses ⇒ Array<MACAddress>
The MAC Addresses that are vulnerable to this advisory.
84 |
# File 'lib/ronin/db/advisory.rb', line 84 has_many :mac_addresses, through: :vulnerabilities |
#notes ⇒ Array<Note>
The associated notes.
125 |
# File 'lib/ronin/db/advisory.rb', line 125 has_many :notes, dependent: :destroy |
#open_ports ⇒ Array<OpenPort>
The open ports that are vulnerable to this advisory.
100 |
# File 'lib/ronin/db/advisory.rb', line 100 has_many :open_ports, through: :vulnerabilities |
#prefix ⇒ String
The ID prefix (ex: CVE
or GHSA
).
49 |
# File 'lib/ronin/db/advisory.rb', line 49 attribute :prefix, :string |
#urls ⇒ Array<URL>
The URLs that are vulnerable to this advisory.
116 117 |
# File 'lib/ronin/db/advisory.rb', line 116 has_many :urls, through: :vulnerabilities, class_name: 'URL' |
#vulnerabilities ⇒ Array<Vulnerability>
The vulnerabilities which reference the advisory.
76 |
# File 'lib/ronin/db/advisory.rb', line 76 has_many :vulnerabilities, dependent: :destroy |
#year ⇒ Integer
The year the advisory was published in.
56 |
# File 'lib/ronin/db/advisory.rb', line 56 attribute :year, :integer |
Class Method Details
.import(id) ⇒ Advisory
Parses an Advisory ID String.
192 193 194 |
# File 'lib/ronin/db/advisory.rb', line 192 def self.import(id) create(**ID.parse(id)) end |
.lookup(id) ⇒ Advisory?
Looks up the advisory.
177 178 179 |
# File 'lib/ronin/db/advisory.rb', line 177 def self.lookup(id) find_by(id: id) end |
Instance Method Details
#to_s ⇒ String
Converts the advisory to a String.
220 221 222 |
# File 'lib/ronin/db/advisory.rb', line 220 def to_s self.id end |
#url ⇒ String?
Generates a URL for the advisory.
204 205 206 207 208 209 210 |
# File 'lib/ronin/db/advisory.rb', line 204 def url case prefix when 'CVE' then "https://nvd.nist.gov/vuln/detail/#{id}" when 'RHSA' then "https://access.redhat.com/errata/#{id}" when 'GHSA' then "https://github.com/advisories/#{id}" end end |