2013-04-01 21:06:40 +00:00
|
|
|
#
|
|
|
|
# Specs
|
|
|
|
#
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
#
|
|
|
|
# Project
|
|
|
|
#
|
|
|
|
|
|
|
|
require 'metasploit/framework/database'
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
describe Msf::DBManager do
|
2013-09-30 18:47:53 +00:00
|
|
|
include_context 'Msf::DBManager'
|
|
|
|
|
|
|
|
subject do
|
|
|
|
db_manager
|
|
|
|
end
|
|
|
|
|
2014-10-13 13:40:34 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Client'
|
2014-10-09 16:44:15 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Cred'
|
2014-10-13 14:12:49 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Event'
|
2014-10-13 14:43:40 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::ExploitAttempt'
|
2014-10-09 17:58:30 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::ExploitedHost'
|
2014-10-09 16:16:04 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Host'
|
2014-10-13 15:27:55 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::HostDetail'
|
2014-10-13 16:03:21 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::HostTag'
|
2014-10-09 14:40:11 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::IPAddress'
|
2014-10-09 20:07:17 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Import'
|
2013-09-30 18:47:53 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::ImportMsfXml'
|
2014-10-09 20:21:43 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Loot'
|
2014-10-08 20:30:20 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Migration'
|
2014-10-09 14:14:45 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::ModuleCache'
|
2014-10-09 20:39:55 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Note'
|
2014-10-13 15:12:09 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Ref'
|
2014-10-13 14:24:27 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Report'
|
2014-10-09 16:35:07 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Service'
|
2014-10-13 15:52:39 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Session'
|
2014-10-08 20:30:20 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Sink'
|
2014-10-13 14:32:42 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Task'
|
2014-10-09 20:51:39 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Vuln'
|
2014-10-13 14:58:59 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::VulnDetail'
|
2014-10-09 15:49:26 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::WMAP'
|
2014-10-08 20:54:29 +00:00
|
|
|
it_should_behave_like 'Msf::DBManager::Workspace'
|
2013-09-30 18:47:53 +00:00
|
|
|
|
2014-10-07 20:49:42 +00:00
|
|
|
context 'CONSTANTS' do
|
|
|
|
context 'ADAPTER' do
|
|
|
|
subject(:adapter) {
|
|
|
|
described_class::ADAPTER
|
|
|
|
}
|
|
|
|
|
|
|
|
it { is_expected.to eq('postgresql') }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to respond_to :active }
|
|
|
|
|
2014-05-12 20:03:51 +00:00
|
|
|
context '#add_rails_engine_migration_paths' do
|
|
|
|
def add_rails_engine_migration_paths
|
|
|
|
db_manager.add_rails_engine_migration_paths
|
2013-09-30 18:47:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not add duplicate paths to ActiveRecord::Migrator.migrations_paths' do
|
2014-05-12 20:03:51 +00:00
|
|
|
add_rails_engine_migration_paths
|
2013-09-30 18:47:53 +00:00
|
|
|
|
|
|
|
expect {
|
2014-05-12 20:03:51 +00:00
|
|
|
add_rails_engine_migration_paths
|
2013-09-30 18:47:53 +00:00
|
|
|
}.to_not change {
|
|
|
|
ActiveRecord::Migrator.migrations_paths.length
|
|
|
|
}
|
|
|
|
|
|
|
|
ActiveRecord::Migrator.migrations_paths.uniq.should == ActiveRecord::Migrator.migrations_paths
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-10-07 20:49:42 +00:00
|
|
|
it { is_expected.to respond_to :after_establish_connection }
|
2014-10-08 16:07:15 +00:00
|
|
|
it { is_expected.to respond_to :check }
|
2014-10-07 20:49:42 +00:00
|
|
|
it { is_expected.to respond_to :connect }
|
|
|
|
it { is_expected.to respond_to :connection_established? }
|
|
|
|
it { is_expected.to respond_to :create_db }
|
|
|
|
it { is_expected.to respond_to :disconnect }
|
|
|
|
it { is_expected.to respond_to :driver }
|
|
|
|
it { is_expected.to respond_to :drivers }
|
|
|
|
it { is_expected.to respond_to :drivers= }
|
|
|
|
it { is_expected.to respond_to :error }
|
|
|
|
it { is_expected.to respond_to :initialize_adapter }
|
|
|
|
it { is_expected.to respond_to :initialize_database_support }
|
2014-10-08 16:07:15 +00:00
|
|
|
it { is_expected.to respond_to :report_session_event }
|
|
|
|
it { is_expected.to respond_to :report_session_route }
|
|
|
|
it { is_expected.to respond_to :report_session_route_remove }
|
|
|
|
it { is_expected.to respond_to :report_vuln_attempt }
|
|
|
|
it { is_expected.to respond_to :report_web_form }
|
|
|
|
it { is_expected.to respond_to :report_web_page }
|
|
|
|
it { is_expected.to respond_to :report_web_site }
|
|
|
|
it { is_expected.to respond_to :report_web_vuln }
|
|
|
|
it { is_expected.to respond_to :service_name_map }
|
2014-10-07 20:49:42 +00:00
|
|
|
it { is_expected.to respond_to :usable }
|
|
|
|
it { is_expected.to respond_to :usable= }
|
|
|
|
it { is_expected.to respond_to :warn_about_rubies }
|
2013-04-01 21:06:40 +00:00
|
|
|
end
|