From 788122c5d6bd277531c76cacb768471e29feba53 Mon Sep 17 00:00:00 2001 From: erwanlr Date: Tue, 16 Apr 2013 16:42:37 +0200 Subject: [PATCH] WebSite::page_hash Better comments detection --- lib/wpscan/web_site.rb | 2 +- spec/lib/wpscan/web_site_spec.rb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/wpscan/web_site.rb b/lib/wpscan/web_site.rb index 7156249f..6f4ff7ba 100644 --- a/lib/wpscan/web_site.rb +++ b/lib/wpscan/web_site.rb @@ -85,7 +85,7 @@ class WebSite def self.page_hash(page) page = Browser.get(page) unless page.is_a?(Typhoeus::Response) - Digest::MD5.hexdigest(page.body.gsub(//, '')) + Digest::MD5.hexdigest(page.body.gsub(//m, '')) end def homepage_hash diff --git a/spec/lib/wpscan/web_site_spec.rb b/spec/lib/wpscan/web_site_spec.rb index 0b029855..b3a86e97 100644 --- a/spec/lib/wpscan/web_site_spec.rb +++ b/spec/lib/wpscan/web_site_spec.rb @@ -193,7 +193,10 @@ describe 'WebSite' do end context 'when there are comments' do - let(:page) { Typhoeus::Response.new(body: "yolo\n\n\nworld!") } + let(:page) { + body = "yolo\n\n\nworld!" + Typhoeus::Response.new(body: body) + } it 'removes them' do @expected = "yolo\n\n\nworld!"