Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
9d0b888a51 Update rubocop-performance requirement from ~> 1.13.0 to ~> 1.19.1
Updates the requirements on [rubocop-performance](https://github.com/rubocop/rubocop-performance) to permit the latest version.
- [Release notes](https://github.com/rubocop/rubocop-performance/releases)
- [Changelog](https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-performance/compare/v1.13.0...v1.19.1)

---
updated-dependencies:
- dependency-name: rubocop-performance
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-02 10:48:39 +00:00
11 changed files with 16 additions and 48 deletions

View File

@@ -9,7 +9,7 @@ jobs:
strategy: strategy:
matrix: matrix:
ruby: [2.7, '3.0', 3.1, 3.2] ruby: [2.7, '3.0', 3.1]
steps: steps:
- name: Checkout code - name: Checkout code

View File

@@ -38,9 +38,7 @@ When using a pentesting distubution (such as Kali Linux), it is recommended to i
### In macOSX via Homebrew ### In macOSX via Homebrew
```shell `brew install wpscanteam/tap/wpscan`
brew install wpscanteam/tap/wpscan
```
### From RubyGems ### From RubyGems

View File

@@ -7,10 +7,6 @@ module WPScan
class KnownLocations < CMSScanner::Finders::Finder class KnownLocations < CMSScanner::Finders::Finder
include CMSScanner::Finders::Finder::Enumerator include CMSScanner::Finders::Finder::Enumerator
def valid_response_codes
@valid_response_codes ||= [200, 206].freeze
end
SQL_PATTERN = /(?:DROP|(?:UN)?LOCK|CREATE|ALTER) (?:TABLE|DATABASE)|INSERT INTO/.freeze SQL_PATTERN = /(?:DROP|(?:UN)?LOCK|CREATE|ALTER) (?:TABLE|DATABASE)|INSERT INTO/.freeze
# @param [ Hash ] opts # @param [ Hash ] opts
@@ -21,7 +17,7 @@ module WPScan
def aggressive(opts = {}) def aggressive(opts = {})
found = [] found = []
enumerate(potential_urls(opts), opts.merge(check_full_response: valid_response_codes)) do |res| enumerate(potential_urls(opts), opts.merge(check_full_response: 200)) do |res|
if res.effective_url.end_with?('.zip') if res.effective_url.end_with?('.zip')
next unless %r{\Aapplication/zip}i.match?(res.headers['Content-Type']) next unless %r{\Aapplication/zip}i.match?(res.headers['Content-Type'])
else else

View File

@@ -36,8 +36,6 @@ module WPScan
oembed_data = oembed_data.first if oembed_data.is_a?(Array) oembed_data = oembed_data.first if oembed_data.is_a?(Array)
oembed_data = {} unless oembed_data.is_a?(Hash)
if oembed_data['author_url'] =~ %r{/author/([^/]+)/?\z} if oembed_data['author_url'] =~ %r{/author/([^/]+)/?\z}
details = [Regexp.last_match[1], 'Author URL', 90] details = [Regexp.last_match[1], 'Author URL', 90]
elsif oembed_data['author_name'] && !oembed_data['author_name'].empty? elsif oembed_data['author_name'] && !oembed_data['author_name'].empty?

View File

@@ -42,17 +42,13 @@ module WPScan
def users_from_response(response) def users_from_response(response)
found = [] found = []
json = JSON.parse(response.body) JSON.parse(response.body)&.each do |user|
if json.is_a?(Enumerable)
json.each do |user|
found << Model::User.new(user['slug'], found << Model::User.new(user['slug'],
id: user['id'], id: user['id'],
found_by: found_by, found_by: found_by,
confidence: 100, confidence: 100,
interesting_entries: [response.effective_url]) interesting_entries: [response.effective_url])
end end
end
found found
end end

View File

@@ -92,7 +92,7 @@ module WPScan
tags: 'Tags', tags: 'Tags',
text_domain: 'Text Domain' text_domain: 'Text Domain'
}.each do |attribute, tag| }.each do |attribute, tag|
instance_variable_set(:"@#{attribute}", parse_style_tag(style_body, tag)&.force_encoding('UTF-8')) instance_variable_set(:"@#{attribute}", parse_style_tag(style_body, tag))
end end
end end

View File

@@ -16,8 +16,5 @@ def classify_slug(slug)
classified = slug.to_s.gsub(/[^a-z\d\-]/i, '-').gsub(/-{1,}/, '_').camelize.to_s classified = slug.to_s.gsub(/[^a-z\d\-]/i, '-').gsub(/-{1,}/, '_').camelize.to_s
classified = "D_#{classified}" if /\d/.match?(classified[0]) classified = "D_#{classified}" if /\d/.match?(classified[0])
# Special case for slugs with all non-latin characters.
classified = "HexSlug_#{slug.bytes.map { |i| i.to_s(16) }.join}" if classified.empty?
classified.to_sym classified.to_sym
end end

View File

@@ -13,19 +13,11 @@ describe WPScan::Finders::Users::OembedApi do
end end
context 'when not a JSON response' do context 'when not a JSON response' do
context 'when empty' do
let(:body) { '' } let(:body) { '' }
its(:aggressive) { should eql([]) } its(:aggressive) { should eql([]) }
end end
context 'when a string' do
let(:body) { '404' }
its(:aggressive) { should eql([]) }
end
end
context 'when a JSON response' do context 'when a JSON response' do
let(:body) { File.read(fixture) } let(:body) { File.read(fixture) }

View File

@@ -20,19 +20,11 @@ describe WPScan::Finders::Users::WpJsonApi do
end end
context 'when not a JSON response' do context 'when not a JSON response' do
context 'when empty' do
let(:body) { '' } let(:body) { '' }
its(:aggressive) { should eql([]) } its(:aggressive) { should eql([]) }
end end
context 'when a string' do
let(:body) { '404' }
its(:aggressive) { should eql([]) }
end
end
context 'when a JSON response' do context 'when a JSON response' do
context 'when unauthorised' do context 'when unauthorised' do
let(:body) { File.read(fixtures.join('401.json')) } let(:body) { File.read(fixtures.join('401.json')) }

View File

@@ -7,8 +7,7 @@ describe '#classify_slug' do
'12-slug' => :D_12Slug, '12-slug' => :D_12Slug,
'slug.s' => :SlugS, 'slug.s' => :SlugS,
'slug yolo $' => :SlugYolo, 'slug yolo $' => :SlugYolo,
'slug $ ab.cd/12' => :SlugAbCd12, 'slug $ ab.cd/12' => :SlugAbCd12
'カスタムテーマ' => :HexSlug_e382abe382b9e382bfe383a0e38386e383bce3839e
}.each do |slug, expected_symbol| }.each do |slug, expected_symbol|
context "when #{slug}" do context "when #{slug}" do
it "returns #{expected_symbol}" do it "returns #{expected_symbol}" do

View File

@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rspec', '~> 3.12.0' s.add_development_dependency 'rspec', '~> 3.12.0'
s.add_development_dependency 'rspec-its', '~> 1.3.0' s.add_development_dependency 'rspec-its', '~> 1.3.0'
s.add_development_dependency 'rubocop', '~> 1.26.0' s.add_development_dependency 'rubocop', '~> 1.26.0'
s.add_development_dependency 'rubocop-performance', '~> 1.13.0' s.add_development_dependency 'rubocop-performance', '~> 1.19.1'
s.add_development_dependency 'simplecov', '~> 0.21.0' s.add_development_dependency 'simplecov', '~> 0.21.0'
s.add_development_dependency 'simplecov-lcov', '~> 0.8.0' s.add_development_dependency 'simplecov-lcov', '~> 0.8.0'
s.add_development_dependency 'stackprof', '~> 0.2.12' s.add_development_dependency 'stackprof', '~> 0.2.12'