This commit is contained in:
Christian Mehlmauer
2013-08-25 09:38:25 +02:00
parent a032b7c134
commit 5cc9df9599
3 changed files with 37 additions and 39 deletions

View File

@@ -1,9 +1,11 @@
# encoding: UTF-8
require 'vulnerability/output'
require 'vulnerability/urls'
class Vulnerability
include Vulnerability::Output
include Vulnerability::Urls
attr_accessor :title, :references, :type, :fixed_in

View File

@@ -8,50 +8,13 @@ class Vulnerability
puts ' |'
puts ' | ' + red("* Title: #{title}")
references.each do |key, urls|
methodname = "url_#{key}"
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
url = send(methodname, u)
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

View File

@@ -0,0 +1,33 @@
# encoding: UTF-8
class Vulnerability
module Urls
# @return [ String ] The url to the metasploit module page
def url_metasploit(module_path)
# remove leading slash
module_path = module_path.sub(/^\//, '')
"http://www.metasploit.com/modules/#{module_path}"
end
def url_url(url)
url
end
def url_cve(cve)
"http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-#{cve}"
end
def url_osvdb(id)
"http://osvdb.org/#{id}"
end
def url_secunia(id)
"http://secunia.com/advisories/#{id}"
end
def url_exploitdb(id)
"http://www.exploit-db.com/exploits/#{id}/"
end
end
end