Fixed false positive theme detection

This commit is contained in:
Christian Mehlmauer
2014-07-16 18:25:35 +02:00
parent 102e30c29a
commit 6ebb9b6f66
6 changed files with 50 additions and 22 deletions

View File

@@ -30,13 +30,13 @@ class WpTheme < WpItem
response = Browser.get_and_follow_location(target_uri.to_s)
# https + domain is optional because of relative links
matches = %r{(?:https?://[^"']+)?/([^/]+)/themes/([^"']+)/style.css}i.match(response.body)
matches = /(?:https?:\/\/[^"']+)?\/([^\/]+)\/themes\/([^"'\/]+)[^"']*\/style.css/i.match(response.body)
if matches
return new(
target_uri,
{
name: matches[2],
style_url: matches[0],
additional_url: matches[0],
wp_content_dir: matches[1]
}
)

View File

@@ -7,6 +7,7 @@ class WpTheme
def additional_output(verbose = false)
theme_desc = verbose ? @theme_description : truncate(@theme_description, 100)
puts " | Style URL: #{style_url}"
puts " | Additional URL: #{additional_url}" if additional_url
puts " | Theme Name: #@theme_name" if @theme_name
puts " | Theme URI: #@theme_uri" if @theme_uri
puts " | Description: #{theme_desc}"