use credential objects inside results
altered results to just hold a credential object instead of duplicating attributesbug/bundler_fix
parent
4995fcdced
commit
0dd22395eb
|
@ -32,9 +32,7 @@ module Metasploit
|
|||
# @return [Metasploit::Framework::LoginScanner::Result] The LoginScanner Result object
|
||||
def attempt_login(credential)
|
||||
result_options = {
|
||||
private: credential.private,
|
||||
public: credential.public,
|
||||
realm: nil
|
||||
credential: credential
|
||||
}
|
||||
|
||||
begin
|
||||
|
|
|
@ -10,18 +10,12 @@ module Metasploit
|
|||
# @!attribute [r] access_level
|
||||
# @return [String] the access level gained
|
||||
attr_reader :access_level
|
||||
# @!attribute [r] private
|
||||
# @return [String] the private(e.g. password) component
|
||||
attr_reader :private
|
||||
# @!attribute [r] credential
|
||||
# @return [Credential] the Credential object the result is for
|
||||
attr_reader :credential
|
||||
# @!attribute [r] proof
|
||||
# @return [String,nil] the proof that the lgoin was successful
|
||||
attr_reader :proof
|
||||
# @!attribute [r] public
|
||||
# @return [String] the public(e.g. username) component
|
||||
attr_reader :public
|
||||
# @!attribute [r] realm
|
||||
# @return [String] the realm(e.g. domain name) component
|
||||
attr_reader :realm
|
||||
# @!attribute [r] status
|
||||
# @return [Symbol] the status of the attempt (e.g. success, failed, etc)
|
||||
attr_reader :status
|
||||
|
@ -34,10 +28,8 @@ module Metasploit
|
|||
# @option opts [Symbol] :status The status code returned
|
||||
def initialize(opts= {})
|
||||
@access_level = opts.fetch(:access_level, nil)
|
||||
@private = opts.fetch(:private)
|
||||
@credential = opts.fetch(:credential)
|
||||
@proof = opts.fetch(:proof, nil)
|
||||
@public = opts.fetch(:public)
|
||||
@realm = opts.fetch(:realm)
|
||||
@status = opts.fetch(:status)
|
||||
end
|
||||
|
||||
|
|
|
@ -16,9 +16,7 @@ module Metasploit
|
|||
# @return [Metasploit::Framework::LoginScanner::Result] The LoginScanner Result object
|
||||
def attempt_login(credential)
|
||||
result_options = {
|
||||
private: nil,
|
||||
public: credential.public,
|
||||
realm: nil
|
||||
credential: credential
|
||||
}
|
||||
|
||||
[:SNMPv1, :SNMPv2c].each do |version|
|
||||
|
|
|
@ -51,9 +51,7 @@ module Metasploit
|
|||
}
|
||||
|
||||
result_options = {
|
||||
private: credential.private,
|
||||
public: credential.public,
|
||||
realm: nil
|
||||
credential: credential
|
||||
}
|
||||
begin
|
||||
::Timeout.timeout(connection_timeout) do
|
||||
|
|
|
@ -54,9 +54,7 @@ module Metasploit
|
|||
}
|
||||
|
||||
result_options = {
|
||||
private: credential.private,
|
||||
public: credential.public,
|
||||
realm: nil
|
||||
credential: credential
|
||||
}
|
||||
begin
|
||||
::Timeout.timeout(connection_timeout) do
|
||||
|
|
|
@ -8,22 +8,21 @@ describe Metasploit::Framework::LoginScanner::Result do
|
|||
let(:public) { 'root' }
|
||||
let(:realm) { nil }
|
||||
let(:status) { :success }
|
||||
let(:cred) {
|
||||
Metasploit::Framework::LoginScanner::Credential.new(public: public, private: private, realm: realm, paired: true)
|
||||
}
|
||||
|
||||
subject(:login_result) {
|
||||
described_class.new(
|
||||
private: private,
|
||||
credential: cred,
|
||||
proof: proof,
|
||||
public: public,
|
||||
status: status,
|
||||
realm: realm
|
||||
status: status
|
||||
)
|
||||
}
|
||||
|
||||
it { should respond_to :access_level }
|
||||
it { should respond_to :private }
|
||||
it { should respond_to :credential }
|
||||
it { should respond_to :proof }
|
||||
it { should respond_to :public }
|
||||
it { should respond_to :realm }
|
||||
it { should respond_to :status }
|
||||
it { should respond_to :success? }
|
||||
|
||||
|
|
|
@ -244,30 +244,24 @@ shared_examples_for 'Metasploit::Framework::LoginScanner::Base' do
|
|||
context '#scan!' do
|
||||
let(:success) {
|
||||
::Metasploit::Framework::LoginScanner::Result.new(
|
||||
private: public,
|
||||
credential: pub_pub,
|
||||
proof: '',
|
||||
public: public,
|
||||
realm: nil,
|
||||
status: :success
|
||||
)
|
||||
}
|
||||
|
||||
let(:failure_blank) {
|
||||
::Metasploit::Framework::LoginScanner::Result.new(
|
||||
private: '',
|
||||
credential: pub_blank,
|
||||
proof: nil,
|
||||
public: public,
|
||||
realm: nil,
|
||||
status: :failed
|
||||
)
|
||||
}
|
||||
|
||||
let(:failure) {
|
||||
::Metasploit::Framework::LoginScanner::Result.new(
|
||||
private: private,
|
||||
credential: pub_pri,
|
||||
proof: nil,
|
||||
public: public,
|
||||
realm: nil,
|
||||
status: :failed
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue