diff --git a/lib/common/collections/wp_items/detectable.rb b/lib/common/collections/wp_items/detectable.rb index c2b89896..65dd0c77 100755 --- a/lib/common/collections/wp_items/detectable.rb +++ b/lib/common/collections/wp_items/detectable.rb @@ -83,7 +83,7 @@ class WpItems < Array results = new(wp_target) # improves speed body = remove_base64_images_from_html(Browser.get(wp_target.url).body) - page = Nokogiri::HTML(remove_conditional_comments(body)) + page = Nokogiri::HTML(body) names = [] page.css('link,script,style').each do |tag| diff --git a/lib/common/common_helper.rb b/lib/common/common_helper.rb index 3ccfd97e..38b4e0d7 100644 --- a/lib/common/common_helper.rb +++ b/lib/common/common_helper.rb @@ -73,10 +73,6 @@ def add_trailing_slash(url) url =~ /\/$/ ? url : "#{url}/" end -def remove_conditional_comments(text) - text.gsub(/\<\!--\[if[^>]+>(.*?)\<\!\[end[^>]+>/im, '\1') -end - # loading the updater require_files_from_directory(UPDATER_LIB_DIR) @updater = UpdaterFactory.get_updater(ROOT_DIR) diff --git a/spec/lib/common/collections/wp_items_spec.rb b/spec/lib/common/collections/wp_items_spec.rb index a1c7414a..31d37988 100644 --- a/spec/lib/common/collections/wp_items_spec.rb +++ b/spec/lib/common/collections/wp_items_spec.rb @@ -18,7 +18,7 @@ describe WpItems do vulnerable_targets_items: [ WpItem.new(uri, name: 'mr-smith'), WpItem.new(uri, name: 'neo')], - passive_detection: (1..15).reduce(WpItems.new) { |o, i| o << WpItem.new(uri, name: "detect-me-#{i}") } + passive_detection: (1..13).reduce(WpItems.new) { |o, i| o << WpItem.new(uri, name: "detect-me-#{i}") } } end end diff --git a/spec/samples/common/collections/wp_items/detectable/passive_detection.html b/spec/samples/common/collections/wp_items/detectable/passive_detection.html index 0332f74f..ad2216d9 100644 --- a/spec/samples/common/collections/wp_items/detectable/passive_detection.html +++ b/spec/samples/common/collections/wp_items/detectable/passive_detection.html @@ -19,34 +19,27 @@ - - - @@ -59,6 +52,10 @@ //wp-content/items/this-should-not-match/sub.css src='/wp-content/items/this-should-not-match/sub.css' + +