use constants for data files
This commit is contained in:
@@ -22,9 +22,9 @@ module WpPlugins
|
||||
#
|
||||
# return array of WpPlugin
|
||||
def plugins_from_aggressive_detection(options)
|
||||
options[:file] = options[:file] || (options[:full] ? "#{DATA_DIR}/plugins_full.txt" : "#{DATA_DIR}/plugins.txt")
|
||||
options[:file] = options[:file] || (options[:full] ? PLUGINS_FULL_FILE : PLUGINS_FILE)
|
||||
options[:vulns_file] = (options[:vulns_file] != nil and options[:vulns_file] != "") ?
|
||||
options[:vulns_file] : DATA_DIR + "/plugin_vulns.xml"
|
||||
options[:vulns_file] : PLUGINS_VULNS_FILE
|
||||
options[:vulns_xpath] = "//plugin[@name='#{@name}']/vulnerability"
|
||||
options[:vulns_xpath_2] = "//plugin"
|
||||
options[:type] = "plugins"
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
module WpThemes
|
||||
|
||||
def themes_from_aggressive_detection(options)
|
||||
options[:file] = options[:file] || (options[:full] ? "#{DATA_DIR}/themes_full.txt" : "#{DATA_DIR}/themes.txt")
|
||||
options[:file] = options[:file] || (options[:full] ? THEMES_FULL_FILE : THEMES_FILE)
|
||||
options[:vulns_file] = (options[:vulns_file] != nil and options[:vulns_file] != "") ?
|
||||
options[:vulns_file] : DATA_DIR + "/theme_vulns.xml"
|
||||
options[:vulns_file] : THEMES_VULNS_FILE
|
||||
options[:vulns_xpath] = "//theme[@name='#{@name}']/vulnerability"
|
||||
options[:vulns_xpath_2] = "//theme"
|
||||
options[:type] = "themes"
|
||||
|
||||
@@ -57,9 +57,9 @@ class WpItem < Vulnerable
|
||||
def wp_org_item?
|
||||
case @type
|
||||
when "themes"
|
||||
file = "#{DATA_DIR}/themes_full.txt"
|
||||
file = THEMES_FULL_FILE
|
||||
when "plugins"
|
||||
file = "#{DATA_DIR}/plugins_full.txt"
|
||||
file = PLUGINS_FULL_FILE
|
||||
else
|
||||
raise("Unknown type #@type")
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
class WpPlugin < WpItem
|
||||
def initialize(options = {})
|
||||
options[:vulns_file] = (options[:vulns_file] != nil and options[:vulns_file] != "") ?
|
||||
options[:vulns_file] : DATA_DIR + "/plugin_vulns.xml"
|
||||
options[:vulns_file] : PLUGINS_VULNS_FILE
|
||||
options[:vulns_xpath] = "//plugin[@name='$name$']/vulnerability"
|
||||
options[:vulns_xpath_2] = "//plugin"
|
||||
options[:type] = "plugins"
|
||||
|
||||
@@ -24,7 +24,7 @@ class WpTheme < WpItem
|
||||
|
||||
def initialize(options = {})
|
||||
options[:vulns_file] = (options[:vulns_file] != nil and options[:vulns_file] != "") ?
|
||||
options[:vulns_file] : DATA_DIR + "/theme_vulns.xml"
|
||||
options[:vulns_file] : THEMES_VULNS_FILE
|
||||
options[:vulns_xpath] = "//theme[@name='$name$']/vulnerability"
|
||||
options[:type] = "themes"
|
||||
@version = options[:version]
|
||||
|
||||
@@ -25,7 +25,7 @@ class WpVersion < Vulnerable
|
||||
def initialize(number, options = {})
|
||||
@number = number
|
||||
@discovery_method = options[:discovery_method]
|
||||
@vulns_file = options[:vulns_file] || DATA_DIR + '/wp_vulns.xml'
|
||||
@vulns_file = options[:vulns_file] || WP_VULNS_FILE
|
||||
@vulns_xpath = "//wordpress[@version='#{@number}']/vulnerability"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user