add uid to creds DB

This commit is contained in:
n1nj4sec 2016-08-27 12:58:47 +02:00
parent 958432d5d8
commit 31ce1efdc0
3 changed files with 10 additions and 7 deletions

View File

@ -118,7 +118,7 @@ class CredDump(PupyModule):
db = Credentials()
db.add([
{'hashes':hsh, 'Tool': 'Creddump'} for hsh in hashes
{'hashes':hsh, 'Tool': 'Creddump', 'uid':self.client.short_name()} for hsh in hashes
])
for hsh in hashes:
@ -192,7 +192,7 @@ class CredDump(PupyModule):
if not lmhash: lmhash = empty_lm
if not nthash: nthash = empty_nt
self.log("%s:%d:%s:%s:::" % (get_user_name(user), int(user.Name, 16), lmhash.encode('hex'), nthash.encode('hex')))
hashes.append({'hashes': "%s:%d:%s:%s:::" % (get_user_name(user), int(user.Name, 16), lmhash.encode('hex'), nthash.encode('hex')), 'Tool': 'Creddump'})
hashes.append({'hashes': "%s:%d:%s:%s:::" % (get_user_name(user), int(user.Name, 16), lmhash.encode('hex'), nthash.encode('hex')), 'Tool': 'Creddump', 'uid':self.client.short_name()})
db = Credentials()
db.add(hashes)

View File

@ -102,6 +102,7 @@ class LaZagne(PupyModule):
for cred in creds:
clean_cred = {}
clean_cred['Tool'] = 'Lazagne'
clean_cred['uid']=self.client.short_name()
for c in cred.keys():
clean_cred[c] = cred[c].encode('utf-8')
print "%s: %s" % (c, cred[c])
@ -141,6 +142,7 @@ class LaZagne(PupyModule):
ishashes = False
if cred:
cred['Tool']="LaZagne"
cred['uid']=self.client.short_name()
if user:
cred['System user'] = user
if category:

View File

@ -1,7 +1,8 @@
from __future__ import unicode_literals
import os
import json
class Credentials():
class Credentials(object):
def __init__(self):
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "data", "db"))
dbName = 'creds.json'
@ -43,6 +44,8 @@ class Credentials():
# List sorted by Tools
data = sorted(data['creds'], key=lambda d: d["Tool"], reverse=True)
max_uid_len = max([len(x.get("uid","?")) for x in data])
for creds in data:
if "Tool" in creds:
if tool != creds["Tool"]:
@ -51,13 +54,11 @@ class Credentials():
del creds["Tool"]
if tool == 'Creddump':
for cred in creds:
if creds[cred]:
res+= '%s\n' % creds[cred]
res+= ('{:<%s} / {}\n'%(max_uid_len)).format(creds.get("uid", "?"), creds["hashes"].strip())
else:
for cred in creds:
if creds[cred]:
res+= '%s: %s\n' % (cred, creds[cred])
res+= '%s: %s\n' % (cred.strip(), creds[cred].strip())
res+="\n"
if not res.strip():