mirror of https://github.com/n1nj4sec/pupy.git
display a message when creds db is empty
This commit is contained in:
parent
b03b5eb4e8
commit
069d892ec0
|
@ -36,6 +36,7 @@ class Credentials():
|
||||||
json_db.write(json.dumps(db))
|
json_db.write(json.dumps(db))
|
||||||
|
|
||||||
def show(self):
|
def show(self):
|
||||||
|
res=""
|
||||||
tool = ""
|
tool = ""
|
||||||
with open(self.db) as json_db:
|
with open(self.db) as json_db:
|
||||||
data = json.load(json_db)
|
data = json.load(json_db)
|
||||||
|
@ -45,20 +46,24 @@ class Credentials():
|
||||||
for creds in data:
|
for creds in data:
|
||||||
if "Tool" in creds:
|
if "Tool" in creds:
|
||||||
if tool != creds["Tool"]:
|
if tool != creds["Tool"]:
|
||||||
print '\n---------- %s ---------- \n' % creds["Tool"]
|
res+= '\n---------- %s ---------- \n\n' % creds["Tool"]
|
||||||
tool = creds["Tool"]
|
tool = creds["Tool"]
|
||||||
del creds["Tool"]
|
del creds["Tool"]
|
||||||
|
|
||||||
if tool == 'Creddump':
|
if tool == 'Creddump':
|
||||||
for cred in creds:
|
for cred in creds:
|
||||||
if creds[cred]:
|
if creds[cred]:
|
||||||
print '%s' % creds[cred]
|
res+= '%s\n' % creds[cred]
|
||||||
else:
|
else:
|
||||||
for cred in creds:
|
for cred in creds:
|
||||||
if creds[cred]:
|
if creds[cred]:
|
||||||
print '%s: %s' % (cred, creds[cred])
|
res+= '%s: %s\n' % (cred, creds[cred])
|
||||||
print
|
res+="\n"
|
||||||
print
|
|
||||||
|
if not res.strip():
|
||||||
|
print "The credential database is empty !"
|
||||||
|
else:
|
||||||
|
print res
|
||||||
|
|
||||||
def flush(self):
|
def flush(self):
|
||||||
if os.path.exists(self.db):
|
if os.path.exists(self.db):
|
||||||
|
|
Loading…
Reference in New Issue