-) 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[:type] = "plugins"
|
||||
result = WpDetector.aggressive_detection(options)
|
||||
result
|
||||
result.sort_by { |p| p.name }
|
||||
end
|
||||
|
||||
private
|
||||
@@ -51,7 +51,7 @@ module WpPlugins
|
||||
:wp_content_dir => wp_content_dir
|
||||
)
|
||||
end
|
||||
plugins
|
||||
plugins.sort_by { |p| p.name }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -25,7 +25,7 @@ module WpThemes
|
||||
options[:vulns_xpath_2] = "//theme"
|
||||
options[:type] = "themes"
|
||||
result = WpDetector.aggressive_detection(options)
|
||||
result
|
||||
result.sort_by { |t| t.name }
|
||||
end
|
||||
|
||||
private
|
||||
@@ -42,7 +42,7 @@ module WpThemes
|
||||
:wp_content_dir => wp_content_dir
|
||||
)
|
||||
end
|
||||
themes
|
||||
themes.sort_by { |t| t.name }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -28,7 +28,17 @@ class WpDetector
|
||||
|
||||
enum_results = WpEnumerator.enumerate(options)
|
||||
enum_results.each do |enum_result|
|
||||
result << 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
|
||||
end
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
@@ -21,6 +21,8 @@ require "#{WPSCAN_LIB_DIR}/vulnerable"
|
||||
class WpPlugin < Vulnerable
|
||||
include WpItem
|
||||
|
||||
attr_reader :name
|
||||
|
||||
def initialize(options = {})
|
||||
@base_url = options[:url]
|
||||
@path = options[:path]
|
||||
|
||||
@@ -137,7 +137,7 @@ shared_examples_for "WpPlugins" do
|
||||
end
|
||||
|
||||
# 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
|
||||
@expected_plugins = []
|
||||
|
||||
|
||||
@@ -120,13 +120,18 @@ describe WpPlugin do
|
||||
end
|
||||
|
||||
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.location_url.should === location_url
|
||||
wp_plugin.get_url.should === location_url
|
||||
end
|
||||
|
||||
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.location_url.should === location_url
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user