WpItem::Vulnerable specs
This commit is contained in:
@@ -21,6 +21,15 @@ class Vulnerability
|
||||
@metasploit_modules = metasploit_modules
|
||||
end
|
||||
|
||||
# @param [ Vulnerability ] other
|
||||
#
|
||||
# @return [ Boolean ]
|
||||
# :nocov:
|
||||
def ==(other)
|
||||
title == other.title && type == other.type && references == other.references
|
||||
end
|
||||
# :nocov:
|
||||
|
||||
# Create the Vulnerability from the xml_node
|
||||
#
|
||||
# @param [ Nokogiri::XML::Node ] xml_node
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
class WpItem
|
||||
|
||||
# moved this into the module ?
|
||||
def vulns_file=(file)
|
||||
if File.exists?(file)
|
||||
@vulns_file = file
|
||||
else
|
||||
raise "The file #{file} does not exist"
|
||||
end
|
||||
end
|
||||
|
||||
module Vulnerable
|
||||
attr_accessor :vulns_file, :vulns_xpath
|
||||
|
||||
# Get the vulnerabilities associated to the WpItem
|
||||
#
|
||||
# @return [ Vulnerabilities ]
|
||||
def vulnerabilities
|
||||
xml = xml(vulns_file)
|
||||
@@ -23,4 +17,5 @@ class WpItem
|
||||
vulnerabilities
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
require 'wp_plugin/vulnerable'
|
||||
|
||||
class WpPlugin < WpItem
|
||||
include WpPlugin::Vulnerable
|
||||
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
class WpPlugin < WpItem
|
||||
|
||||
def vulns_file
|
||||
unless @vulns_file
|
||||
@vulns_file = PLUGINS_VULNS_FILE
|
||||
end
|
||||
@vulns_file
|
||||
end
|
||||
|
||||
def vulns_xpath
|
||||
"//plugin[@name='#{@name}']/vulnerability"
|
||||
end
|
||||
|
||||
module Vulnerable
|
||||
|
||||
end
|
||||
def vulns_file
|
||||
unless @vulns_file
|
||||
@vulns_file = PLUGINS_VULNS_FILE
|
||||
end
|
||||
@vulns_file
|
||||
end
|
||||
|
||||
def vulns_xpath
|
||||
"//plugin[@name='#{@name}']/vulnerability"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
require 'wp_theme/findable'
|
||||
require 'wp_theme/versionable'
|
||||
require 'wp_theme/vulnerable'
|
||||
|
||||
class WpTheme < WpItem
|
||||
extend WpTheme::Findable
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
class WpTheme < WpItem
|
||||
|
||||
def vulns_file
|
||||
unless @vulns_file
|
||||
@vulns_file = THEMES_VULNS_FILE
|
||||
end
|
||||
@vulns_file
|
||||
end
|
||||
|
||||
def vulns_xpath
|
||||
"//theme[@name='#{@name}']/vulnerability"
|
||||
end
|
||||
|
||||
module Vulnerable
|
||||
def vulns_file
|
||||
unless @vulns_file
|
||||
@vulns_file = THEMES_VULNS_FILE
|
||||
end
|
||||
@vulns_file
|
||||
end
|
||||
|
||||
def vulns_xpath
|
||||
"//theme[@name='#{@name}']/vulnerability"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -30,7 +30,6 @@ class WpVersion < WpItem
|
||||
|
||||
# Returns the first match of <pattern> in the body of the url
|
||||
def scan_url(target_uri, pattern, path = nil)
|
||||
return nil
|
||||
url = path ? target_uri.merge(path).to_s : target_uri.to_s
|
||||
response = Browser.instance.get_and_follow_location(url)
|
||||
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
class WpVersion < WpItem
|
||||
|
||||
def vulns_file
|
||||
unless @vulns_file
|
||||
@vulns_file = WP_VULNS_FILE
|
||||
end
|
||||
@vulns_file
|
||||
end
|
||||
|
||||
def vulns_xpath
|
||||
"//wordpress[@version='#{@number}']/vulnerability"
|
||||
end
|
||||
|
||||
module Vulnerable
|
||||
def vulns_file
|
||||
unless @vulns_file
|
||||
@vulns_file = WP_VULNS_FILE
|
||||
end
|
||||
@vulns_file
|
||||
end
|
||||
|
||||
def vulns_xpath
|
||||
"//wordpress[@version='#{@number}']/vulnerability"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user