Move Tcp specs into their own shared example

All the Tcp options formerly in RexSocket got moved, this just brings
the specs in line with the new reality.
bug/bundler_fix
James Lee 2014-10-22 09:16:14 -05:00
parent 46acf08e2d
commit bb119b840a
No known key found for this signature in database
GPG Key ID: 2D6094C7CEA0A321
13 changed files with 69 additions and 55 deletions

View File

@ -8,6 +8,7 @@ describe Metasploit::Framework::LoginScanner::AFP do
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
it_behaves_like 'Metasploit::Framework::Tcp::Client'
it { should respond_to :login_timeout } it { should respond_to :login_timeout }

View File

@ -11,6 +11,7 @@ describe Metasploit::Framework::LoginScanner::DB2 do
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: 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::RexSocket'
it_behaves_like 'Metasploit::Framework::Tcp::Client'
context '#attempt_login' do context '#attempt_login' do

View File

@ -47,6 +47,7 @@ describe Metasploit::Framework::LoginScanner::FTP do
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
it_behaves_like 'Metasploit::Framework::Tcp::Client'

View File

@ -35,6 +35,7 @@ describe Metasploit::Framework::LoginScanner::MSSQL do
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: 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::RexSocket'
it_behaves_like 'Metasploit::Framework::LoginScanner::NTLM' it_behaves_like 'Metasploit::Framework::LoginScanner::NTLM'
it_behaves_like 'Metasploit::Framework::Tcp::Client'
it { should respond_to :windows_authentication } it { should respond_to :windows_authentication }

View File

@ -6,6 +6,7 @@ describe Metasploit::Framework::LoginScanner::POP3 do
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
it_behaves_like 'Metasploit::Framework::Tcp::Client'
context "#attempt_login" do context "#attempt_login" do

View File

@ -35,6 +35,7 @@ describe Metasploit::Framework::LoginScanner::SMB do
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: 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::RexSocket'
it_behaves_like 'Metasploit::Framework::LoginScanner::NTLM' it_behaves_like 'Metasploit::Framework::LoginScanner::NTLM'
it_behaves_like 'Metasploit::Framework::Tcp::Client'
it { should respond_to :smb_chunk_size } it { should respond_to :smb_chunk_size }
it { should respond_to :smb_name } it { should respond_to :smb_name }

View File

@ -7,6 +7,7 @@ describe Metasploit::Framework::LoginScanner::Telnet do
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
it_behaves_like 'Metasploit::Framework::Tcp::Client'
it { should respond_to :banner_timeout } it { should respond_to :banner_timeout }
it { should respond_to :telnet_timeout } it { should respond_to :telnet_timeout }

View File

@ -6,6 +6,7 @@ describe Metasploit::Framework::LoginScanner::VMAUTHD do
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
it_behaves_like 'Metasploit::Framework::Tcp::Client'
context "#attempt_login" do context "#attempt_login" do

View File

@ -14,6 +14,7 @@ describe Metasploit::Framework::LoginScanner::VNC do
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket' it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
it_behaves_like 'Metasploit::Framework::Tcp::Client'
context '#attempt_login' do context '#attempt_login' do

View File

@ -1,60 +1,7 @@
shared_examples_for 'Metasploit::Framework::LoginScanner::RexSocket' do shared_examples_for 'Metasploit::Framework::LoginScanner::RexSocket' do
subject(:login_scanner) { described_class.new } subject(:login_scanner) { described_class.new }
it { should respond_to :send_delay }
it { should respond_to :max_send_size }
it { should respond_to :ssl } it { should respond_to :ssl }
it { should respond_to :ssl_version } it { should respond_to :ssl_version }
context 'send_delay' do
it 'is not valid for a non-number' do
login_scanner.send_delay = "a"
expect(login_scanner).to_not be_valid
expect(login_scanner.errors[:send_delay]).to include "is not a number"
end
it 'is not valid for a floating point' do
login_scanner.send_delay = 5.76
expect(login_scanner).to_not be_valid
expect(login_scanner.errors[:send_delay]).to include "must be an integer"
end
it 'is not valid for a negative number' do
login_scanner.send_delay = -8
expect(login_scanner).to_not be_valid
expect(login_scanner.errors[:send_delay]).to include "must be greater than or equal to 0"
end
it 'is valid for a legitimate number' do
login_scanner.send_delay = rand(1000) + 1
expect(login_scanner.errors[:send_delay]).to be_empty
end
end
context 'max_send_size' do
it 'is not valid for a non-number' do
login_scanner.max_send_size = "a"
expect(login_scanner).to_not be_valid
expect(login_scanner.errors[:max_send_size]).to include "is not a number"
end
it 'is not valid for a floating point' do
login_scanner.max_send_size = 5.76
expect(login_scanner).to_not be_valid
expect(login_scanner.errors[:max_send_size]).to include "must be an integer"
end
it 'is not valid for a negative number' do
login_scanner.max_send_size = -8
expect(login_scanner).to_not be_valid
expect(login_scanner.errors[:max_send_size]).to include "must be greater than or equal to 0"
end
it 'is valid for a legitimate number' do
login_scanner.max_send_size = rand(1000) + 1
expect(login_scanner.errors[:max_send_size]).to be_empty
end
end
end end

View File

@ -0,0 +1,58 @@
shared_examples_for 'Metasploit::Framework::Tcp::Client' do
subject(:login_scanner) { described_class.new }
it { should respond_to :send_delay }
it { should respond_to :max_send_size }
context 'send_delay' do
it 'is not valid for a non-number' do
login_scanner.send_delay = "a"
expect(login_scanner).to_not be_valid
expect(login_scanner.errors[:send_delay]).to include "is not a number"
end
it 'is not valid for a floating point' do
login_scanner.send_delay = 5.76
expect(login_scanner).to_not be_valid
expect(login_scanner.errors[:send_delay]).to include "must be an integer"
end
it 'is not valid for a negative number' do
login_scanner.send_delay = -8
expect(login_scanner).to_not be_valid
expect(login_scanner.errors[:send_delay]).to include "must be greater than or equal to 0"
end
it 'is valid for a legitimate number' do
login_scanner.send_delay = rand(1000) + 1
expect(login_scanner.errors[:send_delay]).to be_empty
end
end
context 'max_send_size' do
it 'is not valid for a non-number' do
login_scanner.max_send_size = "a"
expect(login_scanner).to_not be_valid
expect(login_scanner.errors[:max_send_size]).to include "is not a number"
end
it 'is not valid for a floating point' do
login_scanner.max_send_size = 5.76
expect(login_scanner).to_not be_valid
expect(login_scanner.errors[:max_send_size]).to include "must be an integer"
end
it 'is not valid for a negative number' do
login_scanner.max_send_size = -8
expect(login_scanner).to_not be_valid
expect(login_scanner.errors[:max_send_size]).to include "must be greater than or equal to 0"
end
it 'is valid for a legitimate number' do
login_scanner.max_send_size = rand(1000) + 1
expect(login_scanner.errors[:max_send_size]).to be_empty
end
end
end