diff --git a/lib/common_helper.rb b/lib/common_helper.rb index 9bda916c..61744862 100644 --- a/lib/common_helper.rb +++ b/lib/common_helper.rb @@ -72,6 +72,14 @@ def get_equal_string_end(stringarray = [""]) already_found end +# Since ruby 1.9.2, URI::escape is obsolete +# See http://rosettacode.org/wiki/URL_encoding#Ruby and http://www.ruby-forum.com/topic/207489 +module URI + def self.escape(str) + URI.encode_www_form_component(str).gsub("+", "%20") + end +end + if RUBY_VERSION < "1.9" class Array # Fix for grep with symbols in ruby <= 1.8.7 diff --git a/lib/wpscan/modules/malwares.rb b/lib/wpscan/modules/malwares.rb index c3eeeaee..b190f7c2 100644 --- a/lib/wpscan/modules/malwares.rb +++ b/lib/wpscan/modules/malwares.rb @@ -26,7 +26,7 @@ module Malwares # return array of string (url of malwares found) def malwares(malwares_file_path = nil) - if @malwares.nil? + unless @malwares malwares_found = [] malwares_file = Malwares.malwares_file(malwares_file_path) index_page_body = Browser.instance.get(@uri.to_s).body diff --git a/lib/wpscan/wp_target.rb b/lib/wpscan/wp_target.rb index 833d7810..1fbcd362 100644 --- a/lib/wpscan/wp_target.rb +++ b/lib/wpscan/wp_target.rb @@ -38,6 +38,7 @@ class WpTarget @verbose = options[:verbose] @wp_content_dir = options[:wp_content_dir] @wp_plugins_dir = options[:wp_plugins_dir] + @multisite = nil Browser.instance(options.merge(:max_threads => options[:threads])) end diff --git a/lib/wpscan/wpscan_options.rb b/lib/wpscan/wpscan_options.rb index 34942ca3..80f3eaf7 100644 --- a/lib/wpscan/wpscan_options.rb +++ b/lib/wpscan/wpscan_options.rb @@ -45,7 +45,9 @@ class WpscanOptions attr_accessor *ACCESSOR_OPTIONS def initialize - + ACCESSOR_OPTIONS.each do |option| + instance_variable_set("@#{option}", nil) + end end def url=(url)