More rubocop fixes
This commit is contained in:
@@ -37,5 +37,3 @@ Style/FormatStringToken:
|
|||||||
Style/NumericPredicate:
|
Style/NumericPredicate:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/vuln_api.rb'
|
- 'app/controllers/vuln_api.rb'
|
||||||
Style/OptionalBooleanParameter:
|
|
||||||
Enabled: false
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ module WPScan
|
|||||||
def passive(opts = {})
|
def passive(opts = {})
|
||||||
found = []
|
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|
|
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))
|
found << Model::Theme.new(slug, target, opts.merge(found_by: found_by, confidence: 2 * occurences))
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ module WPScan
|
|||||||
# @param [ Boolean ] uniq Wether or not to apply the #uniq on the results
|
# @param [ Boolean ] uniq Wether or not to apply the #uniq on the results
|
||||||
#
|
#
|
||||||
# @return [ Array<String> ] The plugins/themes detected in the href, src attributes of the page
|
# @return [ Array<String> ] 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 = []
|
found = []
|
||||||
xpath = format(
|
xpath = format(
|
||||||
'(//@href|//@src|//@data-src)[contains(., "%s")]',
|
'(//@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
|
# @param [ Boolean ] uniq Wether or not to apply the #uniq on the results
|
||||||
#
|
#
|
||||||
# @return [Array<String> ] The plugins/themes detected in the javascript/style of the homepage
|
# @return [Array<String> ] 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 = []
|
found = []
|
||||||
|
|
||||||
page_res.html.xpath('//script[not(@src)]|//style[not(@src)]').each do |tag|
|
page_res.html.xpath('//script[not(@src)]|//style[not(@src)]').each do |tag|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ module WPScan
|
|||||||
|
|
||||||
finder_configs(
|
finder_configs(
|
||||||
finder_class,
|
finder_class,
|
||||||
Regexp.last_match[1] == 'aggressive'
|
aggressive: Regexp.last_match[1] == 'aggressive'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ module WPScan
|
|||||||
# @param [ Symbol ] finder_class
|
# @param [ Symbol ] finder_class
|
||||||
# @param [ Boolean ] aggressive
|
# @param [ Boolean ] aggressive
|
||||||
# @return [ Hash ]
|
# @return [ Hash ]
|
||||||
def self.finder_configs(finder_class, aggressive = false)
|
def self.finder_configs(finder_class, aggressive: false)
|
||||||
configs = {}
|
configs = {}
|
||||||
|
|
||||||
return configs unless allowed_classes.include?(finder_class)
|
return configs unless allowed_classes.include?(finder_class)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ module WPScan
|
|||||||
# @param [ Symbol ] finder_class
|
# @param [ Symbol ] finder_class
|
||||||
# @param [ Boolean ] aggressive
|
# @param [ Boolean ] aggressive
|
||||||
# @return [ Hash ]
|
# @return [ Hash ]
|
||||||
def self.finder_configs(finder_class, aggressive = false)
|
def self.finder_configs(finder_class, aggressive: false)
|
||||||
configs = {}
|
configs = {}
|
||||||
|
|
||||||
return configs unless allowed_classes.include?(finder_class)
|
return configs unless allowed_classes.include?(finder_class)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ describe WPScan::DB::DynamicFinders::Plugin do
|
|||||||
|
|
||||||
context 'when aggressive argument is true' do
|
context 'when aggressive argument is true' do
|
||||||
it 'returns only the configs with a path parameter' 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 include('revslider')
|
||||||
expect(configs.keys).to_not include('shareaholic')
|
expect(configs.keys).to_not include('shareaholic')
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ shared_examples 'App::Finders::WpItems::UrlsInPage' do
|
|||||||
let(:fixture) { 'found.html' }
|
let(:fixture) { 'found.html' }
|
||||||
|
|
||||||
it 'returns the expected array' do
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ shared_examples 'App::Finders::WpItems::UrlsInPage' do
|
|||||||
let(:fixture) { 'found.html' }
|
let(:fixture) { 'found.html' }
|
||||||
|
|
||||||
it 'returns the expected array' do
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user