-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexport-authy.py
57 lines (50 loc) · 1.24 KB
/
export-authy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import argparse
import sys
from authy import Authy, AuthyInstallationNotFound, AuthyNotFound, SecretsNotFound
parser = argparse.ArgumentParser(prog=sys.argv[0])
option_group = parser.add_mutually_exclusive_group(required=True)
option_group.add_argument(
"-i",
"--install",
help="install a specific version of Authy (needed to export)",
action="store_true",
)
parser.add_argument(
"-f",
"--force",
help="forces download and installation",
action="store_true",
default=False,
)
option_group.add_argument(
"-e",
"--export",
help="export secrets as json",
action="store_true",
)
option_group.add_argument(
"-d",
"--dump",
help="dump secrets to stdout",
action="store_true",
)
option_group.add_argument(
"-r",
"--revert",
help="re-enable the updater",
action="store_true",
)
args = parser.parse_args()
authy = Authy()
try:
if args.install:
authy.install_authy(force=args.force)
elif args.export:
authy.export()
elif args.dump:
authy.print_secrets()
elif args.revert:
authy.recover_updater()
print("[i] Update.exe has been recovered")
except (AuthyNotFound, AuthyInstallationNotFound, SecretsNotFound) as e:
print(f"[x] {e}")