From 557dee2d8cef86f49385c9f55fb766021be62a9d Mon Sep 17 00:00:00 2001 From: erwanlr Date: Thu, 6 Aug 2020 11:43:26 +0200 Subject: [PATCH] Updates rubocop --- .rubocop.yml | 6 ++++++ .../interesting_findings/emergency_pwd_reset_script_spec.rb | 2 +- .../finders/interesting_findings/upload_sql_dump_spec.rb | 2 +- spec/app/finders/medias/attachment_brute_forcing_spec.rb | 4 ++-- spec/app/finders/users/author_id_brute_forcing_spec.rb | 4 ++-- spec/app/finders/wp_version/readme_spec.rb | 2 +- spec/lib/finders/dynamic_finder/plugin_version_spec.rb | 4 ++-- spec/lib/finders/dynamic_finder/theme_version_spec.rb | 4 ++-- .../target/platform/wordpress/custom_directories.rb | 2 +- spec/shared_examples/views/enumeration/medias.rb | 4 ++-- spec/shared_examples/views/enumeration/timthumbs.rb | 4 ++-- wpscan.gemspec | 2 +- 12 files changed, 23 insertions(+), 17 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index c4755d62..f9befd62 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -7,6 +7,8 @@ AllCops: - 'vendor/**/*' Layout/LineLength: Max: 120 +Lint/MissingSuper: + Enabled: false Lint/UriEscapeUnescape: Enabled: false Metrics/AbcSize: @@ -24,6 +26,8 @@ Metrics/MethodLength: Max: 20 Exclude: - 'app/controllers/enumeration/cli_options.rb' +Metrics/PerceivedComplexity: + Max: 11 Style/ClassVars: Enabled: false Style/Documentation: @@ -33,3 +37,5 @@ Style/FormatStringToken: Style/NumericPredicate: Exclude: - 'app/controllers/vuln_api.rb' +Style/OptionalBooleanParameter: + Enabled: false diff --git a/spec/app/finders/interesting_findings/emergency_pwd_reset_script_spec.rb b/spec/app/finders/interesting_findings/emergency_pwd_reset_script_spec.rb index 64c16c02..f4c950be 100644 --- a/spec/app/finders/interesting_findings/emergency_pwd_reset_script_spec.rb +++ b/spec/app/finders/interesting_findings/emergency_pwd_reset_script_spec.rb @@ -4,7 +4,7 @@ describe WPScan::Finders::InterestingFindings::EmergencyPwdResetScript do subject(:finder) { described_class.new(target) } let(:target) { WPScan::Target.new(url).extend(CMSScanner::Target::Server::Apache) } let(:url) { 'http://ex.lo/' } - let(:file_url) { url + 'emergency.php' } + let(:file_url) { "#{url}emergency.php" } let(:fixtures) { FINDERS_FIXTURES.join('interesting_findings', 'emergency_pwd_reset_script') } before do diff --git a/spec/app/finders/interesting_findings/upload_sql_dump_spec.rb b/spec/app/finders/interesting_findings/upload_sql_dump_spec.rb index 0ba4280c..05fd4ff5 100644 --- a/spec/app/finders/interesting_findings/upload_sql_dump_spec.rb +++ b/spec/app/finders/interesting_findings/upload_sql_dump_spec.rb @@ -4,7 +4,7 @@ describe WPScan::Finders::InterestingFindings::UploadSQLDump do subject(:finder) { described_class.new(target) } let(:target) { WPScan::Target.new(url).extend(CMSScanner::Target::Server::Apache) } let(:url) { 'http://ex.lo/' } - let(:dump_url) { url + 'wp-content/uploads/dump.sql' } + let(:dump_url) { "#{url}wp-content/uploads/dump.sql" } let(:fixtures) { FINDERS_FIXTURES.join('interesting_findings', 'upload_sql_dump') } let(:wp_content) { 'wp-content' } diff --git a/spec/app/finders/medias/attachment_brute_forcing_spec.rb b/spec/app/finders/medias/attachment_brute_forcing_spec.rb index 257bc70c..a4468608 100644 --- a/spec/app/finders/medias/attachment_brute_forcing_spec.rb +++ b/spec/app/finders/medias/attachment_brute_forcing_spec.rb @@ -13,8 +13,8 @@ describe WPScan::Finders::Medias::AttachmentBruteForcing do describe '#target_urls' do it 'returns the expected urls' do expect(finder.target_urls(range: (1..2))).to eql( - url + '?attachment_id=1' => 1, - url + '?attachment_id=2' => 2 + "#{url}?attachment_id=1" => 1, + "#{url}?attachment_id=2" => 2 ) end end diff --git a/spec/app/finders/users/author_id_brute_forcing_spec.rb b/spec/app/finders/users/author_id_brute_forcing_spec.rb index a9b4c311..d55e1616 100644 --- a/spec/app/finders/users/author_id_brute_forcing_spec.rb +++ b/spec/app/finders/users/author_id_brute_forcing_spec.rb @@ -13,8 +13,8 @@ describe WPScan::Finders::Users::AuthorIdBruteForcing do describe '#target_urls' do it 'returns the correct URLs' do expect(finder.target_urls(range: (1..2))).to eql( - url + '?author=1' => 1, - url + '?author=2' => 2 + "#{url}?author=1" => 1, + "#{url}?author=2" => 2 ) end end diff --git a/spec/app/finders/wp_version/readme_spec.rb b/spec/app/finders/wp_version/readme_spec.rb index f1a37ffe..a3f79724 100644 --- a/spec/app/finders/wp_version/readme_spec.rb +++ b/spec/app/finders/wp_version/readme_spec.rb @@ -5,7 +5,7 @@ describe WPScan::Finders::WpVersion::Readme do let(:target) { WPScan::Target.new(url).extend(CMSScanner::Target::Server::Apache) } let(:url) { 'http://ex.lo/' } let(:fixtures) { FINDERS_FIXTURES.join('wp_version', 'readme') } - let(:readme_url) { url + 'readme.html' } + let(:readme_url) { "#{url}readme.html" } describe '#aggressive' do before { stub_request(:get, readme_url).to_return(body: File.read(fixtures.join(file))) } diff --git a/spec/lib/finders/dynamic_finder/plugin_version_spec.rb b/spec/lib/finders/dynamic_finder/plugin_version_spec.rb index 16c73c9c..0fef7027 100644 --- a/spec/lib/finders/dynamic_finder/plugin_version_spec.rb +++ b/spec/lib/finders/dynamic_finder/plugin_version_spec.rb @@ -81,7 +81,7 @@ WPScan::DB::DynamicFinders::Plugin.versions_finders_configs.each do |slug, confi found.each_with_index do |version, index| expected_version = expected.at(index) expected_ie = expected_version['interesting_entries'].map do |ie| - ie.gsub(target.url + ',', ie_url + ',') + ie.gsub("#{target.url},", "#{ie_url},") end expect(version).to be_a WPScan::Model::Version @@ -111,7 +111,7 @@ WPScan::DB::DynamicFinders::Plugin.versions_finders_configs.each do |slug, confi found.each_with_index do |version, index| expected_version = expected.at(index) expected_ie = expected_version['interesting_entries'].map do |ie| - ie.gsub(target.url + ',', ie_url + ',') + ie.gsub("#{target.url},", "#{ie_url},") end expect(version).to be_a WPScan::Model::Version diff --git a/spec/lib/finders/dynamic_finder/theme_version_spec.rb b/spec/lib/finders/dynamic_finder/theme_version_spec.rb index 7336fb62..d5358f73 100644 --- a/spec/lib/finders/dynamic_finder/theme_version_spec.rb +++ b/spec/lib/finders/dynamic_finder/theme_version_spec.rb @@ -86,7 +86,7 @@ WPScan::DB::DynamicFinders::Theme.versions_finders_configs.each do |slug, config found.each_with_index do |version, index| expected_version = expected.at(index) expected_ie = expected_version['interesting_entries'].map do |ie| - ie.gsub(target.url + ',', ie_url + ',') + ie.gsub("#{target.url},", "#{ie_url},") end expect(version).to be_a WPScan::Model::Version @@ -116,7 +116,7 @@ WPScan::DB::DynamicFinders::Theme.versions_finders_configs.each do |slug, config found.each_with_index do |version, index| expected_version = expected.at(index) expected_ie = expected_version['interesting_entries'].map do |ie| - ie.gsub(target.url + ',', ie_url + ',') + ie.gsub("#{target.url},", "#{ie_url},") end expect(version).to be_a WPScan::Model::Version diff --git a/spec/shared_examples/target/platform/wordpress/custom_directories.rb b/spec/shared_examples/target/platform/wordpress/custom_directories.rb index 79a153ed..3322abbf 100644 --- a/spec/shared_examples/target/platform/wordpress/custom_directories.rb +++ b/spec/shared_examples/target/platform/wordpress/custom_directories.rb @@ -100,7 +100,7 @@ shared_examples 'WordPress::CustomDirectories' do before { target.content_dir = dir } its(:content_dir) { should eq dir.chomp('/') } - its(:plugins_dir) { should eq dir.chomp('/') + '/plugins' } + its(:plugins_dir) { should eq "#{dir.chomp('/')}/plugins" } end context "when content_dir = #{dir} and plugins_dir = #{dir}" do diff --git a/spec/shared_examples/views/enumeration/medias.rb b/spec/shared_examples/views/enumeration/medias.rb index 9b1fc12d..fa214177 100644 --- a/spec/shared_examples/views/enumeration/medias.rb +++ b/spec/shared_examples/views/enumeration/medias.rb @@ -14,8 +14,8 @@ shared_examples 'App::Views::Enumeration::Medias' do end context 'when medias found' do - let(:m1) { media.new(target_url + '?attachment_id=1', found_by: 'Attachment Brute Forcing') } - let(:m2) { media.new(target_url + '?attachment_id=5', found_by: 'Attachment Brute Forcing') } + let(:m1) { media.new("#{target_url}?attachment_id=1", found_by: 'Attachment Brute Forcing') } + let(:m2) { media.new("#{target_url}?attachment_id=5", found_by: 'Attachment Brute Forcing') } let(:medias) { [m1, m2] } let(:expected_view) { File.join(view, 'medias') } diff --git a/spec/shared_examples/views/enumeration/timthumbs.rb b/spec/shared_examples/views/enumeration/timthumbs.rb index bfb59d1e..f2c599fd 100644 --- a/spec/shared_examples/views/enumeration/timthumbs.rb +++ b/spec/shared_examples/views/enumeration/timthumbs.rb @@ -15,8 +15,8 @@ shared_examples 'App::Views::Enumeration::Timthumbs' do end context 'when timthumbs found' do - let(:tt) { timthumb.new(target_url + 'tt.php', found_by: 'Known Locations') } - let(:tt2) { timthumb.new(target_url + 'tt2.php', found_by: 'Known Locations') } + let(:tt) { timthumb.new("#{target_url}tt.php", found_by: 'Known Locations') } + let(:tt2) { timthumb.new("#{target_url}tt2.php", found_by: 'Known Locations') } let(:timthumbs) { [tt, tt2] } context 'when not vulnerable' do diff --git a/wpscan.gemspec b/wpscan.gemspec index b5e12eaa..3cb3204b 100644 --- a/wpscan.gemspec +++ b/wpscan.gemspec @@ -28,7 +28,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'rake', '~> 13.0' s.add_development_dependency 'rspec', '~> 3.9.0' s.add_development_dependency 'rspec-its', '~> 1.3.0' - s.add_development_dependency 'rubocop', '~> 0.88.0' + s.add_development_dependency 'rubocop', '~> 0.89.0' s.add_development_dependency 'rubocop-performance', '~> 1.7.0' s.add_development_dependency 'simplecov', '~> 0.18.2' s.add_development_dependency 'simplecov-lcov', '~> 0.8.0'