Moves Models into their own namespace - Ref #1315

This commit is contained in:
erwanlr
2019-03-19 21:07:53 +00:00
parent f1657164d5
commit 898e8d4546
116 changed files with 613 additions and 560 deletions

View File

@@ -36,7 +36,7 @@ describe WPScan::Finders::ConfigBackups::KnownFilenames do
files.each do |file|
url = "#{target.url}#{file}"
expected << WPScan::ConfigBackup.new(
expected << WPScan::Model::ConfigBackup.new(
url,
confidence: 100,
found_by: described_class::DIRECT_ACCESS

View File

@@ -53,7 +53,7 @@ describe WPScan::Finders::DbExports::KnownLocations do
files.each do |file|
url = "#{target.url}#{file}"
expected << WPScan::DbExport.new(
expected << WPScan::Model::DbExport.new(
url,
confidence: 100,
found_by: described_class::DIRECT_ACCESS

View File

@@ -35,7 +35,7 @@ describe WPScan::Finders::InterestingFindings::BackupDB do
after do
found = finder.aggressive
expect(found).to eql WPScan::BackupDB.new(
expect(found).to eql WPScan::Model::BackupDB.new(
dir_url,
confidence: 70,
found_by: described_class::DIRECT_ACCESS

View File

@@ -21,7 +21,7 @@ describe WPScan::Finders::InterestingFindings::DebugLog do
let(:body) { File.read(fixtures.join('debug.log')) }
it 'returns the InterestingFinding' do
expect(finder.aggressive).to eql WPScan::DebugLog.new(
expect(finder.aggressive).to eql WPScan::Model::DebugLog.new(
log_url,
confidence: 100,
found_by: described_class::DIRECT_ACCESS

View File

@@ -22,7 +22,7 @@ describe WPScan::Finders::InterestingFindings::DuplicatorInstallerLog do
let(:body) { File.read(fixtures.join(filename)) }
it 'returns the InterestingFinding' do
expect(finder.aggressive).to eql WPScan::DuplicatorInstallerLog.new(
expect(finder.aggressive).to eql WPScan::Model::DuplicatorInstallerLog.new(
log_url,
confidence: 100,
found_by: described_class::DIRECT_ACCESS

View File

@@ -23,7 +23,7 @@ describe WPScan::Finders::InterestingFindings::FullPathDisclosure do
it 'returns the InterestingFinding' do
found = finder.aggressive
expect(found).to eql WPScan::FullPathDisclosure.new(
expect(found).to eql WPScan::Model::FullPathDisclosure.new(
file_url,
confidence: 100,
found_by: described_class::DIRECT_ACCESS

View File

@@ -25,7 +25,7 @@ describe WPScan::Finders::InterestingFindings::Readme do
before { stub_request(:get, target.url(file)).to_return(body: readme) }
it 'returns the expected InterestingFinding' do
expected = WPScan::Readme.new(
expected = WPScan::Model::Readme.new(
target.url(file),
confidence: 100,
found_by: described_class::DIRECT_ACCESS

View File

@@ -36,7 +36,7 @@ describe WPScan::Finders::InterestingFindings::UploadSQLDump do
let(:fixture) { 'dump.sql' }
it 'returns the interesting findings' do
@expected = WPScan::UploadSQLDump.new(
@expected = WPScan::Model::UploadSQLDump.new(
finder.dump_url,
confidence: 100,
found_by: described_class::DIRECT_ACCESS

View File

@@ -13,7 +13,7 @@ describe WPScan::Finders::InterestingFindings::WPCron do
let(:status) { 200 }
it 'returns the InterestingFinding' do
expect(finder.aggressive).to eql WPScan::WPCron.new(
expect(finder.aggressive).to eql WPScan::Model::WPCron.new(
finder.wp_cron_url,
confidence: 60,
found_by: described_class::DIRECT_ACCESS

View File

@@ -28,7 +28,7 @@ describe WPScan::Finders::MainTheme::CssStyle do
let(:fixture) { 'link_href.html' }
it 'returns the expected theme' do
@expected = WPScan::Theme.new(
@expected = WPScan::Model::Theme.new(
'twentyfifteen',
target,
found_by: 'Css Style (Passive Detection)',
@@ -42,7 +42,7 @@ describe WPScan::Finders::MainTheme::CssStyle do
let(:fixture) { 'style_code.html' }
it 'returns the expected theme' do
@expected = WPScan::Theme.new(
@expected = WPScan::Model::Theme.new(
'custom',
target,
found_by: 'Css Style (Passive Detection)',

View File

@@ -22,7 +22,7 @@ describe WPScan::Finders::MainTheme::UrlsInHomepage do
@expected = []
{ 'twentyfifteen' => 6, 'yolo' => 4, 'test' => 2 }.each do |slug, confidence|
@expected << WPScan::Theme.new(
@expected << WPScan::Model::Theme.new(
slug, target, found_by: 'Urls In Homepage (Passive Detection)', confidence: confidence
)
end

View File

@@ -26,7 +26,7 @@ describe WPScan::Finders::MainTheme::WooFrameworkMetaGenerator do
it 'returns the expected theme' do
@file = 'woo_generator.html'
@expected = WPScan::Theme.new(
@expected = WPScan::Model::Theme.new(
'Merchant', target,
found_by: 'Woo Framework Meta Generator (Passive Detection)',
confidence: 80

View File

@@ -1,11 +1,11 @@
describe WPScan::Finders::PluginVersion::Readme do
subject(:finder) { described_class.new(plugin) }
let(:plugin) { WPScan::Plugin.new('spec', target) }
let(:plugin) { WPScan::Model::Plugin.new('spec', target) }
let(:target) { WPScan::Target.new('http://wp.lab/') }
let(:fixtures) { FINDERS_FIXTURES.join('plugin_version', 'readme') }
def version(number, found_by, confidence)
WPScan::Version.new(
WPScan::Model::Version.new(
number,
found_by: format('Readme - %s (Aggressive Detection)', found_by),
confidence: confidence,
@@ -31,7 +31,7 @@ describe WPScan::Finders::PluginVersion::Readme do
expect(finder.aggressive).to eql @expected
end
let(:readme_url) { plugin.url(WPScan::WpItem::READMES.sample) }
let(:readme_url) { plugin.url(WPScan::Model::WpItem::READMES.sample) }
context 'when no version' do
it 'returns nil' do

View File

@@ -3,7 +3,7 @@
describe WPScan::Finders::PluginVersion::Base do
subject(:plugin_version) { described_class.new(plugin) }
let(:plugin) { WPScan::Plugin.new(slug, target) }
let(:plugin) { WPScan::Model::Plugin.new(slug, target) }
let(:target) { WPScan::Target.new('http://wp.lab/') }
let(:default_finders) { %w[Readme] }

View File

@@ -6,6 +6,6 @@ describe WPScan::Finders::Plugins::BodyPattern do
let(:fixtures) { DYNAMIC_FINDERS_FIXTURES.join('plugin_version') }
let(:expected_all) { df_expected_all['plugins'] }
let(:item_class) { WPScan::Plugin }
let(:item_class) { WPScan::Model::Plugin }
end
end

View File

@@ -6,6 +6,6 @@ describe WPScan::Finders::Plugins::Comment do
let(:fixtures) { DYNAMIC_FINDERS_FIXTURES.join('plugin_version') }
let(:expected_all) { df_expected_all['plugins'] }
let(:item_class) { WPScan::Plugin }
let(:item_class) { WPScan::Model::Plugin }
end
end

View File

@@ -8,6 +8,6 @@ describe WPScan::Finders::Plugins::ConfigParser do
# let(:fixtures) { DYNAMIC_FINDERS_FIXTURES.join('plugin_version') }
#
# let(:expected_all) { df_expected_all['plugins'] }
# let(:item_class) { WPScan::Plugin }
# let(:item_class) { WPScan::Model::Plugin }
# end
end

View File

@@ -5,7 +5,7 @@ describe WPScan::Finders::Plugins::HeaderPattern do
let(:fixtures) { DYNAMIC_FINDERS_FIXTURES.join('plugin_version') }
def plugin(slug)
WPScan::Plugin.new(slug, target)
WPScan::Model::Plugin.new(slug, target)
end
describe '#passive' do

View File

@@ -6,6 +6,6 @@ describe WPScan::Finders::Plugins::JavascriptVar do
let(:fixtures) { DYNAMIC_FINDERS_FIXTURES.join('plugin_version') }
let(:expected_all) { df_expected_all['plugins'] }
let(:item_class) { WPScan::Plugin }
let(:item_class) { WPScan::Model::Plugin }
end
end

View File

@@ -6,6 +6,6 @@ describe WPScan::Finders::Plugins::Xpath do
let(:fixtures) { DYNAMIC_FINDERS_FIXTURES.join('plugin_version') }
let(:expected_all) { df_expected_all['plugins'] }
let(:item_class) { WPScan::Plugin }
let(:item_class) { WPScan::Model::Plugin }
end
end

View File

@@ -1,6 +1,6 @@
describe WPScan::Finders::ThemeVersion::Style do
subject(:finder) { described_class.new(theme) }
let(:theme) { WPScan::Theme.new('spec', target) }
let(:theme) { WPScan::Model::Theme.new('spec', target) }
let(:target) { WPScan::Target.new('http://wp.lab/') }
let(:fixtures) { FINDERS_FIXTURES.join('theme_version', 'style') }
@@ -81,7 +81,7 @@ describe WPScan::Finders::ThemeVersion::Style do
it 'returns the expected version' do
expected = if expected_version
WPScan::Version.new(
WPScan::Model::Version.new(
expected_version,
confidence: 80,
interesting_entries: ["#{theme.style_url}, Version: #{expected_version}"]

View File

@@ -1,6 +1,6 @@
describe WPScan::Finders::ThemeVersion::WooFrameworkMetaGenerator do
subject(:finder) { described_class.new(theme) }
let(:theme) { WPScan::Theme.new(slug, target) }
let(:theme) { WPScan::Model::Theme.new(slug, target) }
let(:target) { WPScan::Target.new('http://wp.lab/') }
let(:fixtures) { FINDERS_FIXTURES.join('theme_version', 'woo_framework_meta_generator') }
@@ -28,7 +28,7 @@ describe WPScan::Finders::ThemeVersion::WooFrameworkMetaGenerator do
let(:slug) { 'Editorial' }
it 'return the expected version' do
@expected = WPScan::Version.new(
@expected = WPScan::Model::Version.new(
'1.3.5',
found_by: 'Woo Framework Meta Generator (Passive Detection)',
confidence: 80

View File

@@ -1,6 +1,6 @@
describe WPScan::Finders::ThemeVersion::Base do
subject(:theme_version) { described_class.new(theme) }
let(:theme) { WPScan::Plugin.new(slug, target) }
let(:theme) { WPScan::Model::Plugin.new(slug, target) }
let(:target) { WPScan::Target.new('http://wp.lab/') }
let(:slug) { 'spec' }
let(:default_finders) { %w[Style WooFrameworkMetaGenerator] }

View File

@@ -1,6 +1,6 @@
describe WPScan::Finders::TimthumbVersion::BadRequest do
subject(:finder) { described_class.new(target) }
let(:target) { WPScan::Timthumb.new(url) }
let(:target) { WPScan::Model::Timthumb.new(url) }
let(:url) { 'http://ex.lo/timthumb.php' }
let(:fixtures) { FINDERS_FIXTURES.join('timthumb_version', 'bad_request') }
@@ -20,7 +20,7 @@ describe WPScan::Finders::TimthumbVersion::BadRequest do
let(:file) { '2.8.14.php' }
it 'returns the expected version' do
@expected = WPScan::Version.new(
@expected = WPScan::Model::Version.new(
'2.8.14',
confidence: 90,
found_by: 'Bad Request (Aggressive Detection)',

View File

@@ -1,6 +1,6 @@
describe WPScan::Finders::TimthumbVersion::Base do
subject(:timthumb_version) { described_class.new(target) }
let(:target) { WPScan::Timthumb.new(url) }
let(:target) { WPScan::Model::Timthumb.new(url) }
let(:url) { 'http://ex.lo/timthumb.php' }
describe '#finders' do

View File

@@ -24,12 +24,12 @@ describe WPScan::Finders::Users::RSSGenerator do
stub_request(:get, target.url('feed/rss2/'))
expect(finder.aggressive).to eql [
CMSScanner::User.new(
WPScan::Model::User.new(
'admin',
confidence: 50,
found_by: 'Rss Generator (Aggressive Detection)'
),
CMSScanner::User.new(
WPScan::Model::User.new(
'Aa Dias-Gildes',
confidence: 50,
found_by: 'Rss Generator (Aggressive Detection)'
@@ -45,12 +45,12 @@ describe WPScan::Finders::Users::RSSGenerator do
stub_request(:get, target.url('feed/')).to_return(body: rss_fixture)
expect(finder.passive).to eql [
CMSScanner::User.new(
WPScan::Model::User.new(
'admin',
confidence: 50,
found_by: 'Rss Generator (Passive Detection)'
),
CMSScanner::User.new(
WPScan::Model::User.new(
'Aa Dias-Gildes',
confidence: 50,
found_by: 'Rss Generator (Passive Detection)'
@@ -63,12 +63,12 @@ describe WPScan::Finders::Users::RSSGenerator do
stub_request(:get, target.url('comments/feed/')).to_return(body: rss_fixture)
expect(finder.aggressive(mode: :mixed)).to eql [
CMSScanner::User.new(
WPScan::Model::User.new(
'admin',
confidence: 50,
found_by: 'Rss Generator (Aggressive Detection)'
),
CMSScanner::User.new(
WPScan::Model::User.new(
'Aa Dias-Gildes',
confidence: 50,
found_by: 'Rss Generator (Aggressive Detection)'
@@ -82,12 +82,12 @@ describe WPScan::Finders::Users::RSSGenerator do
stub_request(:get, target.url('feed/')).to_return(body: rss_fixture)
expect(finder.aggressive).to eql [
CMSScanner::User.new(
WPScan::Model::User.new(
'admin',
confidence: 50,
found_by: 'Rss Generator (Aggressive Detection)'
),
CMSScanner::User.new(
WPScan::Model::User.new(
'Aa Dias-Gildes',
confidence: 50,
found_by: 'Rss Generator (Aggressive Detection)'

View File

@@ -22,7 +22,7 @@ describe WPScan::Finders::WpVersion::AtomGenerator do
stub_request(:get, target.url('?feed=atom'))
expect(finder.aggressive).to eql [
WPScan::WpVersion.new(
WPScan::Model::WpVersion.new(
'4.0',
confidence: 80,
found_by: 'Atom Generator (Aggressive Detection)',
@@ -42,7 +42,7 @@ describe WPScan::Finders::WpVersion::AtomGenerator do
stub_request(:get, target.url('?feed=atom')).to_return(body: atom_fixture)
expect(finder.passive).to eql [
WPScan::WpVersion.new(
WPScan::Model::WpVersion.new(
'4.0',
confidence: 80,
found_by: 'Atom Generator (Passive Detection)',
@@ -59,7 +59,7 @@ describe WPScan::Finders::WpVersion::AtomGenerator do
stub_request(:get, target.url('feed/atom/')).to_return(body: atom_fixture)
expect(finder.aggressive(mode: :mixed)).to eql [
WPScan::WpVersion.new(
WPScan::Model::WpVersion.new(
'4.0',
confidence: 80,
found_by: 'Atom Generator (Aggressive Detection)',
@@ -78,7 +78,7 @@ describe WPScan::Finders::WpVersion::AtomGenerator do
stub_request(:get, target.url('?feed=atom'))
expect(finder.aggressive).to eql [
WPScan::WpVersion.new(
WPScan::Model::WpVersion.new(
'4.0',
confidence: 80,
found_by: 'Atom Generator (Aggressive Detection)',

View File

@@ -33,7 +33,7 @@ describe WPScan::Finders::WpVersion::Readme do
let(:file) { '4.0.html' }
it 'returns the expected version' do
@expected = WPScan::WpVersion.new(
@expected = WPScan::Model::WpVersion.new(
'4.0',
confidence: 90,
found_by: 'Readme (Aggressive Detection)',