Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show characters typed in decrypt-backup #594

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/mvt/ios/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import os

import click
from rich.prompt import Prompt
from prompt_toolkit import prompt

from mvt.common.cmd_check_iocs import CmdCheckIOCS
from mvt.common.logo import logo
Expand Down Expand Up @@ -120,10 +120,11 @@ def decrypt_backup(ctx, destination, password, key_file, hashes, backup_path):

backup.decrypt_with_password(password)
elif MVT_IOS_BACKUP_PASSWORD in os.environ:
log.info("Using password from %s environment variable", MVT_IOS_BACKUP_PASSWORD)
log.info("Using password from %s environment variable",
MVT_IOS_BACKUP_PASSWORD)
backup.decrypt_with_password(os.environ[MVT_IOS_BACKUP_PASSWORD])
else:
sekrit = Prompt.ask("Enter backup password", password=True)
sekrit = prompt("Enter backup password: ", is_password=True)
backup.decrypt_with_password(sekrit)

if not backup.can_process():
Expand Down Expand Up @@ -153,7 +154,8 @@ def decrypt_backup(ctx, destination, password, key_file, hashes, backup_path):
"--key-file",
"-k",
required=False,
type=click.Path(exists=False, file_okay=True, dir_okay=False, writable=True),
type=click.Path(exists=False, file_okay=True,
dir_okay=False, writable=True),
help=HELP_MSG_BACKUP_KEYFILE,
)
@click.argument("BACKUP_PATH", type=click.Path(exists=True))
Expand All @@ -173,10 +175,11 @@ def extract_key(password, key_file, backup_path):
MVT_IOS_BACKUP_PASSWORD,
)
elif MVT_IOS_BACKUP_PASSWORD in os.environ:
log.info("Using password from %s environment variable", MVT_IOS_BACKUP_PASSWORD)
log.info("Using password from %s environment variable",
MVT_IOS_BACKUP_PASSWORD)
password = os.environ[MVT_IOS_BACKUP_PASSWORD]
else:
password = Prompt.ask("Enter backup password", password=True)
password = prompt("Enter backup password: ", is_password=True)

backup.decrypt_with_password(password)
backup.get_key()
Expand Down