-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.py
More file actions
72 lines (57 loc) · 1.82 KB
/
utils.py
File metadata and controls
72 lines (57 loc) · 1.82 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
#!/usr/bin/python3
# -*- coding:utf-8 -*-
__author__ = "efpyc"
import os
import rich
from rich.prompt import Prompt
from datetime import datetime
sep = os.path.sep
default_paths = {
"settings": f".{sep}data{sep}settings.SQL",
"vault": f".{sep}data{sep}vault.SQL",
}
def checkDataFolder():
if not os.path.exists("data/"):
os.mkdir("data")
def getCreatedAt():
return datetime.now().isoformat(timespec="seconds")
def menuList(texts : list):
temp = 1
last = texts[-1]
texts.pop(-1)
for text in texts:
rich.print(f"[bold][cyan][[/cyan]{temp}[cyan]][/cyan] {text}[/bold]")
temp += 1
rich.print(f"[bold][cyan][[/cyan]0[cyan]][/cyan] {last}[/bold]")
def clear():
if os.name == "nt":
os.system("cls")
else:
os.system("clear")
def prohibited(text):
rich.print(f":NO_ENTRY_SIGN: [bold]{text}[/bold]")
def getPassword(text):
answer = Prompt().ask(f"👉 [bold]{text}[/bold]",password=True)
return answer
def question(text):
answer = Prompt().ask(f"👉 [bold]{text}[/bold]")
return answer
def success(text):
rich.print(f":WHITE_HEAVY_CHECK_MARK: [bold]{text}[/bold]")
def failure(text):
rich.print(f":CROSS_MARK: [bold]{text}[/bold]")
def info(text):
rich.print(f"ℹ️ [bold]{text}[/bold]")
def warning(text):
rich.print(f":warning: [bold]{text}[/bold]")
def banner():
text = """[bold]
╔══════════════════════════════════╗
║ 🔐 Welcome to ║
║ 4VAULT ║
╚══════════════════════════════════╝[/bold]
"""
rich.print(text)
info("Secure CLI-based password vault.")
info("Your data is encrypted using AES-256-GCM.")
print("")