Browser::Actions (no specs)

This commit is contained in:
erwanlr
2013-04-09 17:43:15 +02:00
parent 2a45878a55
commit 3525fb87e2
23 changed files with 121 additions and 95 deletions

View File

@@ -17,7 +17,7 @@ class WpTarget < WebSite
unless @malwares
malwares_found = []
malwares_file = Malwares.malwares_file(malwares_file_path)
index_page_body = Browser.instance.get(@uri.to_s).body
index_page_body = Browser.get(@uri.to_s).body
File.open(malwares_file, 'r') do |file|
file.readlines.collect do |url|

View File

@@ -6,7 +6,7 @@ class WpTarget < WebSite
# @return [ String ] The wp-content directory
def wp_content_dir
unless @wp_content_dir
index_body = Browser.instance.get(@uri.to_s).body
index_body = Browser.get(@uri.to_s).body
uri_path = @uri.path # Only use the path because domain can be text or an IP
if index_body[/\/wp-content\/(?:themes|plugins)\//i] || default_wp_content_dir_exists?
@@ -22,7 +22,7 @@ class WpTarget < WebSite
# @return [ Boolean ]
def default_wp_content_dir_exists?
response = Browser.instance.get(@uri.merge('wp-content').to_s)
response = Browser.get(@uri.merge('wp-content').to_s)
hash = Digest::MD5.hexdigest(response.body)
if WpTarget.valid_response_codes.include?(response.code)
@@ -42,7 +42,7 @@ class WpTarget < WebSite
# @return [ Boolean ]
def wp_plugins_dir_exists?
Browser.instance.get(@uri.merge(wp_plugins_dir)).code != 404
Browser.get(@uri.merge(wp_plugins_dir).to_s).code != 404
end
end

View File

@@ -7,7 +7,7 @@ class WpTarget < WebSite
#
# @return [ Boolean ]
def has_full_path_disclosure?
response = Browser.instance.get(full_path_disclosure_url())
response = Browser.get(full_path_disclosure_url())
response.body[%r{Fatal error}i] ? true : false
end

View File

@@ -38,17 +38,17 @@ class WpTarget < WebSite
# Thanks to Alip Aswalid for providing this method.
# http://wordpress.org/extend/plugins/login-lockdown/
def has_login_lockdown_protection?
Browser.instance.get(login_url).body =~ %r{Login LockDown}i ? true : false
Browser.get(login_url).body =~ %r{Login LockDown}i ? true : false
end
# http://wordpress.org/extend/plugins/login-lock/
def has_login_lock_protection?
Browser.instance.get(login_url).body =~ %r{LOGIN LOCK} ? true : false
Browser.get(login_url).body =~ %r{LOGIN LOCK} ? true : false
end
# http://wordpress.org/extend/plugins/better-wp-security/
def has_better_wp_security_protection?
Browser.instance.get(better_wp_security_url).code != 404
Browser.get(better_wp_security_url).code != 404
end
def plugin_url(plugin_name)
@@ -66,7 +66,7 @@ class WpTarget < WebSite
# http://wordpress.org/extend/plugins/simple-login-lockdown/
def has_simple_login_lockdown_protection?
Browser.instance.get(simple_login_lockdown_url).code != 404
Browser.get(simple_login_lockdown_url).code != 404
end
def simple_login_lockdown_url
@@ -75,7 +75,7 @@ class WpTarget < WebSite
# http://wordpress.org/extend/plugins/login-security-solution/
def has_login_security_solution_protection?
Browser.instance.get(login_security_solution_url()).code != 404
Browser.get(login_security_solution_url()).code != 404
end
def login_security_solution_url
@@ -84,7 +84,7 @@ class WpTarget < WebSite
# http://wordpress.org/extend/plugins/limit-login-attempts/
def has_limit_login_attempts_protection?
Browser.instance.get(limit_login_attempts_url).code != 404
Browser.get(limit_login_attempts_url).code != 404
end
def limit_login_attempts_url
@@ -93,7 +93,7 @@ class WpTarget < WebSite
# http://wordpress.org/extend/plugins/bluetrait-event-viewer/
def has_bluetrait_event_viewer_protection?
Browser.instance.get(bluetrait_event_viewer_url).code != 404
Browser.get(bluetrait_event_viewer_url).code != 404
end
def bluetrait_event_viewer_url

View File

@@ -10,7 +10,7 @@ class WpTarget < WebSite
#
# @return [ Boolean ]
def has_readme?
response = Browser.instance.get(readme_url())
response = Browser.get(readme_url())
unless response.code == 404
return response.body =~ %r{wordpress}i ? true : false

View File

@@ -7,7 +7,7 @@ class WpTarget < WebSite
#
# @return [ Boolean ]
def registration_enabled?
resp = Browser.instance.get(registration_url)
resp = Browser.get(registration_url)
# redirect only on non multi sites
if resp.code == 302 and resp.headers_hash['location'] =~ /wp-login\.php\?registration=disabled/i
enabled = false
@@ -34,8 +34,7 @@ class WpTarget < WebSite
unless @multisite
# when multi site, there is no redirection or a redirect to the site itself
# otherwise redirect to wp-login.php
url = @uri.merge('wp-signup.php')
resp = Browser.instance.get(url)
resp = Browser.get(@uri.merge('wp-signup.php').to_s)
if resp.code == 302 and resp.headers_hash['location'] =~ /wp-login\.php\?action=register/
@multisite = false