58 lines
1.2 KiB
Ruby
58 lines
1.2 KiB
Ruby
# encoding: UTF-8
|
|
|
|
class Vulnerability
|
|
module Output
|
|
|
|
# output the vulnerability
|
|
def output
|
|
puts ' |'
|
|
puts ' | ' + red("* Title: #{title}")
|
|
references.each do |key, urls|
|
|
urls.each do |u|
|
|
case(key)
|
|
when :url
|
|
url = u
|
|
when :metasploit
|
|
url = Output.metasploit_module_url(u)
|
|
when :secunia
|
|
url = Output.secunia_url(u)
|
|
when :osvdb
|
|
url = Output.osvdb_url(u)
|
|
when :cve
|
|
url = Output.cve_url(u)
|
|
when :exploitdb
|
|
url = Output.exploitdb_url(u)
|
|
else
|
|
url = u
|
|
end
|
|
puts ' | ' + red("* Reference: #{url}") if url
|
|
end
|
|
end
|
|
end
|
|
|
|
# @return [ String ] The url to the metasploit module page
|
|
def self.metasploit_module_url(module_path)
|
|
# remove leading slash
|
|
module_path = module_path.sub(/^\//, '')
|
|
"http://www.metasploit.com/modules/#{module_path}"
|
|
end
|
|
|
|
def self.cve_url(cve)
|
|
"http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-#{cve}"
|
|
end
|
|
|
|
def self.osvdb_url(id)
|
|
"http://osvdb.org/#{id}"
|
|
end
|
|
|
|
def self.secunia_url(id)
|
|
"http://secunia.com/advisories/#{id}"
|
|
end
|
|
|
|
def self.exploitdb_url(id)
|
|
"http://www.exploit-db.com/exploits/#{id}/"
|
|
end
|
|
|
|
end
|
|
end
|