From e7eb3bcce85c5d437082214c0e8044919cccee56 Mon Sep 17 00:00:00 2001 From: Gustaf Blomqvist Date: Thu, 28 Apr 2022 15:18:13 +0200 Subject: [PATCH] Fix double logging of first hash or cleartext --- utils.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/utils.py b/utils.py index ec38a54..423df33 100755 --- a/utils.py +++ b/utils.py @@ -337,16 +337,10 @@ def SaveToDb(result): logfile = os.path.join(settings.Config.ResponderPATH, 'logs', fname) if not count: - with open(logfile,"a") as outf: - if len(result['cleartext']): # If we obtained cleartext credentials, write them to file - outf.write('%s:%s\n' % (result['user'].encode('utf8', 'replace'), result['cleartext'].encode('utf8', 'replace'))) - else: # Otherwise, write JtR-style hash string to file - outf.write(result['fullhash'] + '\n')#.encode('utf8', 'replace') + '\n') - cursor.execute("INSERT INTO responder VALUES(datetime('now'), ?, ?, ?, ?, ?, ?, ?, ?)", (result['module'], result['type'], result['client'], result['hostname'], result['user'], result['cleartext'], result['hash'], result['fullhash'])) cursor.commit() - if settings.Config.CaptureMultipleHashFromSameHost: + if not count or settings.Config.CaptureMultipleHashFromSameHost: with open(logfile,"a") as outf: if len(result['cleartext']): # If we obtained cleartext credentials, write them to file outf.write('%s:%s\n' % (result['user'].encode('utf8', 'replace'), result['cleartext'].encode('utf8', 'replace')))