Class: Msf::Module::SiteReference
- Defined in:
- lib/msf/core/module/reference.rb
Overview
A reference to a website.
Instance Attribute Summary collapse
-
#ctx_id ⇒ Object
The context identifier of the site, such as CVE.
-
#ctx_val ⇒ Object
The context value of the reference, such as MS02-039.
-
#site ⇒ Object
The site being referenced.
Attributes inherited from Reference
Class Method Summary collapse
-
.from_a(ary) ⇒ Object
Initializes a site reference from an array.
-
.from_s(str) ⇒ Object
Class method that translates a URL into a site reference instance.
Instance Method Summary collapse
-
#from_s(str) ⇒ Object
Serializes a site URL string.
-
#initialize(in_ctx_id = 'Unknown', in_ctx_val = '') ⇒ SiteReference
constructor
Initialize the site reference.
-
#to_s ⇒ Object
Returns the absolute site URL.
Methods inherited from Reference
Constructor Details
#initialize(in_ctx_id = 'Unknown', in_ctx_val = '') ⇒ SiteReference
Initialize the site reference. If you're updating the references, please also update:
-
tools/module_reference.rb
-
github.com/rapid7/metasploit-framework/wiki/Metasploit-module-reference-identifiers
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/msf/core/module/reference.rb', line 94 def initialize(in_ctx_id = 'Unknown', in_ctx_val = '') self.ctx_id = in_ctx_id self.ctx_val = in_ctx_val if in_ctx_id == 'CVE' self.site = "https://cvedetails.com/cve/CVE-#{in_ctx_val}/" elsif in_ctx_id == 'CWE' self.site = "https://cwe.mitre.org/data/definitions/#{in_ctx_val}.html" elsif in_ctx_id == 'BID' self.site = "http://www.securityfocus.com/bid/#{in_ctx_val}" elsif in_ctx_id == 'MSB' year = in_ctx_val[2..3] century = year[0] == '9' ? '19' : '20' self.site = "https://docs.microsoft.com/en-us/security-updates/SecurityBulletins/#{century}#{year}/#{in_ctx_val}" elsif in_ctx_id == 'EDB' self.site = "https://www.exploit-db.com/exploits/#{in_ctx_val}" elsif in_ctx_id == 'US-CERT-VU' self.site = "https://www.kb.cert.org/vuls/id/#{in_ctx_val}" elsif in_ctx_id == 'ZDI' self.site = "http://www.zerodayinitiative.com/advisories/ZDI-#{in_ctx_val}" elsif in_ctx_id == 'WPVDB' self.site = "https://wpvulndb.com/vulnerabilities/#{in_ctx_val}" elsif in_ctx_id == 'PACKETSTORM' self.site = "https://packetstormsecurity.com/files/#{in_ctx_val}" elsif in_ctx_id == 'URL' self.site = in_ctx_val.to_s elsif in_ctx_id == 'LOGO' self.site = "Logo: #{in_ctx_val}" elsif in_ctx_id == 'SOUNDTRACK' self.site = "Soundtrack: #{in_ctx_val}" else self.site = in_ctx_id self.site += " (#{in_ctx_val})" if (in_ctx_val) end end |
Instance Attribute Details
#ctx_id ⇒ Object
The context identifier of the site, such as CVE.
159 160 161 |
# File 'lib/msf/core/module/reference.rb', line 159 def ctx_id @ctx_id end |
#ctx_val ⇒ Object
The context value of the reference, such as MS02-039
163 164 165 |
# File 'lib/msf/core/module/reference.rb', line 163 def ctx_val @ctx_val end |
#site ⇒ Object
The site being referenced.
155 156 157 |
# File 'lib/msf/core/module/reference.rb', line 155 def site @site end |
Class Method Details
.from_a(ary) ⇒ Object
82 83 84 85 86 |
# File 'lib/msf/core/module/reference.rb', line 82 def self.from_a(ary) return nil if (ary.length < 2) self.new(ary[0], ary[1]) end |
.from_s(str) ⇒ Object
Class method that translates a URL into a site reference instance.
68 69 70 71 72 73 74 75 76 |
# File 'lib/msf/core/module/reference.rb', line 68 def self.from_s(str) instance = self.new if (instance.from_s(str) == false) return nil end return instance end |
Instance Method Details
#from_s(str) ⇒ Object
Serializes a site URL string.
140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/msf/core/module/reference.rb', line 140 def from_s(str) if (/(http:\/\/|https:\/\/|ftp:\/\/)/.match(str)) self.site = str self.ctx_id = 'URL' self.ctx_val = self.site else return false end return true end |
#to_s ⇒ Object
Returns the absolute site URL.
133 134 135 |
# File 'lib/msf/core/module/reference.rb', line 133 def to_s return site || '' end |