diff --git a/spec/lib/metasploit/framework/login_scanner/afp_spec.rb b/spec/lib/metasploit/framework/login_scanner/afp_spec.rb index 6058f28178..5aa0a55d9a 100644 --- a/spec/lib/metasploit/framework/login_scanner/afp_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/afp_spec.rb @@ -6,7 +6,7 @@ describe Metasploit::Framework::LoginScanner::AFP do subject(:scanner) { described_class.new } - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' it { should respond_to :login_timeout } diff --git a/spec/lib/metasploit/framework/login_scanner/axis2_spec.rb b/spec/lib/metasploit/framework/login_scanner/axis2_spec.rb index 6f8ac034d4..e75465609e 100644 --- a/spec/lib/metasploit/framework/login_scanner/axis2_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/axis2_spec.rb @@ -4,7 +4,7 @@ require 'metasploit/framework/login_scanner/axis2' describe Metasploit::Framework::LoginScanner::Axis2 do - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, false + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: false it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' it_behaves_like 'Metasploit::Framework::LoginScanner::HTTP' diff --git a/spec/lib/metasploit/framework/login_scanner/db2_spec.rb b/spec/lib/metasploit/framework/login_scanner/db2_spec.rb index 9ef375c50e..b189325340 100644 --- a/spec/lib/metasploit/framework/login_scanner/db2_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/db2_spec.rb @@ -9,7 +9,7 @@ describe Metasploit::Framework::LoginScanner::DB2 do } subject(:login_scanner) { described_class.new } - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, true + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: true it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' context '#attempt_login' do diff --git a/spec/lib/metasploit/framework/login_scanner/ftp_spec.rb b/spec/lib/metasploit/framework/login_scanner/ftp_spec.rb index 0d47563d22..a6bff50954 100644 --- a/spec/lib/metasploit/framework/login_scanner/ftp_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/ftp_spec.rb @@ -45,7 +45,7 @@ describe Metasploit::Framework::LoginScanner::FTP do described_class.new } - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' diff --git a/spec/lib/metasploit/framework/login_scanner/http_spec.rb b/spec/lib/metasploit/framework/login_scanner/http_spec.rb index b55587f1bf..e0065623f6 100644 --- a/spec/lib/metasploit/framework/login_scanner/http_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/http_spec.rb @@ -4,7 +4,7 @@ require 'metasploit/framework/login_scanner/http' describe Metasploit::Framework::LoginScanner::HTTP do - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, false + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: false it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' it_behaves_like 'Metasploit::Framework::LoginScanner::HTTP' diff --git a/spec/lib/metasploit/framework/login_scanner/mssql_spec.rb b/spec/lib/metasploit/framework/login_scanner/mssql_spec.rb index 1f0a081761..c00f3c61a0 100644 --- a/spec/lib/metasploit/framework/login_scanner/mssql_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/mssql_spec.rb @@ -32,7 +32,7 @@ describe Metasploit::Framework::LoginScanner::MSSQL do subject(:login_scanner) { described_class.new } - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, true + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: true it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' it_behaves_like 'Metasploit::Framework::LoginScanner::NTLM' diff --git a/spec/lib/metasploit/framework/login_scanner/mysql_spec.rb b/spec/lib/metasploit/framework/login_scanner/mysql_spec.rb index bde95164dc..44f870696e 100644 --- a/spec/lib/metasploit/framework/login_scanner/mysql_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/mysql_spec.rb @@ -30,7 +30,7 @@ describe Metasploit::Framework::LoginScanner::MySQL do subject(:login_scanner) { described_class.new } - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' context '#attempt_login' do diff --git a/spec/lib/metasploit/framework/login_scanner/pop3_spec.rb b/spec/lib/metasploit/framework/login_scanner/pop3_spec.rb index a3c4b0eca2..e07b7d482e 100644 --- a/spec/lib/metasploit/framework/login_scanner/pop3_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/pop3_spec.rb @@ -4,7 +4,7 @@ require 'metasploit/framework/login_scanner/pop3' describe Metasploit::Framework::LoginScanner::POP3 do subject(:scanner) { described_class.new } - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' context "#attempt_login" do diff --git a/spec/lib/metasploit/framework/login_scanner/postgres_spec.rb b/spec/lib/metasploit/framework/login_scanner/postgres_spec.rb index 7be4413342..739a25eaec 100644 --- a/spec/lib/metasploit/framework/login_scanner/postgres_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/postgres_spec.rb @@ -25,7 +25,7 @@ describe Metasploit::Framework::LoginScanner::Postgres do subject(:login_scanner) { described_class.new } - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, true + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: true context '#attempt_login' do context 'when the login is successful' do diff --git a/spec/lib/metasploit/framework/login_scanner/smb_spec.rb b/spec/lib/metasploit/framework/login_scanner/smb_spec.rb index 5af446647e..6f1a84948a 100644 --- a/spec/lib/metasploit/framework/login_scanner/smb_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/smb_spec.rb @@ -32,7 +32,7 @@ describe Metasploit::Framework::LoginScanner::SMB do subject(:login_scanner) { described_class.new } - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, true + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: true it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' it_behaves_like 'Metasploit::Framework::LoginScanner::NTLM' diff --git a/spec/lib/metasploit/framework/login_scanner/snmp_spec.rb b/spec/lib/metasploit/framework/login_scanner/snmp_spec.rb index 52f769402c..95c4d85cd8 100644 --- a/spec/lib/metasploit/framework/login_scanner/snmp_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/snmp_spec.rb @@ -29,7 +29,7 @@ describe Metasploit::Framework::LoginScanner::SNMP do described_class.new } - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false context '#attempt_login' do diff --git a/spec/lib/metasploit/framework/login_scanner/ssh_spec.rb b/spec/lib/metasploit/framework/login_scanner/ssh_spec.rb index 00c210f65a..71af4b2aa2 100644 --- a/spec/lib/metasploit/framework/login_scanner/ssh_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/ssh_spec.rb @@ -55,7 +55,7 @@ describe Metasploit::Framework::LoginScanner::SSH do described_class.new } - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false it { should respond_to :verbosity } diff --git a/spec/lib/metasploit/framework/login_scanner/telnet_spec.rb b/spec/lib/metasploit/framework/login_scanner/telnet_spec.rb index a25cf44477..fcf80b69ca 100644 --- a/spec/lib/metasploit/framework/login_scanner/telnet_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/telnet_spec.rb @@ -5,7 +5,7 @@ describe Metasploit::Framework::LoginScanner::Telnet do subject(:login_scanner) { described_class.new } - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' it { should respond_to :banner_timeout } diff --git a/spec/lib/metasploit/framework/login_scanner/tomcat_spec.rb b/spec/lib/metasploit/framework/login_scanner/tomcat_spec.rb index 3abb1ef8ec..ef050c0ba0 100644 --- a/spec/lib/metasploit/framework/login_scanner/tomcat_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/tomcat_spec.rb @@ -4,7 +4,7 @@ require 'metasploit/framework/login_scanner/tomcat' describe Metasploit::Framework::LoginScanner::Tomcat do - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, false + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: false it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' it_behaves_like 'Metasploit::Framework::LoginScanner::HTTP' diff --git a/spec/lib/metasploit/framework/login_scanner/vnc_spec.rb b/spec/lib/metasploit/framework/login_scanner/vnc_spec.rb index 1aa3d9434c..50076c4b91 100644 --- a/spec/lib/metasploit/framework/login_scanner/vnc_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/vnc_spec.rb @@ -12,7 +12,7 @@ describe Metasploit::Framework::LoginScanner::VNC do } subject(:login_scanner) { described_class.new } - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' diff --git a/spec/lib/metasploit/framework/login_scanner/winrm_spec.rb b/spec/lib/metasploit/framework/login_scanner/winrm_spec.rb index 062e2dcbff..a4fc368a70 100644 --- a/spec/lib/metasploit/framework/login_scanner/winrm_spec.rb +++ b/spec/lib/metasploit/framework/login_scanner/winrm_spec.rb @@ -4,7 +4,7 @@ require 'metasploit/framework/login_scanner/winrm' describe Metasploit::Framework::LoginScanner::WinRM do - it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, true + it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: true it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' it_behaves_like 'Metasploit::Framework::LoginScanner::HTTP' diff --git a/spec/support/shared/examples/metasploit/framework/login_scanner/login_scanner_base.rb b/spec/support/shared/examples/metasploit/framework/login_scanner/login_scanner_base.rb index b9c9e8a72e..e5e0e462f5 100644 --- a/spec/support/shared/examples/metasploit/framework/login_scanner/login_scanner_base.rb +++ b/spec/support/shared/examples/metasploit/framework/login_scanner/login_scanner_base.rb @@ -1,5 +1,5 @@ -shared_examples_for 'Metasploit::Framework::LoginScanner::Base' do | has_realm_key, has_default_realm | +shared_examples_for 'Metasploit::Framework::LoginScanner::Base' do | opts | subject(:login_scanner) { described_class.new } @@ -295,7 +295,7 @@ shared_examples_for 'Metasploit::Framework::LoginScanner::Base' do | has_realm_k context '#each_credential' do - if has_realm_key + if opts[:has_realm_key] context 'when the login_scanner has a REALM_KEY' do context 'when the credential has a realm' do before(:each) do @@ -308,7 +308,7 @@ shared_examples_for 'Metasploit::Framework::LoginScanner::Base' do | has_realm_k end end - if has_default_realm + if opts[:has_default_realm] context 'when the credential has no realm' do before(:each) do login_scanner.cred_details = [pub_pri] @@ -323,9 +323,7 @@ shared_examples_for 'Metasploit::Framework::LoginScanner::Base' do | has_realm_k end end - end - - unless has_realm_key + else context 'when login_scanner has no REALM_KEY' do context 'when the credential has a realm' do before(:each) do @@ -353,6 +351,7 @@ shared_examples_for 'Metasploit::Framework::LoginScanner::Base' do | has_realm_k end + end end