Skip to content

Commit 061ee49

Browse files
committed
fix output for keepass2
1 parent 7afb4af commit 061ee49

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

nxc/modules/keepass_trigger.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,9 @@ def extract_password(self, context):
390390
if root_entries is not None:
391391
for entry in root_entries:
392392
if entry is not None:
393-
password = entry.find("./String[Key='Password']/Value")
394393
self.print_password(context, entry)
395394
else:
396-
context.log.highlight("")
395+
context.log.highlight("None")
397396

398397
objects = root.findall("./Root/Group")
399398
while objects:
@@ -406,9 +405,10 @@ def extract_password(self, context):
406405
objects.extend(current_object.findall("./Group"))
407406

408407
def print_password(self, context, entry):
409-
context.log.highlight(str("-------------------------------------"))
410-
context.log.highlight(str("Title") + " : " + str(entry.find("./String[Key='Title']/Value").text))
411-
context.log.highlight(str("UserName") + " : " + str(entry.find("./String[Key='UserName']/Value").text))
412-
context.log.highlight(str("URL") + " : " + str(entry.find("./String[Key='URL']/Value").text))
413-
context.log.highlight(str("Password") + " : " + str(entry.find("./String[Key='Password']/Value").text))
414-
context.log.highlight(str("Notes") + " : " + str(entry.find("./String[Key='Notes']/Value").text))
408+
for entry in entries.findall("./String"):
409+
key = entry.find("./Key")
410+
value = entry.find("./Value")
411+
key_text = key.text if key is not None else "None"
412+
value_text = value.text if value is not None and value.text is not None else "None"
413+
context.log.highlight((f"{key_text} : {value_text}"))
414+
context.log.highlight(str("-------------------------------------"))

0 commit comments

Comments
 (0)