-) removed double entries in output
-) Output is now sorted
This commit is contained in:
@@ -28,7 +28,7 @@ module WpPlugins
|
|||||||
options[:vulns_xpath_2] = "//plugin"
|
options[:vulns_xpath_2] = "//plugin"
|
||||||
options[:type] = "plugins"
|
options[:type] = "plugins"
|
||||||
result = WpDetector.aggressive_detection(options)
|
result = WpDetector.aggressive_detection(options)
|
||||||
result
|
result.sort_by { |p| p.name }
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -51,7 +51,7 @@ module WpPlugins
|
|||||||
:wp_content_dir => wp_content_dir
|
:wp_content_dir => wp_content_dir
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
plugins
|
plugins.sort_by { |p| p.name }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ module WpThemes
|
|||||||
options[:vulns_xpath_2] = "//theme"
|
options[:vulns_xpath_2] = "//theme"
|
||||||
options[:type] = "themes"
|
options[:type] = "themes"
|
||||||
result = WpDetector.aggressive_detection(options)
|
result = WpDetector.aggressive_detection(options)
|
||||||
result
|
result.sort_by { |t| t.name }
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -42,7 +42,7 @@ module WpThemes
|
|||||||
:wp_content_dir => wp_content_dir
|
:wp_content_dir => wp_content_dir
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
themes
|
themes.sort_by { |t| t.name }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -28,8 +28,18 @@ class WpDetector
|
|||||||
|
|
||||||
enum_results = WpEnumerator.enumerate(options)
|
enum_results = WpEnumerator.enumerate(options)
|
||||||
enum_results.each do |enum_result|
|
enum_results.each do |enum_result|
|
||||||
|
already_present = false
|
||||||
|
result.each do |r|
|
||||||
|
# Already found via passive detection
|
||||||
|
if r.name == enum_result.name
|
||||||
|
already_present = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not already_present
|
||||||
result << enum_result
|
result << enum_result
|
||||||
end
|
end
|
||||||
|
end
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ require "#{WPSCAN_LIB_DIR}/vulnerable"
|
|||||||
class WpPlugin < Vulnerable
|
class WpPlugin < Vulnerable
|
||||||
include WpItem
|
include WpItem
|
||||||
|
|
||||||
|
attr_reader :name
|
||||||
|
|
||||||
def initialize(options = {})
|
def initialize(options = {})
|
||||||
@base_url = options[:url]
|
@base_url = options[:url]
|
||||||
@path = options[:path]
|
@path = options[:path]
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ shared_examples_for "WpPlugins" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
# testing response codes
|
# testing response codes
|
||||||
WpPlugins.valid_response_codes.each do |valid_response_code|
|
WpTarget.valid_response_codes.each do |valid_response_code|
|
||||||
it "should detect the plugin if the reponse.code is #{valid_response_code}" do
|
it "should detect the plugin if the reponse.code is #{valid_response_code}" do
|
||||||
@expected_plugins = []
|
@expected_plugins = []
|
||||||
|
|
||||||
|
|||||||
@@ -120,13 +120,18 @@ describe WpPlugin do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should initialize the object (no options given), :name should be 'example'" do
|
it "should initialize the object (no options given), :name should be 'example'" do
|
||||||
wp_plugin = WpPlugin.new(location_url)
|
options = WpOptions.get_empty_options
|
||||||
|
options[:url] = location_url
|
||||||
|
wp_plugin = WpPlugin.new(options)
|
||||||
wp_plugin.name.should === 'example'
|
wp_plugin.name.should === 'example'
|
||||||
wp_plugin.location_url.should === location_url
|
wp_plugin.get_url.should === location_url
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should initialize the object (options[:name] = 'example')" do
|
it "should initialize the object (options[:name] = 'example')" do
|
||||||
wp_plugin = WpPlugin.new(location_url, :name => 'example')
|
options = WpOptions.get_empty_options
|
||||||
|
options[:url] = location_url
|
||||||
|
options[:name] = "example"
|
||||||
|
wp_plugin = WpPlugin.new(options)
|
||||||
wp_plugin.name.should === 'example'
|
wp_plugin.name.should === 'example'
|
||||||
wp_plugin.location_url.should === location_url
|
wp_plugin.location_url.should === location_url
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user