@@ -48,21 +48,39 @@ def run
48
48
print_good "Collecting hashes..."
49
49
50
50
hashes . each do |hash |
51
- data = { }
52
- data [ :host ] = addr
53
- data [ :port ] = 445
54
- data [ :sname ] = 'smb'
55
- data [ :user ] = hash . user_name
56
- data [ :pass ] = hash . lanman + ":" + hash . ntlm
57
- data [ :type ] = "smb_hash"
58
- if not session . db_record . nil?
59
- data [ :source_id ] = session . db_record . id
60
- end
61
- data [ :source_type ] = "exploit" ,
62
- data [ :active ] = true
63
-
64
- print_line " Extracted: #{ data [ :user ] } :#{ data [ :pass ] } "
65
- report_auth_info ( data ) if db_ok
51
+ # Build service information
52
+ service_data = {
53
+ address : addr ,
54
+ port : 445 ,
55
+ service_name : 'smb' ,
56
+ protocol : 'tcp' ,
57
+ }
58
+
59
+ # Build credential information
60
+ credential_data = {
61
+ origin_type : :session ,
62
+ post_reference_name : self . fullname ,
63
+ private_type : :ntlm_hash ,
64
+ private_data : hash . lanman + ":" + hash . ntlm ,
65
+ username : hash . user_name ,
66
+ workspace_id : myworkspace_id
67
+ }
68
+
69
+ credential_data [ :session_id ] = session . db_record . id if !session . db_record . nil?
70
+ credential_data . merge! ( service_data )
71
+ credential_core = create_credential ( credential_data )
72
+
73
+ # Assemble the options hash for creating the Metasploit::Credential::Login object
74
+ login_data = {
75
+ core : credential_core ,
76
+ status : Metasploit ::Model ::Login ::Status ::UNTRIED ,
77
+ workspace_id : myworkspace_id
78
+ }
79
+
80
+ login_data . merge! ( service_data )
81
+ create_credential_login ( login_data )
82
+
83
+ print_line " Extracted: #{ credential_data [ :username ] } :#{ credential_data [ :private_data ] } "
66
84
end
67
85
68
86
# Record user tokens
0 commit comments