use constants for data files

This commit is contained in:
Christian Mehlmauer
2013-01-19 21:33:07 +01:00
parent 5d6ce70863
commit 14be8c700f
9 changed files with 24 additions and 15 deletions

View File

@@ -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"

View File

@@ -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"

View File

@@ -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

View File

@@ -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"

View File

@@ -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]

View File

@@ -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