Module: CMSScanner::References
- Extended by:
- ActiveSupport::Concern
- Included in:
- Vulnerability
- Defined in:
- lib/cms_scanner/references.rb
Overview
References related to the issue
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#cve_url(cve) ⇒ String
The URL to the CVE.
- #cve_urls ⇒ Array<String>
-
#cves ⇒ Array<String>
The CVEs.
-
#exploitdb_ids ⇒ Array<String>
The ExploitDB ID.
- #exploitdb_url(id) ⇒ String
- #exploitdb_urls ⇒ Array<String>
-
#msf_modules ⇒ Array<String>
The metasploit modules.
-
#msf_url(mod) ⇒ String
The URL to the metasploit module page.
- #msf_urls ⇒ Array<String>
-
#packetstorm_ids ⇒ Array<String>
The Packetstormsecurity IDs.
- #packetstorm_url(id) ⇒ String
- #packetstorm_urls ⇒ Array<String>
- #references ⇒ Hash
- #references=(refs) ⇒ Object
-
#references_urls ⇒ Array<String>
All the references URLs.
-
#securityfocus_ids ⇒ Array<String>
The Security Focus IDs.
- #securityfocus_url(id) ⇒ String
- #securityfocus_urls ⇒ Array<String>
- #urls ⇒ String<Array>
- #youtube_url(id) ⇒ String
- #youtube_urls ⇒ Array<String>
Instance Method Details
#cve_url(cve) ⇒ String
Returns The URL to the CVE.
53 54 55 |
# File 'lib/cms_scanner/references.rb', line 53 def cve_url(cve) "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-#{cve}" end |
#cve_urls ⇒ Array<String>
48 49 50 |
# File 'lib/cms_scanner/references.rb', line 48 def cve_urls cves.reduce([]) { |acc, elem| acc << cve_url(elem) } end |
#cves ⇒ Array<String>
Returns The CVEs.
43 44 45 |
# File 'lib/cms_scanner/references.rb', line 43 def cves references[:cve] || [] end |
#exploitdb_ids ⇒ Array<String>
Returns The ExploitDB ID.
58 59 60 |
# File 'lib/cms_scanner/references.rb', line 58 def exploitdb_ids references[:exploitdb] || [] end |
#exploitdb_url(id) ⇒ String
68 69 70 |
# File 'lib/cms_scanner/references.rb', line 68 def exploitdb_url(id) "https://www.exploit-db.com/exploits/#{id}/" end |
#exploitdb_urls ⇒ Array<String>
63 64 65 |
# File 'lib/cms_scanner/references.rb', line 63 def exploitdb_urls exploitdb_ids.reduce([]) { |acc, elem| acc << exploitdb_url(elem) } end |
#msf_modules ⇒ Array<String>
Returns The metasploit modules.
78 79 80 |
# File 'lib/cms_scanner/references.rb', line 78 def msf_modules references[:metasploit] || [] end |
#msf_url(mod) ⇒ String
Returns The URL to the metasploit module page.
88 89 90 |
# File 'lib/cms_scanner/references.rb', line 88 def msf_url(mod) "https://www.rapid7.com/db/modules/#{mod.sub(%r{^/}, '')}/" end |
#msf_urls ⇒ Array<String>
83 84 85 |
# File 'lib/cms_scanner/references.rb', line 83 def msf_urls msf_modules.reduce([]) { |acc, elem| acc << msf_url(elem) } end |
#packetstorm_ids ⇒ Array<String>
Returns The Packetstormsecurity IDs.
93 94 95 |
# File 'lib/cms_scanner/references.rb', line 93 def packetstorm_ids @packetstorm_ids ||= references[:packetstorm] || [] end |
#packetstorm_url(id) ⇒ String
103 104 105 |
# File 'lib/cms_scanner/references.rb', line 103 def packetstorm_url(id) "https://packetstormsecurity.com/files/#{id}/" end |
#packetstorm_urls ⇒ Array<String>
98 99 100 |
# File 'lib/cms_scanner/references.rb', line 98 def packetstorm_urls packetstorm_ids.reduce([]) { |acc, elem| acc << packetstorm_url(elem) } end |
#references ⇒ Hash
32 33 34 |
# File 'lib/cms_scanner/references.rb', line 32 def references @references ||= {} end |
#references=(refs) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cms_scanner/references.rb', line 17 def references=(refs) @references = {} self.class.references_keys.each do |key| next unless refs.key?(key) @references[key] = if key == :youtube Array(refs[:youtube]).map { |id| youtube_url(id) } else Array(refs[key]).map(&:to_s) end end end |
#references_urls ⇒ Array<String>
Returns All the references URLs.
37 38 39 40 |
# File 'lib/cms_scanner/references.rb', line 37 def references_urls cve_urls + exploitdb_urls + urls + msf_urls + packetstorm_urls + securityfocus_urls + youtube_urls end |
#securityfocus_ids ⇒ Array<String>
Returns The Security Focus IDs.
108 109 110 |
# File 'lib/cms_scanner/references.rb', line 108 def securityfocus_ids references[:securityfocus] || [] end |
#securityfocus_url(id) ⇒ String
118 119 120 |
# File 'lib/cms_scanner/references.rb', line 118 def securityfocus_url(id) "https://www.securityfocus.com/bid/#{id}/" end |
#securityfocus_urls ⇒ Array<String>
113 114 115 |
# File 'lib/cms_scanner/references.rb', line 113 def securityfocus_urls securityfocus_ids.reduce([]) { |acc, elem| acc << securityfocus_url(elem) } end |
#urls ⇒ String<Array>
73 74 75 |
# File 'lib/cms_scanner/references.rb', line 73 def urls references[:url] || [] end |
#youtube_url(id) ⇒ String
128 129 130 |
# File 'lib/cms_scanner/references.rb', line 128 def youtube_url(id) "https://www.youtube.com/watch?v=#{id}" end |
#youtube_urls ⇒ Array<String>
123 124 125 |
# File 'lib/cms_scanner/references.rb', line 123 def youtube_urls references[:youtube] || [] end |