This commit is contained in:
erwanlr
2019-10-12 11:48:14 +01:00
parent af7804ca23
commit 0e429700c6
3 changed files with 8 additions and 2 deletions

View File

@@ -19,7 +19,7 @@ module WPScan
# scope_url_pattern is from CMSScanner::Target
pattern = %r{#{scope_url_pattern}([\w\s\-/]+?)\\?/(?:themes|plugins|uploads|cache)\\?/}i
in_scope_uris(homepage_res) do |uri|
in_scope_uris(homepage_res, '//link/@href|//script/@src|//img/@src') do |uri|
return @content_dir = Regexp.last_match[1] if uri.to_s.match(pattern)
end

View File

@@ -0,0 +1,3 @@
<!-- Those one should not be detected -->
<a href="https://ex.lo/wordpress/plugins/">PLUGINS WORDPRESS</a>
<a href="https://ex.lo/wordpress/plugins/something/">PLUGINS WORDPRESS</a>

View File

@@ -9,11 +9,14 @@ shared_examples 'WordPress::CustomDirectories' do
relative_one: 'wp-content', relative_two: 'wp-content', cache: 'wp-content',
in_raw_js: 'wp-content', in_raw_js_escaped: 'wp-content', with_sub_dir: 'app',
relative_two_sub_dir: 'cms/wp-content', in_meta_content: 'wp-content',
themes_path_plugin_folder: 'wp-content'
themes_path_plugin_folder: 'wp-content', simple_link: nil
}.each do |file, expected|
it "returns #{expected} for #{file}.html" do
stub_request(:get, target.url).to_return(body: File.read(fixtures.join("#{file}.html")))
# For cases where the expected is nil
allow(target).to receive(:default_content_dir_exists?).and_return(false)
expect(target.content_dir).to eql expected
end
end