Fixes #1412
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
3
spec/fixtures/target/platform/wordpress/custom_directories/simple_link.html
vendored
Normal file
3
spec/fixtures/target/platform/wordpress/custom_directories/simple_link.html
vendored
Normal 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>
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user