Skip to content

Commit 7d2b8a2

Browse files
committed
Reduces time to detect non WP sites when there are a lof of links in pages
1 parent 8729c68 commit 7d2b8a2

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

app/controllers/custom_directories.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ def before_scan
1818
target.content_dir = ParsedCli.wp_content_dir if ParsedCli.wp_content_dir
1919
target.plugins_dir = ParsedCli.wp_plugins_dir if ParsedCli.wp_plugins_dir
2020

21-
return if target.content_dir
22-
23-
raise Error::WpContentDirNotDetected
21+
raise Error::WpContentDirNotDetected unless target.content_dir
2422
end
2523
end
2624
end

lib/wpscan/target/platform/wordpress.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def wordpress?(detection_mode)
4444
# @param [ Typhoeus::Response ] response
4545
# @return [ Boolean ]
4646
def wordpress_from_meta_comments_or_scripts?(response)
47-
in_scope_uris(response) do |uri|
47+
in_scope_uris(response, '//link/@href|//script/@src|//img/@src') do |uri|
4848
return true if WORDPRESS_PATTERN.match?(uri.path) || WP_JSON_OEMBED_PATTERN.match?(uri.path)
4949
end
5050

@@ -100,8 +100,9 @@ def wordpress_hosted?
100100

101101
unless content_dir
102102
pattern = %r{https?://s\d\.wp\.com#{WORDPRESS_PATTERN}}i.freeze
103+
xpath = '//@href[contains(., "wp.com")]|//@src[contains(., "wp.com")]'
103104

104-
uris_from_page(homepage_res) do |uri|
105+
uris_from_page(homepage_res, xpath) do |uri|
105106
return true if uri.to_s.match?(pattern)
106107
end
107108
end

0 commit comments

Comments
 (0)