Adds detection of wp-content from raw JS

This commit is contained in:
erwanlr
2019-03-14 09:14:55 +00:00
parent d30d212cc5
commit ab5f46e955
3 changed files with 9 additions and 2 deletions

View File

@@ -15,11 +15,15 @@ module WPScan
def content_dir
unless @content_dir
escaped_url = Regexp.escape(url).gsub(/https?/i, 'https?')
pattern = %r{#{escaped_url}(.+?)\/(?:themes|plugins|uploads|cache)\/}i
pattern = %r{#{escaped_url}([^\/]+)\/(?:themes|plugins|uploads|cache)\/}i
in_scope_urls(homepage_res) do |url|
return @content_dir = Regexp.last_match[1] if url.match(pattern)
end
xpath_pattern_from_page('//script[not(@src)]', pattern, homepage_res) do |match|
return @content_dir = match[1]
end
end
@content_dir