This repository has been archived by the owner on Sep 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OnePass.py
679 lines (621 loc) · 31.2 KB
/
OnePass.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
# ----- License ---------------------------------------------------------------------------------------------------- #
# OnePass Copyright (C) 2024 Steven Pereira
# This program comes with ABSOLUTELY NO WARRANTY.
# This is free software, and you are welcome to redistribute it under certain conditions.
# ----- Import Section --------------------------------------------------------------------------------------------- #
import os
import time
import sqlite3
import random
import string
import keyring
import pwinput
import base64
# from rich import print
from rich import box
from rich.console import Console
from rich.table import Table
from rich.table import Column
from cryptography.fernet import Fernet
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
# ----- Global Declaration ----------------------------------------------------------------------------------------- #
console = Console()
# ----- Database --------------------------------------------------------------------------------------------------- #
class database():
def connect():
connect = sqlite3.connect(r"Database/OnePass.db")
cursor = connect.cursor
connect.commit()
return connect
def create():
if os.path.exists(r"Database/"):
if os.path.exists(r"Database/OnePass.db"):
database.connect()
pass
else:
database.connect()
else:
os.mkdir(r"Database/")
database.connect()
# ----- Tables ----------------------------------------------------------------------------------------------------- #
def tables():
database.create()
connect = sqlite3.connect(r"Database/OnePass.db")
cursor = connect.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS 'Passwords'
(
ID INTEGER Primary Key,
Name TEXT(100),
Username TEXT(100),
Password TEXT(100),
'Email Address' TEXT(100),
URL TEXT(100),
Description TEXT(1000),
Folder CHAR(100))''')
# ----- Values ----------------------------------------------------------------------------------------------------- #
def values():
console.print("[#5bd2f0]──────[#ffaf68] Adding a Password [#5bd2f0]───────────────────────────────────────────────────────────────────────────────\n")
name = console.input("[#ffaf68]Enter the name of the account: ")
username = console.input("[#ffaf68]Enter the username of the account: ")
password = console.input("[#ffaf68]Enter the password of the account: ")
email = console.input("[#ffaf68]Enter the email address associated with this account: ")
url = console.input("[#ffaf68]Enter the URL of this account: ")
while True:
check = ["Y", "y", "N", "n"]
description_check = console.input("[#ffaf68][?] Do you want to add any notes to this account? [Y/n]: ")
if description_check in check:
if description_check == "y" or description_check == "Y":
description = console.input("[#ffaf68]Enter a note for the account: ")
break
else:
description = ""
break
else:
print("[#FF756D][!] You've entered the wrong input. Please try again...")
while True:
check = ["Y", "y", "N", "n"]
folder_check = console.input("[#ffaf68][?] Do you want to add this account to a folder? [Y/n]: ")
if folder_check in check:
if folder_check == "y" or folder_check == "Y":
folder = console.input("[#ffaf68]Enter the name of the folder: ")
break
else:
folder = ""
break
else:
print("[#FF756D][!] You've entered the wrong input. Please try again...")
store(name, username, password, email, url, description, folder)
console.print("[#79d45e][+] Successfully added an account into OnePass")
console.print("[#5bd2f0]──────[#ffaf68] Output [#5bd2f0]───────────────────────────────────────────────────────────────────────────────\n")
display_passwords()
# ----- Store ------------------------------------------------------------------------------------------------------ #
def store(name, username, password, email, url, description, folder):
connect = sqlite3.connect(r"Database/OnePass.db")
cursor = connect.cursor()
sqlQuery = "INSERT INTO 'Passwords' (Name, Username, Password, 'Email Address', URL, Description, Folder) VALUES (?, ?, ?, ?, ?, ?, ?)"
values = (name, username, password, email, url, description, folder)
cursor.execute(sqlQuery, values)
connect.commit()
# ----- Display ---------------------------------------------------------------------------------------------------- #
def display_passwords():
console.print("[#5bd2f0]──────[#ffaf68] Displaying all Passwords [#5bd2f0]──────────────────────────────────────────────────────────────────────────\n")
connect = sqlite3.connect(r"Database/OnePass.db")
cursor = connect.cursor()
sqlQuery = "SELECT * FROM 'Passwords'"
cursor.execute(sqlQuery)
rows = cursor.fetchall()
table = Table(
Column(header="ID", style="#B9EAED", header_style="#7CB5D2"),
Column(header="Name", style="#D9C4EC", header_style="#B19CD8"),
Column(header="Username", style="#B9EAED", header_style="#7CB5D2"),
Column(header="Password", style="#D9C4EC", header_style="#B19CD8"),
Column(header="Email Address", style="#B9EAED", header_style="#7CB5D2"),
Column(header="URL", style="#B9EAED", header_style="#7CB5D2"),
Column(header="Description", style="#D9C4EC", header_style="#B19CD8"),
Column(header="Folder", style="#B9EAED", header_style="#7CB5D2"),
box=box.ROUNDED,
safe_box=False)
for row in rows:
table.add_row(str(row[0]),str(row[1]),str(row[2]),str(row[3]),str(row[4]),str(row[5]),str(row[6]),str(row[7]))
console.print(table)
def display_folders():
console.print("[#5bd2f0]──────[#ffaf68] Displaying all Folders [#5bd2f0]──────────────────────────────────────────────────────────────────────────\n")
connect = sqlite3.connect(r"Database/OnePass.db")
cursor = connect.cursor()
sqlQuery = "SELECT DISTINCT Folder FROM 'Passwords'"
cursor.execute(sqlQuery)
rows = cursor.fetchall()
table = Table(
Column(header="Folders", style="#D9C4EC", header_style="#B19CD8"),
box=box.ROUNDED,
safe_box=False)
for row in rows:
table.add_row(str(row[0]))
console.print(table)
# ----- Update ----------------------------------------------------------------------------------------------------- #
def update():
console.print("[#5bd2f0]──────[#ffaf68] Updating a Password [#5bd2f0]─────────────────────────────────────────────────────────────────────────────\n")
display_passwords()
connect = sqlite3.connect(r"Database/OnePass.db")
cursor = connect.cursor()
id_no = console.input("[#ffaf68]Enter the ID number of the account that you want to update: ")
console.print(f"[#79d45e][+] Updating password with ID - {id_no}: ")
column_name = str.title(console.input("[#ffaf68]Enter the column name that you want to update: "))
column_value = console.input("[#ffaf68]Enter the value of " + column_name + ": ")
if column_name == "Name":
sqlQuery = "UPDATE 'Passwords' SET Name = ? WHERE ID = ?"
cursor.execute(sqlQuery, ([column_value, id_no]))
console.print("[#79d45e][+] Successfully updated a password")
connect.commit()
elif column_name == "Username":
sqlQuery = "UPDATE 'Passwords' SET Username = ? WHERE ID = ?"
cursor.execute(sqlQuery, ([column_value, id_no]))
console.print("[#79d45e][+] Successfully updated a password")
connect.commit()
elif column_name == "Password":
sqlQuery = "UPDATE 'Passwords' SET Password = ? WHERE ID = ?"
cursor.execute(sqlQuery, ([column_value, id_no]))
console.print("[#79d45e][+] Successfully updated a password")
connect.commit()
elif column_name == "Email Address":
sqlQuery = "UPDATE 'Passwords' SET 'Email Address' = ? WHERE ID = ?"
cursor.execute(sqlQuery, ([column_value, id_no]))
console.print("[#79d45e][+] Successfully updated a password")
connect.commit()
elif column_name == "URL":
sqlQuery = "UPDATE 'Passwords' SET URL = ? WHERE ID = ?"
cursor.execute(sqlQuery, ([column_value, id_no]))
console.print("[#79d45e][+] Successfully updated a password")
connect.commit()
elif column_name == "Description":
sqlQuery = "UPDATE 'Passwords' SET Description = ? WHERE ID = ?"
cursor.execute(sqlQuery, ([column_value, id_no]))
console.print("[#79d45e][+] Successfully updated a password")
connect.commit()
elif column_name == "Folder":
sqlQuery = "UPDATE 'Passwords' SET Folder = ? WHERE ID = ?"
cursor.execute(sqlQuery, ([column_value, id_no]))
console.print("[#79d45e][+] Successfully updated a password")
connect.commit()
else:
console.print("[#FF756D][!] Column does not exist")
connect.commit()
menu.clear()
console.print("[#5bd2f0]──────[#ffaf68] Output [#5bd2f0]───────────────────────────────────────────────────────────────────────────────\n")
display_passwords()
# ----- Delete ----------------------------------------------------------------------------------------------------- #
def delete():
console.print("[#5bd2f0]──────[#ffaf68] Deleting a Password [#5bd2f0]─────────────────────────────────────────────────────────────────────────────\n")
display_passwords()
connect = sqlite3.connect(r"Database/OnePass.db")
cursor = connect.cursor()
multi_delete = console.input("[#ffaf68][?] Do you want to delete multiple accounts? [Y/n]: ")
if multi_delete == "y" or multi_delete == "Y":
id_1 = console.input("[#ffaf68]Enter the first ID of the account range that you want to delete: ")
id_2 = console.input("[#ffaf68]Enter the last ID of the account range that you want to delete: ")
sqlQuery = "DELETE FROM 'Passwords' WHERE ID BETWEEN ? AND ?"
cursor.execute(sqlQuery, [id_1, id_2])
console.print("[#79d45e][+] Successfully deleted multiple accounts from OnePass")
connect.commit()
console.print("[#5bd2f0]──────[#ffaf68] Output [#5bd2f0]───────────────────────────────────────────────────────────────────────────────\n")
display_passwords()
elif multi_delete == "n" or multi_delete == "N":
id_no = console.input("[#ffaf68]Enter the ID of the account that you want to delete: ")
sqlQuery = "DELETE FROM 'Passwords' WHERE ID = ?"
cursor.execute(sqlQuery, [id_no])
console.print("[#79d45e][+] Successfully deleted an account from OnePass")
connect.commit()
console.print("[#5bd2f0]──────[#ffaf68] Output [#5bd2f0]───────────────────────────────────────────────────────────────────────────────\n")
display_passwords()
# ----- Search ----------------------------------------------------------------------------------------------------- #
def search():
console.print("[#5bd2f0]──────[#ffaf68] Searching a Password [#5bd2f0]────────────────────────────────────────────────────────────────────────────\n")
connect = sqlite3.connect(r"Database/OnePass.db")
cursor = connect.cursor()
name = console.input("[#ffaf68]Enter the name of the account that you want to search for: ")
sqlQuery = "SELECT * FROM 'Passwords' WHERE Name = ?"
cursor.execute(sqlQuery, [name])
console.print("[#79d45e][+] Successfully searched an account")
rows = cursor.fetchall()
table = Table(
Column(header="ID", style="#B9EAED", header_style="#7CB5D2"),
Column(header="Name", style="#D9C4EC", header_style="#B19CD8"),
Column(header="Username", style="#B9EAED", header_style="#7CB5D2"),
Column(header="Password", style="#D9C4EC", header_style="#B19CD8"),
Column(header="Email Address", style="#B9EAED", header_style="#7CB5D2"),
Column(header="Phone Number", style="#D9C4EC", header_style="#B19CD8"),
Column(header="URL", style="#B9EAED", header_style="#7CB5D2"),
Column(header="Description", style="#D9C4EC", header_style="#B19CD8"),
Column(header="Folder", style="#B9EAED", header_style="#7CB5D2"),
box=box.ROUNDED,
safe_box=False)
for row in rows:
table.add_row(str(row[0]),str(row[1]),str(row[2]),str(row[3]),str(row[4]),str(row[5]),str(row[6]),str(row[7]))
console.print("[#5bd2f0]──────[#ffaf68] Output [#5bd2f0]───────────────────────────────────────────────────────────────────────────────\n")
console.print(table)
# ----- Generate --------------------------------------------------------------------------------------------------- #
def generate():
try:
console.print("[#5bd2f0]────── [#ffaf68]Password Generator[#5bd2f0] ──────────────────────────────────────────────────────────────────────────\n")
length = int(console.input("[#ffaf68][?] Enter the length of the password: "))
lower = string.ascii_lowercase
upper = string.ascii_uppercase
number = string.digits
symbols = string.punctuation
data = lower + upper + number + symbols
raw = random.sample(data, length)
password = "".join(raw)
print(password)
except ValueError:
console.print("[#FF756D][!] Please enter a numerical value as the length")
generate()
# ----- Settings --------------------------------------------------------------------------------------------------- #
class settings():
def create_master_password():
user_input = console.input("[#ffaf68][?] Set a new master password for OnePass")
keyring.set_password("Master", "OnePass", user_input)
def update_master_password():
console.print("[#5bd2f0]──────[#ffaf68] Updating Master Password [#5bd2f0]─────────────────────────────────────────────────────────────────────────────────\n")
keyring.delete_password("Master", "OnePass")
user_input = console.input("[#ffaf68][?] Set a new master password for OnePass: ")
keyring.set_password("Master", "OnePass", user_input)
console.print("[#79d45e][+] Master password successfully updated")
def delete_master_password():
console.print("[#5bd2f0]──────[#ffaf68] Deleting Master Password [#5bd2f0]─────────────────────────────────────────────────────────────────────────────────\n")
check = console.input("[#FF756D][!] Are you sure that you want to delete your Master Password? [Y/n]: ")
if check == "y" or check == "Y":
valid = console.input("[#ffaf68]Please enter your master password: ")
password = keyring.get_password("Master", "OnePass")
if valid == password:
keyring.delete_password("Master", "OnePass")
console.print("[#79d45e][+] Master password successfully deleted")
else:
console.print("[[#FF756D]!]You've entered the wrong password. Terminating OnePass...")
exit()
else:
console.print("[#ffaf68][~] Going back to the main menu...")
pass
def panic():
console.print("[#5bd2f0]──────[#ffaf68] Panic [#5bd2f0]───────────────────────────────────────────────────────────────────────────────────────────\n")
check = keyring.get_password("Master", "OnePass")
master_password = console.input("[#ffaf68]Enter your master password to delete all accounts in OnePass: ")
if master_password == check:
warn = console.input("[#FF756D][?] Do you want to delete all the accounts in OnePass? (Y/N) ")
if warn == "y" or warn == "Y":
os.remove(r"Database/OnePass.db")
database.create()
tables()
console.print("[#79d45e][+] Successfully deleted all accounts from OnePass")
time.sleep(3)
elif warn == "n" or warn == "N":
console.print("[#FF756D][-] Panic mode aborted")
time.sleep(3)
menu.main()
else:
pass
else:
console.print("[#FF756D][!] Incorrect master password. Terminating OnePass...")
exit()
# ----- Banner Function -------------------------------------------------------------------------------------------- #
class banner():
def ascii():
console.print(rf"""[bold yellow]
┌──────────────────────────────────────────────────────────────────────────┐
│ │
│ .d88888b. 8888888b. │
│ d88P" "Y88b 888 Y88b │
│ 888 888 888 888 │
│ 888 888 88888b. .d88b. 888 d88P 8888b. .d8888b .d8888b │
│ 888 888 888 "88b d8P Y8b 8888888P" "88b 88K 88K │
│ 888 888 888 888 88888888 888 .d888888 "Y8888b. "Y8888b. │
│ Y88b. .d88P 888 888 Y8b. 888 888 888 X88 X88 │
│ "Y88888P" 888 888 "Y8888 888 "Y888888 88888P' 88888P' │
│ │
│ +-+-+ │
│ [#c61a09]Made by Cursed271[bold yellow] │
│ +-+-+ │
│ │
└──────────────────────────────────────────────────────────────────────────┘
""")
# ----- Main Menu -------------------------------------------------------------------------------------------------- #
class menu():
def clear():
time.sleep(1)
if os.name == "nt":
os.system("cls")
else:
os.system("clear")
def main():
banner.ascii()
console.print("[#5bd2f0]────── [#ffaf68]Main Menu [#5bd2f0]────────────────────────────────────────────────────────────────────────────────────────\n")
console.print("[#f6e683]\t1. Add a new account to OnePass")
console.print("[#f6e683]\t2. Generate a strong password")
console.print("[#f6e683]\t3. Search OnePass for an account")
console.print("[#f6e683]\t4. Update accounts")
console.print("[#f6e683]\t5. Delete accounts")
console.print("[#f6e683]\t6. Display accounts")
console.print("[#f6e683]\t7. Settings")
console.print("[#f6e683]\tQ. Quit")
def display():
banner.ascii()
console.print("[#5bd2f0]────── [#ffaf68]Settings [#5bd2f0]────────────────────────────────────────────────────────────────────────────────────────\n")
console.print("[#f6e683]\t1. Display all passwords")
console.print("[#f6e683]\t2. Display all folders")
console.print("[#f6e683]\tQ. Quit")
def settings():
banner.ascii()
console.print("[#5bd2f0]────── [#ffaf68]Settings [#5bd2f0]────────────────────────────────────────────────────────────────────────────────────────\n")
console.print("[#f6e683]\t1. Update master password")
console.print("[#f6e683]\t2. Delete master password")
console.print("[#f6e683]\t3. Activate panic mode")
console.print("[#f6e683]\t4. Go back to the main menu")
console.print("[#f6e683]\tQ. Quit")
# ----- Conditions ------------------------------------------------------------------------------------------------- #
class conditions():
def main():
while True:
user_input = console.input("\n[#5bd2f0]────── [#ffaf68]Choose an Option [#5bd2f0]─────────────────────────────────────────────────────────────────────────────────[#ffaf68]\n>> ")
if user_input == "1":
menu.clear()
banner.ascii()
values()
quit.store()
break
elif user_input == "2":
menu.clear()
banner.ascii()
generate()
quit.generate()
break
elif user_input == "3":
menu.clear()
banner.ascii()
search()
quit.search()
break
elif user_input == "4":
menu.clear()
banner.ascii()
update()
quit.update()
break
elif user_input == "5":
menu.clear()
banner.ascii()
delete()
quit.delete()
break
elif user_input == "6":
menu.clear()
menu.display()
conditions.display()
break
elif user_input == "7":
menu.clear()
menu.settings()
conditions.settings()
break
elif user_input == "Q" or user_input == "q":
console.print("[#FF756D][!] Terminating OnePass")
time.sleep(1)
exit()
break
else:
console.print("[#FF756D][!] Please enter a valid option...")
def display():
while True:
user_input = console.input("\n[#5bd2f0]────── [#ffaf68]Choose an Option [#5bd2f0]─────────────────────────────────────────────────────────────────────────────────[#ffaf68]\n>> ")
if user_input == "1":
menu.clear()
banner.ascii()
display_passwords()
quit.display()
break
elif user_input == "2":
menu.clear()
banner.ascii()
display_folders()
quit.display()
break
elif user_input == "Q" or user_input == "q":
console.print("[#FF756D][!] Terminating OnePass")
time.sleep(1)
exit()
break
else:
console.print("[#FF756D][!] Please enter a valid option...")
def settings():
while True:
user_input = console.input("\n[#5bd2f0]────── [#ffaf68]Choose an Option [#5bd2f0]─────────────────────────────────────────────────────────────────────────────────[#ffaf68]\n>> ")
if user_input == "1":
menu.clear()
banner.ascii()
settings.update_master_password()
quit.settings()
break
elif user_input == "2":
menu.clear()
banner.ascii()
settings.delete_master_password()
quit.settings()
break
elif user_input == "3":
menu.clear()
banner.ascii()
settings.panic()
quit.settings()
break
elif user_input == "Q" or user_input == "q":
console.print("[#FF756D][!] Terminating OnePass")
time.sleep(1)
exit()
break
else:
console.print("[#FF756D][!] Please enter a valid option...")
# ----- Quit Menu -------------------------------------------------------------------------------------------------- #
class quit():
def store():
console.print("[#f6e683]\n1. Add another account")
console.print("[#f6e683]2. Go back to the main menu")
console.print("[#f6e683]Q. Quit")
quit_input = console.input("\n[#5bd2f0]────── [#ffaf68]Choose an Option [#5bd2f0]─────────────────────────────────────────────────────────────────────────────────[#ffaf68]\n>> ")
if quit_input == "1":
menu.clear()
banner.ascii()
values()
elif quit_input == "2":
menu.clear()
banner.ascii()
menu.main()
conditions.main()
elif quit_input == "q" or quit_input == "Q":
console.print("[#FF756D][!] Terminating OnePass")
time.sleep(1)
exit()
else:
pass
def generate():
console.print("[#f6e683]\n1. Generate another password")
console.print("[#f6e683]2. Go back to the main menu")
console.print("[#f6e683]Q. Quit")
quit_input = console.input("\n[#5bd2f0]────── [#ffaf68]Choose an Option [#5bd2f0]─────────────────────────────────────────────────────────────────────────────────[#ffaf68]\n>> ")
if quit_input == "1":
menu.clear()
banner.ascii()
generate()
elif quit_input == "2":
menu.clear()
banner.ascii()
menu.main()
conditions.main()
elif quit_input == "q" or quit_input == "Q":
console.print("[#FF756D][!] Terminating OnePass")
time.sleep(1)
exit()
else:
pass
def search():
console.print("[#f6e683]\n1. Search another account")
console.print("[#f6e683]2. Go back to the main menu")
console.print("[#f6e683]Q. Quit")
quit_input = console.input("\n[#5bd2f0]────── [#ffaf68]Choose an Option [#5bd2f0]─────────────────────────────────────────────────────────────────────────────────[#ffaf68]\n>> ")
if quit_input == "1":
menu.clear()
banner.ascii()
search()
elif quit_input == "2":
menu.clear()
banner.ascii()
menu.main()
conditions.main()
elif quit_input == "q" or quit_input == "Q":
console.print("[#FF756D][!] Terminating OnePass")
time.sleep(1)
exit()
else:
pass
def update():
console.print("[#f6e683]\n1. Update another account")
console.print("[#f6e683]2. Go back to the main menu")
console.print("[#f6e683]Q. Quit")
quit_input = console.input("\n[#5bd2f0]────── [#ffaf68]Choose an Option [#5bd2f0]─────────────────────────────────────────────────────────────────────────────────[#ffaf68]\n>> ")
if quit_input == "1":
menu.clear()
banner.ascii()
update()
elif quit_input == "2":
menu.clear()
banner.ascii()
menu.main()
conditions.main()
elif quit_input == "q" or quit_input == "Q":
console.print("[#FF756D][!] Terminating OnePass")
time.sleep(1)
exit()
else:
pass
def delete():
console.print("[#f6e683]\n1. Delete another account")
console.print("[#f6e683]2. Go back to the main menu")
console.print("[#f6e683]Q. Quit")
quit_input = console.input("\n[#5bd2f0]────── [#ffaf68]Choose an Option [#5bd2f0]─────────────────────────────────────────────────────────────────────────────────[#ffaf68]\n>> ")
if quit_input == "1":
menu.clear()
banner.ascii()
delete()
elif quit_input == "2":
menu.clear()
banner.ascii()
menu.main()
conditions.main()
elif quit_input == "q" or quit_input == "Q":
console.print("[#FF756D][!] Terminating OnePass")
time.sleep(1)
exit()
else:
pass
def display():
console.print("[#f6e683]1. Go back to the main menu")
console.print("[#f6e683]Q. Quit")
quit_input = console.input("\n[#5bd2f0]────── [#ffaf68]Choose an Option [#5bd2f0]─────────────────────────────────────────────────────────────────────────────────[#ffaf68]\n>> ")
if quit_input == "1":
menu.clear()
banner.ascii()
menu.main()
conditions.main()
elif quit_input == "q" or quit_input == "Q":
console.print("[#FF756D][!] Terminating OnePass")
time.sleep(1)
exit()
else:
pass
def settings():
console.print("[#f6e683]\n1. Go back to the settings menu")
console.print("[#f6e683]2. Go back to the main menu")
console.print("[#f6e683]Q. Quit")
quit_input = console.input("\n[#5bd2f0]────── [#ffaf68]Choose an Option [#5bd2f0]─────────────────────────────────────────────────────────────────────────────────[#ffaf68]\n>> ")
if quit_input == "1":
menu.clear()
banner.ascii()
menu.settings()
conditions.settings()
elif quit_input == "2":
menu.clear()
banner.ascii()
menu.main()
conditions.main()
elif quit_input == "q" or quit_input == "Q":
console.print("[#FF756D][!] Terminating OnePass")
time.sleep(1)
exit()
else:
pass
# ----- Main Function ---------------------------------------------------------------------------------------------- #
if __name__ == '__main__':
menu.clear()
check = keyring.get_password("Master", "OnePass")
if check == None:
newpassword = pwinput.pwinput("Enter the new Master Password for OnePass: ")
keyring.set_password("Master", "OnePass", newpassword)
database.create()
while True:
menu.clear()
tables()
menu.main()
conditions.main()
else:
master_password = pwinput.pwinput("Enter your Master Password to enter OnePass: ")
if master_password == check:
database.create()
while True:
menu.clear()
tables()
menu.main()
conditions.main()
else:
console.print("[#FF756D][!] Incorrect Master Password")
exit()
# ----- End -------------------------------------------------------------------------------------------------------- #