From cf2881fda6c401c2d317efd04f05930ba3ac3c20 Mon Sep 17 00:00:00 2001 From: g0tmi1k Date: Tue, 15 May 2018 10:47:55 +0100 Subject: [PATCH] Fix bots issues? ...Happy now? Please? --- lib/wpscan/wp_target/wp_api.rb | 17 +++++++---------- lib/wpscan/wp_target/wp_rss.rb | 4 ++-- spec/lib/wpscan/web_site_spec.rb | 12 ------------ 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/lib/wpscan/wp_target/wp_api.rb b/lib/wpscan/wp_target/wp_api.rb index 717d6ad9..de80ac86 100644 --- a/lib/wpscan/wp_target/wp_api.rb +++ b/lib/wpscan/wp_target/wp_api.rb @@ -46,21 +46,18 @@ class WpTarget < WebSite def json_get_users(url) # Variables users = [] - data = "" # Make the request response = Browser.get(url) # If not HTTP 200, return false - return false if response.code != 200 + return false unless response.code == 200 # Able to view the output? - if valid_json?(response.body) - # Read in JSON - data = JSON.parse(response.body) - else - return false - end + return false unless valid_json?(response.body) + + # Read in JSON + data = JSON.parse(response.body) # If there is nothing there, return false return false if data.empty? @@ -83,9 +80,9 @@ class WpTarget < WebSite table = Terminal::Table.new(headings: ['ID', 'Name', 'URL'], rows: users) puts table - else - return false + return true end + return false end end end diff --git a/lib/wpscan/wp_target/wp_rss.rb b/lib/wpscan/wp_target/wp_rss.rb index 418c1456..5239c045 100644 --- a/lib/wpscan/wp_target/wp_rss.rb +++ b/lib/wpscan/wp_target/wp_rss.rb @@ -62,9 +62,9 @@ class WpTarget < WebSite table = Terminal::Table.new(headings: ['Name'], rows: users) puts table - else - return false + return true end + return false end end end diff --git a/spec/lib/wpscan/web_site_spec.rb b/spec/lib/wpscan/web_site_spec.rb index 4eeda2eb..56b150b8 100644 --- a/spec/lib/wpscan/web_site_spec.rb +++ b/spec/lib/wpscan/web_site_spec.rb @@ -207,18 +207,6 @@ describe 'WebSite' do end end - describe '#rss_url' do - it 'returns nil if the url is not found' do - stub_request(:get, web_site.url).to_return(body: 'No RSS link in this body !') - expect(web_site.rss_url).to be_nil - end - - it "returns 'http://lamp-wp/wordpress-3.5/?feed=rss2'" do - stub_request_to_fixture(url: web_site.url, fixture: fixtures_dir + '/rss_url/wordpress-3.5.htm') - expect(web_site.rss_url).to be === 'http://lamp-wp/wordpress-3.5/?feed=rss2' - end - end - describe '::has_log?' do let(:log_url) { web_site.uri.merge('log.txt').to_s } let(:pattern) { %r{PHP Fatal error} }