WpTarget.error_404_hash moved to WebSite module
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
|
||||
module WebSite
|
||||
|
||||
#@error_404_hash = nil
|
||||
|
||||
# Checks if the remote website is up.
|
||||
def online?
|
||||
Browser.instance.get(@uri.to_s).code != 0
|
||||
@@ -83,4 +85,17 @@ module WebSite
|
||||
|
||||
redirection
|
||||
end
|
||||
|
||||
# Return the MD5 hash of a 404 page
|
||||
def error_404_hash
|
||||
unless @error_404_hash
|
||||
non_existant_page = Digest::MD5.hexdigest(rand(9999999999).to_s) + ".html"
|
||||
|
||||
response = Browser.instance.get(@uri.merge(non_existant_page).to_s)
|
||||
|
||||
@error_404_hash = Digest::MD5.hexdigest(response.body)
|
||||
end
|
||||
|
||||
@error_404_hash
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,8 +29,6 @@ class WpTarget
|
||||
include WpThemes
|
||||
include BruteForce
|
||||
|
||||
@error_404_hash = nil
|
||||
|
||||
attr_reader :uri, :verbose
|
||||
|
||||
def initialize(target_url, options = {})
|
||||
@@ -60,19 +58,6 @@ class WpTarget
|
||||
url
|
||||
end
|
||||
|
||||
# Return the MD5 hash of a 404 page
|
||||
def error_404_hash
|
||||
unless @error_404_hash
|
||||
non_existant_page = Digest::MD5.hexdigest(rand(9999999999).to_s) + ".html"
|
||||
|
||||
response = Browser.instance.get(@uri.merge(non_existant_page).to_s)
|
||||
|
||||
@error_404_hash = Digest::MD5.hexdigest(response.body)
|
||||
end
|
||||
|
||||
@error_404_hash
|
||||
end
|
||||
|
||||
# Valid HTTP return codes
|
||||
def self.valid_response_codes
|
||||
[200, 301, 302, 401, 403, 500]
|
||||
|
||||
Reference in New Issue
Block a user