-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
76 lines (68 loc) · 3.14 KB
/
Copy pathmain.cpp
File metadata and controls
76 lines (68 loc) · 3.14 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
#include <iostream>
#include <string>
#include <limits>
#include <iomanip>
#include <ctime>
#include "core/auth.h"
#include "utils/config.h"
std::string getCurrentTime() {
auto now = std::time(nullptr);
auto t = std::localtime(&now);
char buffer[50];
std::strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", t);
return std::string(buffer);
}
int main() {
std::cout << "\n";
std::cout << "+==================================================+\n";
std::cout << "| CRYPTVAULT v3.1 PRO |\n";
std::cout << "| " << getCurrentTime() << " |\n";
std::cout << "+==================================================+\n\n";
std::cout << "QUICK START GUIDE:\n";
std::cout << "1. 1st RUN: Set your own Master Password\n";
std::cout << "2. REAL VAULT: Correct Password + 1st Attempt\n";
std::cout << "3. DECOY VAULT: Wrong Password\n";
std::cout << "4. DECRYPT: Option 6 (REAL vault + Admin Password)\n";
std::cout << "5. 3 Wrong Attempts = SELF-DESTRUCT\n\n";
Config config("data/config.txt");
Auth auth(config);
auth.initialSetup();
auth.authenticate();
while (true) {
std::cout << "\n+==================================================+\n";
std::cout << "| VAULT MENU |\n";
std::cout << "| " << getCurrentTime() << " |\n";
std::cout << "+==================================================+\n";
std::cout << "| [1] View All Entries |\n";
std::cout << "| [2] Add New Entry |\n";
std::cout << "| [3] Search Entry |\n";
std::cout << "| [4] Edit Entry |\n";
std::cout << "| [5] Password Strength Checker |\n";
std::cout << "| [6] Reveal Password (Admin Only) |\n";
std::cout << "| [7] Logout/Re-authenticate |\n";
std::cout << "| [0] Exit |\n";
std::cout << "+==================================================+\n";
std::cout << "Enter choice (0-7): ";
int choice;
std::cin >> choice;
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
switch (choice) {
case 1: auth.viewCurrentVault(); break;
case 2: auth.addToCurrentVault(); break;
case 3: auth.searchEntry(); break;
case 4: auth.editCurrentVault(); break;
case 5: auth.checkPasswordStrength(); break;
case 6: auth.revealPasswordInVault(); break;
case 7: auth.logoutReauthenticate(); break;
case 0:
std::cout << "\nVault locked. Stay safe! Goodbye.\n";
return 0;
default:
std::cout << "\nInvalid choice! Please select 0-7\n";
break;
}
std::cout << "\nPress ENTER to continue...";
std::cin.get();
}
return 0;
}