fix issue #265 - remove base64 images before passive detection
This commit is contained in:
@@ -73,6 +73,8 @@ class WpItems < Array
|
||||
def passive_detection(wp_target, options = {})
|
||||
results = new(wp_target)
|
||||
body = Browser.get(wp_target.url).body
|
||||
# improves speed
|
||||
body = remove_base64_images_from_html(body)
|
||||
names = body.scan(passive_detection_pattern(wp_target))
|
||||
|
||||
names.flatten.uniq.each { |name| results.add(name) }
|
||||
|
||||
@@ -149,3 +149,10 @@ def get_equal_string_end(stringarray = [''])
|
||||
end
|
||||
already_found
|
||||
end
|
||||
|
||||
def remove_base64_images_from_html(html)
|
||||
# remove data:image/png;base64, images
|
||||
base64regex = %r{(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?}
|
||||
imageregex = %r{data\s*:\s*image/[^\s;]+\s*;\s*base64\s*,\s*}
|
||||
html.gsub(/["']\s*#{imageregex}#{base64regex}\s*["']/, '""')
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user