Skip to content

Commit

Permalink
fix to_credential on core
Browse files Browse the repository at this point in the history
the Metasploit::Credential::Core to_credential
method now seats private_type and realm_key correctly
  • Loading branch information
David Maloney authored and David Maloney committed Jul 7, 2014
1 parent aeda74f commit 38419da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion app/concerns/metasploit/credential/core/to_credential.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# Adds associations to `Metasploit::Credential::Core` which are inverses of association on models under
# {BruteForce::Reuse}.
require 'metasploit/framework/credential'

module Metasploit::Credential::Core::ToCredential
extend ActiveSupport::Concern

included do

def to_credential
Metasploit::Framework::Credential.new(public: public.try(:username), private: private.try(:data), realm: realm.try(:value) )
if private.present?
private_type = private.type.demodulize.underscore.to_sym
else
private_type = nil
end
Metasploit::Framework::Credential.new(public: public.try(:username), private: private.try(:data), private_type: private_type, realm: realm.try(:value), realm_key: realm.try(:key) )
end

end
Expand Down
2 changes: 1 addition & 1 deletion lib/metasploit/framework/credential_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def prepend_cred(cred)
# @yieldparam credential [Metasploit::Framework::Credential]
# @return [void]
def each
if pass_file
if pass_file.present?
pass_fd = File.open(pass_file, 'r:binary')
end

Expand Down

0 comments on commit 38419da

Please sign in to comment.