Skip to content

Commit 3235b1d

Browse files
committed
Add description to output
1 parent c60141f commit 3235b1d

3 files changed

Lines changed: 18 additions & 8 deletions

File tree

nxc/data/veeam_dump_module/veeam_dump_mssql.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ $rows | ForEach-Object -Process {
6060
$pw_string = "COULD_NOT_DECRYPT"
6161
}
6262
}
63+
$_.user = $_.user -replace '\s', 'WHITESPACE_ERROR'
6364
$_.password = $pw_string
65+
$_.description = $_.description -replace '\s', 'WHITESPACE_ERROR'
6466
}
6567

66-
Write-Output $rows | Format-Table -HideTableHeaders | Out-String
68+
Write-Output $output | Format-Table -HideTableHeaders | Out-String -Width 10000

nxc/data/veeam_dump_module/veeam_dump_postgresql.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ $output | ForEach-Object -Process {
4242
$pw_string = "COULD_NOT_DECRYPT"
4343
}
4444
}
45+
$_.user = $_.user -replace '\s', 'WHITESPACE_ERROR'
4546
$_.password = $pw_string
47+
$_.description = $_.description -replace '\s', 'WHITESPACE_ERROR'
4648
}
4749

48-
Write-Output $output | Format-Table -HideTableHeaders | Out-String
50+
Write-Output $output | Format-Table -HideTableHeaders | Out-String -Width 10000

nxc/modules/veeam.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,19 @@ def printCreds(self, context, output):
167167
# When powershell returns something else than the usernames and passwords account.split() will throw a ValueError.
168168
# This is likely an error thrown by powershell, so we print the error and the output for debugging purposes.
169169
try:
170+
context.log.highlight(f"{'Username':<30} {'Password':<30} {'Description'}")
171+
context.log.highlight(f"{'--------':<30} {'--------':<30} {'-----------'}")
170172
for account in output_stripped:
171-
user, password = account.split(" ", 1)
172-
password = password.strip().replace("WHITESPACE_ERROR", " ")
173-
user = user.strip()
174-
context.log.highlight(f"{user}:{password}")
175-
if " " in password:
176-
context.log.fail(f'Password contains whitespaces! The password for user "{user}" is: "{password}"')
173+
# Remove multiple whitespaces
174+
account = " ".join(account.split())
175+
try:
176+
user, password, description = account.split(" ", 2)
177+
except ValueError:
178+
user, password = account.split(" ", 1)
179+
user = user.strip().replace("WHITESPACE_ERROR", " ").strip()
180+
password = password.strip().replace("WHITESPACE_ERROR", " ").strip()
181+
description = description.strip().replace("WHITESPACE_ERROR", " ").strip()
182+
context.log.highlight(f"{user:<30} {password:<30} {description}")
177183
except ValueError:
178184
context.log.fail(f"Powershell returned unexpected output: {output_stripped}")
179185
context.log.fail("Please report this issue on GitHub!")

0 commit comments

Comments
 (0)