pass_for_luks_5 = pexpect.spawn(f'sudo cryptsetup luksAddKey -S2 "{luks_part}"',encoding='utf-8')
pass_for_luks_5.expect(['Enter any existing passphrase: ',pexpect.EOF])
pass_for_luks_5.sendline(KEY1)
print(pass_for_luks_5.before)
print(pass_for_luks_5.after)
pass_for_luks_5.expect('Enter new passphrase for key slot: ')
pass_for_luks_5.sendline(KEY2)
print(pass_for_luks_5.before)
print(pass_for_luks_5.after)
pass_for_luks_5.expect('Verify passphrase: ')
pass_for_luks_5.sendline(KEY2)
print(pass_for_luks_5.before)
print(pass_for_luks_5.after)
Enter any existing passphrase:
Enter new passphrase for key slot:
Verify passphrase:
Весь код, основное