@@ -101,24 +101,39 @@ def report_creds(domain, user, pass)
101
101
return if ( user . empty? or pass . empty? )
102
102
return if pass . include? ( "n.a." )
103
103
104
- if session . db_record
105
- source_id = session . db_record . id
106
- else
107
- source_id = nil
104
+ # Assemble data about the credential objects we will be creating
105
+ credential_data = {
106
+ origin_type : :session ,
107
+ post_reference_name : self . refname ,
108
+ private_data : pass ,
109
+ private_type : :password ,
110
+ session_id : session_db_id ,
111
+ username : user ,
112
+ workspace_id : myworkspace_id
113
+ }
114
+
115
+ unless domain . blank?
116
+ credential_data [ :realm_key ] = Metasploit ::Model ::Realm ::Key ::ACTIVE_DIRECTORY_DOMAIN
117
+ credential_data [ :realm_value ] = domain
108
118
end
109
119
110
- report_auth_info (
111
- :host => session . session_host ,
112
- :port => 445 ,
113
- :sname => 'smb' ,
114
- :proto => 'tcp' ,
115
- :source_id => source_id ,
116
- :source_type => "exploit" ,
117
- :user => "#{ domain } \\ #{ user } " ,
118
- :pass => pass
119
- )
120
+ credential_core = create_credential ( credential_data )
121
+
122
+ # Assemble the options hash for creating the Metasploit::Credential::Login object
123
+ login_data = {
124
+ core : credential_core ,
125
+ status : Metasploit ::Model ::Login ::Status ::UNTRIED ,
126
+ address : ::Rex ::Socket . getaddress ( session . sock . peerhost , true ) ,
127
+ port : 445 ,
128
+ service_name : 'smb' ,
129
+ protocol : 'tcp' ,
130
+ workspace_id : myworkspace_id
131
+ }
132
+
133
+ create_credential_login ( login_data )
120
134
end
121
135
136
+
122
137
def is_system_user? ( user )
123
138
system_users = [
124
139
/^$/ ,
0 commit comments