Warnings from URI::escape (obsolete since ruby 1.9.2) and some instance variables not initialized fixed

This commit is contained in:
Erwan
2012-10-23 16:36:57 +02:00
parent ddeb288171
commit d438f37f57
4 changed files with 13 additions and 2 deletions

View File

@@ -72,6 +72,14 @@ def get_equal_string_end(stringarray = [""])
already_found already_found
end 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" if RUBY_VERSION < "1.9"
class Array class Array
# Fix for grep with symbols in ruby <= 1.8.7 # Fix for grep with symbols in ruby <= 1.8.7

View File

@@ -26,7 +26,7 @@ module Malwares
# return array of string (url of malwares found) # return array of string (url of malwares found)
def malwares(malwares_file_path = nil) def malwares(malwares_file_path = nil)
if @malwares.nil? unless @malwares
malwares_found = [] malwares_found = []
malwares_file = Malwares.malwares_file(malwares_file_path) malwares_file = Malwares.malwares_file(malwares_file_path)
index_page_body = Browser.instance.get(@uri.to_s).body index_page_body = Browser.instance.get(@uri.to_s).body

View File

@@ -38,6 +38,7 @@ class WpTarget
@verbose = options[:verbose] @verbose = options[:verbose]
@wp_content_dir = options[:wp_content_dir] @wp_content_dir = options[:wp_content_dir]
@wp_plugins_dir = options[:wp_plugins_dir] @wp_plugins_dir = options[:wp_plugins_dir]
@multisite = nil
Browser.instance(options.merge(:max_threads => options[:threads])) Browser.instance(options.merge(:max_threads => options[:threads]))
end end

View File

@@ -45,7 +45,9 @@ class WpscanOptions
attr_accessor *ACCESSOR_OPTIONS attr_accessor *ACCESSOR_OPTIONS
def initialize def initialize
ACCESSOR_OPTIONS.each do |option|
instance_variable_set("@#{option}", nil)
end
end end
def url=(url) def url=(url)