Adding debug

This commit is contained in:
Anton Hvornum 2022-02-09 15:02:22 +01:00
parent 50cc9f2dfe
commit 563f15db4d
No known key found for this signature in database
GPG Key ID: F1234C5BA67C59DF
1 changed files with 6 additions and 5 deletions

View File

@ -107,11 +107,12 @@ class luks2:
pw_given = False
while cryptworker.is_alive():
if bytes(f'Enter passphrase for {partition.path}', 'UTF-8') in cryptworker and pw_given is False:
cryptworker.write(password)
with open('debug.txt', 'a') as silent_output:
silent_output.write(f"We did write the output to {cryptworker}")
pw_given = True
with open('debug_outer.txt', 'a') as silent_output:
found = bytes(f'Enter passphrase for {partition.path}', 'UTF-8') in cryptworker
silent_output.write(f"Found string in worker: {found} / {pw_given}")
if found and pw_given is False:
cryptworker.write(password)
pw_given = True
if cryptworker.exit_code == 256:
log(f'{partition} is being used, trying to unmount and crypt-close the device and running one more attempt at encrypting the device: {cryptworker}', level=logging.INFO)