diff --git a/.rubocop.yml b/.rubocop.yml index f9befd62..035b9129 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -37,5 +37,3 @@ Style/FormatStringToken: Style/NumericPredicate: Exclude: - 'app/controllers/vuln_api.rb' -Style/OptionalBooleanParameter: - Enabled: false diff --git a/app/finders/main_theme/urls_in_homepage.rb b/app/finders/main_theme/urls_in_homepage.rb index 49c31004..9aaea1ad 100644 --- a/app/finders/main_theme/urls_in_homepage.rb +++ b/app/finders/main_theme/urls_in_homepage.rb @@ -13,7 +13,7 @@ module WPScan def passive(opts = {}) found = [] - slugs = items_from_links('themes', false) + items_from_codes('themes', false) + slugs = items_from_links('themes', uniq: false) + items_from_codes('themes', uniq: false) slugs.each_with_object(Hash.new(0)) { |slug, counts| counts[slug] += 1 }.each do |slug, occurences| found << Model::Theme.new(slug, target, opts.merge(found_by: found_by, confidence: 2 * occurences)) diff --git a/app/finders/wp_items/urls_in_page.rb b/app/finders/wp_items/urls_in_page.rb index 9056ddbf..1d7bd753 100644 --- a/app/finders/wp_items/urls_in_page.rb +++ b/app/finders/wp_items/urls_in_page.rb @@ -9,7 +9,7 @@ module WPScan # @param [ Boolean ] uniq Wether or not to apply the #uniq on the results # # @return [ Array ] The plugins/themes detected in the href, src attributes of the page - def items_from_links(type, uniq = true) + def items_from_links(type, uniq: true) found = [] xpath = format( '(//@href|//@src|//@data-src)[contains(., "%s")]', @@ -31,7 +31,7 @@ module WPScan # @param [ Boolean ] uniq Wether or not to apply the #uniq on the results # # @return [Array ] The plugins/themes detected in the javascript/style of the homepage - def items_from_codes(type, uniq = true) + def items_from_codes(type, uniq: true) found = [] page_res.html.xpath('//script[not(@src)]|//style[not(@src)]').each do |tag| diff --git a/lib/wpscan/db/dynamic_finders/base.rb b/lib/wpscan/db/dynamic_finders/base.rb index a2e8e197..5219b971 100644 --- a/lib/wpscan/db/dynamic_finders/base.rb +++ b/lib/wpscan/db/dynamic_finders/base.rb @@ -31,7 +31,7 @@ module WPScan finder_configs( finder_class, - Regexp.last_match[1] == 'aggressive' + aggressive: Regexp.last_match[1] == 'aggressive' ) end diff --git a/lib/wpscan/db/dynamic_finders/plugin.rb b/lib/wpscan/db/dynamic_finders/plugin.rb index ab0e605f..9048df9d 100644 --- a/lib/wpscan/db/dynamic_finders/plugin.rb +++ b/lib/wpscan/db/dynamic_finders/plugin.rb @@ -16,7 +16,7 @@ module WPScan # @param [ Symbol ] finder_class # @param [ Boolean ] aggressive # @return [ Hash ] - def self.finder_configs(finder_class, aggressive = false) + def self.finder_configs(finder_class, aggressive: false) configs = {} return configs unless allowed_classes.include?(finder_class) diff --git a/lib/wpscan/db/dynamic_finders/wordpress.rb b/lib/wpscan/db/dynamic_finders/wordpress.rb index 249c46c8..aea63bdb 100644 --- a/lib/wpscan/db/dynamic_finders/wordpress.rb +++ b/lib/wpscan/db/dynamic_finders/wordpress.rb @@ -24,7 +24,7 @@ module WPScan # @param [ Symbol ] finder_class # @param [ Boolean ] aggressive # @return [ Hash ] - def self.finder_configs(finder_class, aggressive = false) + def self.finder_configs(finder_class, aggressive: false) configs = {} return configs unless allowed_classes.include?(finder_class) diff --git a/spec/lib/db/dynamic_finders/plugin_spec.rb b/spec/lib/db/dynamic_finders/plugin_spec.rb index 5e481501..f2e3a5e2 100644 --- a/spec/lib/db/dynamic_finders/plugin_spec.rb +++ b/spec/lib/db/dynamic_finders/plugin_spec.rb @@ -25,7 +25,7 @@ describe WPScan::DB::DynamicFinders::Plugin do context 'when aggressive argument is true' do it 'returns only the configs with a path parameter' do - configs = subject.finder_configs(:Xpath, true) + configs = subject.finder_configs(:Xpath, aggressive: true) expect(configs.keys).to include('revslider') expect(configs.keys).to_not include('shareaholic') diff --git a/spec/shared_examples/finders/wp_items/urls_in_page.rb b/spec/shared_examples/finders/wp_items/urls_in_page.rb index abec29ba..00364750 100644 --- a/spec/shared_examples/finders/wp_items/urls_in_page.rb +++ b/spec/shared_examples/finders/wp_items/urls_in_page.rb @@ -20,7 +20,7 @@ shared_examples 'App::Finders::WpItems::UrlsInPage' do let(:fixture) { 'found.html' } it 'returns the expected array' do - expect(finder.items_from_links(type, uniq_links)).to eql expected_from_links + expect(finder.items_from_links(type, uniq: uniq_links)).to eql expected_from_links end end @@ -52,7 +52,7 @@ shared_examples 'App::Finders::WpItems::UrlsInPage' do let(:fixture) { 'found.html' } it 'returns the expected array' do - expect(finder.items_from_codes(type, uniq_codes)).to eql expected_from_codes + expect(finder.items_from_codes(type, uniq: uniq_codes)).to eql expected_from_codes end end end