Codebase list ruby-cms-scanner / 48bad3b
Update upstream source from tag 'upstream/0.13.3' Update to upstream version '0.13.3' with Debian dir d7c5fd052a6eae2ce6f7a03f0d096075f2e65243 Sophie Brun 3 years ago
9 changed file(s) with 45 addition(s) and 28 deletion(s). Raw diff Collapse all Expand all
3333 Exclude:
3434 - app/controllers/core/cli_options.rb
3535 Metrics/ParameterLists:
36 Max: 6
3637 MaxOptionalParameters: 4
3738 Metrics/PerceivedComplexity:
3839 Max: 9
88 s.platform = Gem::Platform::RUBY
99 s.required_ruby_version = '>= 2.5'
1010 s.authors = ['WPScanTeam']
11 s.email = ['[email protected]']
11 s.email = ['[email protected]']
1212 s.summary = 'CMS Scanner Framework (experimental)'
1313 s.description = 'Framework to provide an easy way to implement CMS Scanners'
1414 s.homepage = 'https://github.com/wpscanteam/CMSScanner'
2020
2121 s.add_dependency 'get_process_mem', '~> 0.2.5'
2222 s.add_dependency 'nokogiri', '~> 1.11.0'
23 s.add_dependency 'opt_parse_validator', '~> 1.9.3'
23 s.add_dependency 'opt_parse_validator', '~> 1.9.4'
2424 s.add_dependency 'public_suffix', '~> 4.0.3'
2525 s.add_dependency 'ruby-progressbar', '>= 1.10', '< 1.12'
2626 s.add_dependency 'typhoeus', '>= 1.3', '< 1.5'
3333 s.add_development_dependency 'rake', '~> 13.0'
3434 s.add_development_dependency 'rspec', '~> 3.10.0'
3535 s.add_development_dependency 'rspec-its', '~> 1.3.0'
36 s.add_development_dependency 'rubocop', '~> 1.9.1'
37 s.add_development_dependency 'rubocop-performance', '~> 1.9.0'
36 s.add_development_dependency 'rubocop', '~> 1.11.0'
37 s.add_development_dependency 'rubocop-performance', '~> 1.10.0'
3838 s.add_development_dependency 'simplecov', '~> 0.21.0'
3939 s.add_development_dependency 'simplecov-lcov', '~> 0.8.0'
40 s.add_development_dependency 'webmock', '~> 3.11.0'
40 s.add_development_dependency 'webmock', '~> 3.12.0'
4141 end
5858
5959 full_res = NS::Browser.get(head_res.effective_url, full_request_params)
6060
61 return unless valid_response_codes.include?(full_res.code)
62
6163 return if target.homepage_or_404?(full_res) ||
6264 opts[:exclude_content] && full_res.body&.match(opts[:exclude_content])
6365
8585
8686 # @return [ String ] The URL to the metasploit module page
8787 def msf_url(mod)
88 "https://www.rapid7.com/db/modules/#{mod.sub(%r{^/}, '')}"
88 "https://www.rapid7.com/db/modules/#{mod.sub(%r{^/}, '')}/"
8989 end
9090
9191 # @return [ Array<String> ] The Packetstormsecurity IDs
11
22 # Version
33 module CMSScanner
4 VERSION = '0.13.1'
4 VERSION = '0.13.3'
55 end
44 class Vulnerability
55 include References
66
7 attr_reader :title, :type, :fixed_in, :cvss
7 attr_reader :title, :type, :fixed_in, :introduced_in, :cvss
88
99 # @param [ String ] title
1010 # @param [ Hash ] references
1717 # @option references [ Array<String> ] :youtube
1818 # @param [ String ] type
1919 # @param [ String ] fixed_in
20 # @param [ String ] introduced_in
2021 # @param [ HashSymbol ] cvss
2122 # @option cvss [ String ] :score
2223 # @option cvss [ String ] :vector
23 def initialize(title, references: {}, type: nil, fixed_in: nil, cvss: nil)
24 @title = title
25 @type = type
26 @fixed_in = fixed_in
27 @cvss = { score: cvss[:score], vector: cvss[:vector] } if cvss
24 def initialize(title, references: {}, type: nil, fixed_in: nil, introduced_in: nil, cvss: nil)
25 @title = title
26 @type = type
27 @fixed_in = fixed_in
28 @introduced_in = introduced_in
29 @cvss = { score: cvss[:score], vector: cvss[:vector] } if cvss
2830
2931 self.references = references
3032 end
2727 end
2828
2929 context 'when check_full_response is true' do
30 let(:opts) { super().merge(check_full_response: true) }
31 let(:body) { '' }
32
33 before { stub_request(:get, effective_url).to_return(body: body) }
30 let(:opts) { super().merge(check_full_response: true) }
31 let(:body) { '' }
32 let(:status) { 200 }
33
34 before { stub_request(:get, effective_url).to_return(body: body, status: status) }
3435
3536 context 'when the body matches the 404 homepage' do
3637 it 'returns nil' do
3738 expect(target).to receive(:homepage_or_404?).and_return(true)
39
40 expect(finder.maybe_get_full_response(head_res, opts)).to eql nil
41 end
42 end
43
44 context 'when the status is not valid' do
45 let(:status) { 404 }
46
47 it 'returns nil' do
48 allow(target).to receive(:homepage_or_404?).and_return(false)
3849
3950 expect(finder.maybe_get_full_response(head_res, opts)).to eql nil
4051 end
88 it_behaves_like CMSScanner::References
99
1010 describe '#new' do
11 its(:title) { should eql title }
12 its(:references) { should eql({}) }
13 its(:type) { should eql nil }
14 its(:fixed_in) { should eql nil }
15 its(:cvss) { should eql nil }
11 its(:title) { should eql title }
12 its(:references) { should eql({}) }
13 its(:type) { should eql nil }
14 its(:fixed_in) { should eql nil }
15 its(:introduced_in) { should eql nil }
16 its(:cvss) { should eql nil }
1617
1718 context 'when CVSS' do
1819 let(:cvss) { { score: '5.4', vector: 'spec', y: 'key should not be added' } }
5050 its(:urls) { should eql %w[single-url] }
5151
5252 its(:msf_modules) { should eql %w[/exploit/yolo] }
53 its(:msf_urls) { should eql %w[https://www.rapid7.com/db/modules/exploit/yolo] }
53 its(:msf_urls) { should eql %w[https://www.rapid7.com/db/modules/exploit/yolo/] }
5454
5555 its(:packetstorm_ids) { should eq %w[15] }
5656 its(:packetstorm_urls) { should eql %w[https://packetstormsecurity.com/files/15/] }
6565 'https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-11',
6666 'https://www.exploit-db.com/exploits/14/',
6767 'single-url',
68 'https://www.rapid7.com/db/modules/exploit/yolo',
68 'https://www.rapid7.com/db/modules/exploit/yolo/',
6969 'https://packetstormsecurity.com/files/15/',
7070 'https://www.securityfocus.com/bid/16/',
7171 'https://www.youtube.com/watch?v=xAAAA'
104104
105105 its(:msf_modules) { should eql %w[/exploit/yolo exploit/aa] }
106106 its(:msf_urls) do
107 should eql %w[https://www.rapid7.com/db/modules/exploit/yolo
108 https://www.rapid7.com/db/modules/exploit/aa]
107 should eql %w[https://www.rapid7.com/db/modules/exploit/yolo/
108 https://www.rapid7.com/db/modules/exploit/aa/]
109109 end
110110
111111 its(:packetstorm_ids) { should eq %w[50 51] }
130130 'https://www.exploit-db.com/exploits/41/',
131131 'single-url',
132132 'another-url',
133 'https://www.rapid7.com/db/modules/exploit/yolo',
134 'https://www.rapid7.com/db/modules/exploit/aa',
133 'https://www.rapid7.com/db/modules/exploit/yolo/',
134 'https://www.rapid7.com/db/modules/exploit/aa/',
135135 'https://packetstormsecurity.com/files/50/',
136136 'https://packetstormsecurity.com/files/51/',
137137 'https://www.securityfocus.com/bid/60/',