-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
78 lines (63 loc) · 1.88 KB
/
main.py
File metadata and controls
78 lines (63 loc) · 1.88 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Offsync Execution Starts From Here.
import sys
from pyperclip import copy
from offsync import cli
from offsync.storage import Database
from offsync.ui import set_mode
Database().init_database()
if __name__ == "__main__":
args = sys.argv
argc = len(args)
continuous = argc == 3 and args[2] == "c"
if argc > 1 and args[1] not in ["add", "remove", "update", "prompt", "pwned", "export", "help"] or argc == 3 and args[
2] != "c":
cli.usage()
print(">>> Invalid Option! <<<")
sys.exit(2)
if argc > 3:
cli.usage()
print(">>> Too Many Arguments! <<<")
sys.exit(2)
if argc != 1 and args[1] == "add":
set_mode("Save Mode")
if continuous:
cli.add_profiles()
else:
cli.add_profile()
elif argc != 1 and args[1] == "remove":
set_mode("Delete Mode")
if continuous:
cli.remove_profiles()
else:
cli.remove_profile()
elif argc != 1 and args[1] == "update":
set_mode("Update Mode")
if continuous:
cli.usage()
print(">>> Unsupported Argument `c` <<<")
sys.exit(2)
else:
cli.change_password()
elif argc != 1 and args[1] == "pwned":
if continuous:
cli.usage()
print(">>> Unsupported Argument `c` <<<")
sys.exit(2)
else:
cli.pwned_profiles()
elif argc != 1 and args[1] == "export":
if continuous:
cli.usage()
print(">>> Unsupported Argument `c` <<<")
sys.exit(2)
else:
cli.export_passwords()
elif argc != 1 and args[1] == "help":
cli.usage()
else:
set_mode("View Mode")
if argc == 2 and args[1] == "prompt":
cli.get_password(prompt=True)
else:
cli.get_password()
copy("")