|
7 | 7 | import shutil
|
8 | 8 | import sys
|
9 | 9 | import csv
|
| 10 | +import logging |
10 | 11 | from collections import defaultdict
|
11 | 12 | from datetime import datetime
|
12 | 13 | from pathlib import Path
|
| 14 | + |
| 15 | +# hide secretsdump hash output |
13 | 16 | from contextlib import redirect_stdout
|
14 | 17 |
|
15 | 18 | # zblurx's ntdsutil.py
|
|
32 | 35 | BOLD_WHITE = "\033[1;37m"
|
33 | 36 | RESET = "\033[0m"
|
34 | 37 |
|
| 38 | +# hide secretsdump info outputs |
| 39 | +logging.getLogger("impacket").disabled = True |
| 40 | + |
35 | 41 | def parse_args():
|
36 | 42 | parser = argparse.ArgumentParser(
|
37 | 43 | description=""
|
@@ -174,25 +180,26 @@ def reveal_credentials(individual_ntds_path, cracked_hashes, session_dir, enable
|
174 | 180 | for _, _, line_out, _ in output_lines:
|
175 | 181 | print(line_out)
|
176 | 182 |
|
| 183 | + output_file_txt = session_dir / "revealhashed.txt" |
| 184 | + with open(output_file_txt, "w") as outf: |
| 185 | + for password_key, user, _, status in output_lines: |
| 186 | + status_str = " <disabled>" if status == "disabled" else "" |
| 187 | + outf.write(f"{user:<40} {password_key}{status_str}\n") |
| 188 | + |
| 189 | + print(f"\n{BOLD_GREEN}[+]{RESET} Output saved to {output_file_txt}") |
| 190 | + |
177 | 191 | if to_csv:
|
178 |
| - output_file = session_dir / "revealhashed.csv" |
179 |
| - with open(output_file, "w", newline="") as outf: |
| 192 | + output_file_csv = session_dir / "revealhashed.csv" |
| 193 | + with open(output_file_csv, "w", newline="") as outf: |
180 | 194 | writer = csv.writer(outf)
|
181 | 195 | writer.writerow(["Username", "Password", "Status"])
|
182 | 196 | for password_key, user, _, status in output_lines:
|
183 | 197 | stat = "disabled" if status == "disabled" else ""
|
184 | 198 | writer.writerow([user, password_key, stat])
|
185 |
| - else: |
186 |
| - output_file = session_dir / "revealhashed.txt" |
187 |
| - with open(output_file, "w") as outf: |
188 |
| - for password_key, user, _, status in output_lines: |
189 |
| - status_str = " <disabled>" if status == "disabled" else "" |
190 |
| - outf.write(f"{user:<40} {password_key}{status_str}\n") |
191 |
| - |
192 |
| - print(f"\n{BOLD_GREEN}[+]{RESET} Output saved to {output_file}") |
| 199 | + print(f"{BOLD_GREEN}[+]{RESET} Output saved to {output_file_csv}") |
193 | 200 |
|
194 | 201 | def main():
|
195 |
| - print(f"\n{BOLD_BLUE}revealhashed v0.1.3{RESET}\n") |
| 202 | + print(f"\n{BOLD_BLUE}revealhashed v0.1.4{RESET}\n") |
196 | 203 |
|
197 | 204 | parser = parse_args()
|
198 | 205 | args = parser.parse_args()
|
@@ -239,7 +246,7 @@ def main():
|
239 | 246 | local_ops = LocalOperations(str(system_path))
|
240 | 247 | boot_key = local_ops.getBootKey()
|
241 | 248 |
|
242 |
| - with open(os.devnull, 'w') as fnull, redirect_stdout(fnull): |
| 249 | + with open(os.devnull, 'w') as fnull, redirect_stdout(fnull): # hide secretsdump hash output |
243 | 250 | ntds = NTDSHashes(
|
244 | 251 | str(ntds_path),
|
245 | 252 | boot_key,
|
@@ -337,7 +344,7 @@ def main():
|
337 | 344 | if __name__ == "__main__":
|
338 | 345 | main()
|
339 | 346 |
|
340 |
| -# revealhashed v0.1.3 |
| 347 | +# revealhashed v0.1.4 |
341 | 348 | #
|
342 | 349 | # contact options
|
343 | 350 | # mail: https://blog.zurrak.com/contact.html
|
|
0 commit comments