Skip to content

Commit

Permalink
Merge pull request #115 from Pennyw0rth/neff-bugfixes
Browse files Browse the repository at this point in the history
Adding error handling for unexpected powershell output, see issue #93
  • Loading branch information
Marshall-Hallenbeck committed Nov 12, 2023
2 parents 426e446 + 862aef7 commit 54eb620
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions nxc/modules/veeam_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,18 @@ def printCreds(self, context, output):
context.log.fail(output_stripped[0])
return

for account in output_stripped:
user, password = account.split(" ", 1)
password = password.replace("WHITESPACE_ERROR", " ")
context.log.highlight(user + ":" + f"{password}")
if " " in password:
context.log.fail(f'Password contains whitespaces! The password for user "{user}" is: "{password}"')
# When powershell returns something else than the usernames and passwords account.split() will throw a ValueError.
# This is likely an error thrown by powershell, so we print the error and the output for debugging purposes.
try:
for account in output_stripped:
user, password = account.split(" ", 1)
password = password.replace("WHITESPACE_ERROR", " ")
context.log.highlight(f"{user}:{password}")
if " " in password:
context.log.fail(f'Password contains whitespaces! The password for user "{user}" is: "{password}"')
except ValueError:
context.log.fail(f"Powershell returned unexpected output: {output_stripped}")
context.log.fail("Please report this issue on GitHub!")

def on_admin_login(self, context, connection):
self.checkVeeamInstalled(context, connection)

0 comments on commit 54eb620

Please sign in to comment.