HELLO v3!!!

This commit is contained in:
Ryan Dewhurst
2018-09-26 21:12:01 +02:00
parent 28b9c15256
commit d268a86795
1871 changed files with 988118 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
require 'spec_helper'
describe WPScan::DB::DynamicFinders::Base do
subject(:dynamic_finders) { described_class }
# Handled in spec/lib/db/dynamic_finders/plugin and wordpress
end

View File

@@ -0,0 +1,72 @@
require 'spec_helper'
describe WPScan::DB::DynamicFinders::Plugin do
subject(:dynamic_finders) { described_class }
describe '.finders_configs' do
context 'when the given class is not allowed' do
it 'returns an empty hash' do
expect(subject.finder_configs('aaaa')).to eql({})
end
end
context 'when the given class is allowed' do
context 'when aggressive argument is false' do
it 'returns only the configs w/o a path parameter' do
configs = subject.finder_configs(:Xpath)
expect(configs.keys).to include('wordpress-mobile-pack', 'shareaholic')
expect(configs.keys).to_not include('simple-share-button-adder')
expect(configs['sitepress-multilingual-cms']['MetaGenerator']['pattern']).to be_a Regexp
expect(configs['sitepress-multilingual-cms']['MetaGenerator']['version']).to eql true
end
end
context 'when aggressive argument is true' do
it 'returns only the configs with a path parameter' do
configs = subject.finder_configs(:Xpath, true)
expect(configs.keys).to include('revslider')
expect(configs.keys).to_not include('shareaholic')
end
end
end
end
describe '.versions_finders_configs' do
# Just test a sample here
its('versions_finders_configs.keys') { should include('shareaholic') }
its('versions_finders_configs.keys') { should_not include('wordpress-mobile-pack') }
end
describe '.maybe_create_module' do
xit
end
describe '.create_versions_finders' do
# handled and tested in spec/lib/finders/dynamic_finders/plugin_version_spec
end
describe '.version_finder_super_class' do
# handled and tested in spec/lib/finders/dynamic_finders/plugin_version_spec
end
describe '.method_missing' do
context 'when the method matches a valid call' do
its('passive_comment_finder_configs.keys') { should include('addthis') }
its('passive_comment_finder_configs.keys') { should_not include('shareaholic') }
its('passive_xpath_finder_configs.keys') { should include('shareaholic') }
its('passive_xpath_finder_configs.keys') { should_not include('simple-share-button-adder') }
its('aggressive_xpath_finder_configs.keys') { should_not include('wordpress-mobile-pack') }
its('aggressive_xpath_finder_configs.keys') { should include('revslider') }
end
context 'when the method does not match a valid call' do
it 'raises an error' do
expect { subject.aaa }.to raise_error(NoMethodError)
end
end
end
end

View File

@@ -0,0 +1,7 @@
require 'spec_helper'
describe WPScan::DB::DynamicFinders::Theme do
subject(:dynamic_finders) { described_class }
xit
end

View File

@@ -0,0 +1,7 @@
require 'spec_helper'
describe WPScan::DB::DynamicFinders::Wordpress do
subject(:dynamic_finders) { described_class }
xit
end

View File

@@ -0,0 +1,27 @@
require 'spec_helper'
describe WPScan::DB::Fingerprints do
describe '#unique_fingerprints' do
# Handled in #wp_unique_fingerprints
end
describe '.wp_fingerprints' do
it 'returns the expected value' do
expect(described_class.wp_fingerprints).to eql(
'path-1' => {
'hash-1' => %w[4.0 3.8],
'hash-2' => ['4.4']
},
'path-2' => {
'hash-3' => %w[3.8.1 3.8.2 3.9.1]
}
)
end
end
describe '.wp_unique_fingerprints' do
it 'returns the expected value' do
expect(described_class.wp_unique_fingerprints).to eql('path-1' => { 'hash-2' => '4.4' })
end
end
end

View File

@@ -0,0 +1,7 @@
require 'spec_helper'
describe WPScan::DB::Plugin do
describe '#vulnerabilities' do
# Handled in spec/app/models/plugin_spec
end
end

View File

@@ -0,0 +1,17 @@
require 'spec_helper'
describe WPScan::DB::Plugins do
subject(:plugins) { described_class }
describe '#all_slugs' do
its(:all_slugs) { should eql %w[no-vulns-popular vulnerable-not-popular] }
end
describe '#popular_slugs' do
its(:popular_slugs) { should eql %w[no-vulns-popular] }
end
describe '#vulnerable_slugs' do
its(:vulnerable_slugs) { should eql %w[vulnerable-not-popular] }
end
end

View File

@@ -0,0 +1,7 @@
require 'spec_helper'
describe WPScan::DB::Theme do
describe '#vulnerabilities' do
# Handled in spec/app/models/theme_spec
end
end

View File

@@ -0,0 +1,17 @@
require 'spec_helper'
describe WPScan::DB::Themes do
subject(:themes) { described_class }
describe '#all_slugs' do
its(:all_slugs) { should eql %w[no-vulns-popular dignitas-themes yaaburnee-themes] }
end
describe '#popular_slugs' do
its(:popular_slugs) { should eql %w[no-vulns-popular dignitas-themes] }
end
describe '#vulnerable_slugs' do
its(:vulnerable_slugs) { should eql %w[dignitas-themes yaaburnee-themes] }
end
end

View File

@@ -0,0 +1,7 @@
require 'spec_helper'
describe WPScan::DB::WpItem do
describe '#vulnerabilities' do
# Handled in spec/app/models/plugin_spec
end
end

View File

@@ -0,0 +1,5 @@
require 'spec_helper'
describe WPScan::DB::WpItems do
# Handled in plugins_spec & themes_spec
end

View File

@@ -0,0 +1,7 @@
require 'spec_helper'
describe WPScan::DB::Version do
describe '#vulnerabilities' do
# Handled in spec/app/models/wp_version_spec
end
end