From 6c61e79ebf48ca6f55eb1aafad9a491046af3db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 24 Nov 2013 03:19:11 +0100 Subject: [PATCH] backups: don't echo entered passwords --- qvm-tools/qvm-backup | 4 ++-- qvm-tools/qvm-backup-restore | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/qvm-tools/qvm-backup b/qvm-tools/qvm-backup index ef8994f6..cc76471e 100755 --- a/qvm-tools/qvm-backup +++ b/qvm-tools/qvm-backup @@ -26,6 +26,7 @@ from qubes.qubesutils import backup_prepare, backup_do_copy from optparse import OptionParser import os import sys +import getpass def print_progress(progress): print >> sys.stderr, "\r-> Backing up files: {0}%...".format (progress), @@ -92,8 +93,7 @@ def main(): if not (prompt == "y" or prompt == "Y"): exit (0) - passphrase = raw_input("Please enter the pass phrase that will be used to encrypt/verify the backup:\n") - passphrase = passphrase.replace("\r","").replace("\n","") + passphrase = getpass.getpass("Please enter the pass phrase that will be used to encrypt/verify the backup: ") try: backup_do_copy(base_backup_dir, files_to_backup, passphrase, progress_callback=print_progress, encrypt=options.encrypt,appvm=options.appvm) diff --git a/qvm-tools/qvm-backup-restore b/qvm-tools/qvm-backup-restore index bf1c1253..6ac22088 100755 --- a/qvm-tools/qvm-backup-restore +++ b/qvm-tools/qvm-backup-restore @@ -30,6 +30,7 @@ from optparse import OptionParser import os import sys +import getpass def main(): usage = "usage: %prog [options] " @@ -95,8 +96,7 @@ def main(): restore_options['exclude'] = options.exclude - passphrase = raw_input("Please enter the pass phrase that will be used to decrypt/verify the backup:\n") - passphrase = passphrase.replace("\r","").replace("\n","") + passphrase = getpass.getpass("Please enter the pass phrase that will be used to decrypt/verify the backup: ") print >> sys.stderr, "Checking backup content..." restore_tmpdir,qubes_xml = backup_restore_header(backup_dir, passphrase, options.decrypt, appvm=options.appvm)