show_progress_bar renamed to show_progression

This commit is contained in:
erwanlr
2013-01-04 15:15:14 +01:00
parent e2bb5dc24f
commit c0eadd22db
7 changed files with 63 additions and 62 deletions

View File

@@ -29,7 +29,7 @@ class WpEnumerator
# * * +:path+ - Path to plugin
# * +type+ - "plugins" or "themes", item to enumerate
# * +filename+ - filename in the data directory with paths
# * +show_progress_bar+ - Show a progress bar during enumeration
# * +show_progression+ - Show a progress bar during enumeration
def self.enumerate(options = {}, items = nil)
WpOptions.check_options(options)
@@ -49,6 +49,7 @@ class WpEnumerator
enum_hydra = enum_browser.hydra
enumerate_size = targets.size
exclude_regexp = options[:exclude_content_based] ? %r{#{options[:exclude_content_based]}} : nil
show_progression = options[:show_progression] || false
targets.each do |target|
url = target.get_full_url
@@ -59,7 +60,7 @@ class WpEnumerator
request.on_complete do |response|
page_hash = Digest::MD5.hexdigest(response.body)
print "\rChecking for #{enumerate_size} total #{options[:type]}... #{(request_count * 100) / enumerate_size}% complete." if options[:show_progress_bar]
print "\rChecking for #{enumerate_size} total #{options[:type]}... #{(request_count * 100) / enumerate_size}% complete." if show_progression
if WpTarget.valid_response_codes.include?(response.code)
if page_hash != options[:error_404_hash] and page_hash != options[:homepage_hash]

View File

@@ -27,7 +27,7 @@
# * +vulns_xpath+ - XPath for vulnerability XML file
# * +vulns_xpath_2+ - XPath for vulnerability XML file
# * +wp_content_dir+ - Name of the wp-content directory
# * +show_progress_bar+ - Show a progress bar during enumeration
# * +show_progression+ - Show a progress bar during enumeration
# * +error_404_hash+ - MD5 hash of a 404 page
# * +type+ - Type: plugins, themes
class WpOptions
@@ -39,7 +39,7 @@ class WpOptions
raise("vulns_xpath must be set") unless options[:vulns_xpath] != nil and options[:vulns_xpath].length > 0
raise("vulns_xpath_2 must be set") unless options[:vulns_xpath_2] != nil and options[:vulns_xpath_2].length > 0
raise("wp_content_dir must be set") unless options[:wp_content_dir] != nil and options[:wp_content_dir].length > 0
raise("show_progress_bar must be set") unless options[:show_progress_bar] != nil
raise("show_progression must be set") unless options[:show_progression] != nil
raise("error_404_hash must be set") unless options[:error_404_hash] != nil and options[:error_404_hash].length > 0
raise("type must be set") unless options[:type] != nil and options[:type].length > 0

View File

@@ -35,7 +35,7 @@ shared_examples_for "WpPlugins" do
@options = {
:base_url => @wp_url,
:only_vulnerable_ones => false,
:show_progress_bar => false,
:show_progression => false,
:error_404_hash => @module.error_404_hash,
:homepage_hash => @module.homepage_hash,
:vulns_file => @plugin_vulns_file,

View File

@@ -31,9 +31,10 @@ shared_examples_for "WpThemes" do
@module.error_404_hash = Digest::MD5.hexdigest("Error 404!")
@module.extend(WpThemes)
@options = {:base_url => @wp_url,
@options = {
:base_url => @wp_url,
:only_vulnerable_ones => false,
:show_progress_bar => false,
:show_progression => false,
:error_404_hash => Digest::MD5.hexdigest("Error 404!"),
:vulns_file => @theme_vulns_file,
:file => @themes_file,

View File

@@ -26,15 +26,14 @@ shared_examples_for "WpTimthumbs" do
@options[:wp_content_dir] = "wp-content"
@options[:name] = @theme_name
@options[:error_404_hash] = "xx"
@options[:show_progress_bar] = false
@options[:show_progression] = false
@options[:only_vulnerable_ones] = false
@options[:vulns_file] = "xx"
@options[:type] = "timthumbs"
@module = WpScanModuleSpec.new(@url)
@fixtures_dir = SPEC_FIXTURES_WPSCAN_MODULES_DIR + "/wp_timthumbs"
@timthumbs_file = @fixtures_dir + "/timthumbs.txt"
@targets_from_file =
%w{
@targets_from_file = %w{
http://example.localhost/wp-content/plugins/fotoslide/timthumb.php
http://example.localhost/wp-content/plugins/feature-slideshow/timthumb.php
}

View File

@@ -29,7 +29,7 @@ describe WpOptions do
@options[:vulns_xpath] = "vulns_xpath"
@options[:vulns_xpath_2] = "vulns_xpath_2"
@options[:wp_content_dir] = "wp_content_dir"
@options[:show_progress_bar] = true
@options[:show_progression] = true
@options[:error_404_hash] = "error_404_hash"
@options[:type] = "type"
@@ -105,9 +105,9 @@ describe WpOptions do
@message = "wp_content_dir must be set"
end
it "should raise an exception (show_progress_bar nil)" do
@options[:show_progress_bar] = nil
@message = "show_progress_bar must be set"
it "should raise an exception (show_progression nil)" do
@options[:show_progression] = nil
@message = "show_progression must be set"
end
it "should raise an exception (error_404_hash empty)" do

View File

@@ -213,7 +213,7 @@ begin
options = {
:base_url => wp_target.uri,
:only_vulnerable_ones => wpscan_options.enumerate_only_vulnerable_plugins || false,
:show_progress_bar => true,
:show_progression => true,
:wp_content_dir => wp_target.wp_content_dir,
:error_404_hash => wp_target.error_404_hash,
:homepage_hash => wp_target.homepage_hash,
@@ -272,7 +272,7 @@ begin
options = {
:base_url => wp_target.uri,
:only_vulnerable_ones => wpscan_options.enumerate_only_vulnerable_themes || false,
:show_progress_bar => true,
:show_progression => true,
:wp_content_dir => wp_target.wp_content_dir,
:error_404_hash => wp_target.error_404_hash,
:homepage_hash => wp_target.homepage_hash,
@@ -321,7 +321,7 @@ begin
options = {
:base_url => wp_target.uri,
:show_progress_bar => true,
:show_progression => true,
:wp_content_dir => wp_target.wp_content_dir,
:error_404_hash => wp_target.error_404_hash,
:homepage_hash => wp_target.homepage_hash,