-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.js
132 lines (117 loc) · 5.14 KB
/
index.js
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
const KeyAuth = require('./KeyAuth');
const readline = require("readline");
const moment = require("moment");
const CRL = readline.createInterface({ input: process.stdin, output: process.stdout });
const KeyAuthApp = new KeyAuth(
"", // Application Name
"", // OwnerID
"", // Application Secret
"1.0" // Application Version
);
(async () => {
await KeyAuthApp.Initialize();
console.log("\n Application Data:");
console.log(` Number of users: ${KeyAuthApp.app_data.numUsers}`);
console.log(` Number of online users: ${KeyAuthApp.app_data.numOnlineUsers}`);
console.log(` Number of keys: ${KeyAuthApp.app_data.numKeys}`);
console.log(` Application Version: ${KeyAuthApp.app_data.version}`);
console.log(` Customer panel link: ${KeyAuthApp.app_data.customerPanelLink}\n`);
var username, password, license, email = "";
await CRL.question("\n [1] Login\n [2] Register\n [3] Upgrade\n [4] License key only\n [5] Forgot password\n\n Choose option: ", async (option) => {
option = await parseInt(option);
switch (option) {
case 1:
await CRL.question("\n Whats your Username: ", async (user) => {
username = user;
await CRL.question(" Whats your Password: ", async (pass) => {
password = pass;
await KeyAuthApp.login(username, password);
Dashboard();
CRL.close();
});
});
break;
case 2:
await CRL.question("\n Whats your Username: ", async (user) => {
username = user;
await CRL.question(" Whats your Password: ", async (pass) => {
password = pass;
await CRL.question(" Whats your License: ", async (lic) => {
license = lic;
await CRL.question(" Whats your Email: ", async (email_) => {
email = email_;
await KeyAuthApp.register(username, password, license, email);
Dashboard();
CRL.close();
});
});
});
});
break;
case 3:
await CRL.question("\n Whats your Username: ", async (user) => {
username = user;
await CRL.question(" Whats your License: ", async (key) => {
license = key;
await KeyAuthApp.upgrade(username, license);
console.log("You have Successfully upgraded your account!");
process.exit(0);
});
});
break;
case 4:
await CRL.question("\n Whats your License: ", async (lic) => {
license = lic;
await KeyAuthApp.license(license);
Dashboard();
CRL.close();
}
);
break;
case 5:
await CRL.question("\n Whats your Username: ", async (user) => {
username = user;
await CRL.question(" Whats your Email: ", async (email_) => {
email = email_;
await KeyAuthApp.forgot(username, email);
console.log(KeyAuthApp.response.message);
process.exit(0);
});
});
break;
default:
console.log("Invalid option");
CRL.close();
break;
}
});
async function Dashboard() {
console.log("\n Logged In!");
//User Data
console.log(` Username: ${KeyAuthApp.user_data.username}`);
console.log(` IP address: ${KeyAuthApp.user_data.ip}`);
console.log(` Hardware-Id: ${KeyAuthApp.user_data.hwid}`);
console.log(
` Created at: ${moment
.unix(KeyAuthApp.user_data.createdate)
.format("DD-MM-YYYY - HH:mm:ss")}`
);
console.log(
` Last Login: ${moment
.unix(KeyAuthApp.user_data.lastlogin)
.format("DD-MM-YYYY - HH:mm:ss")}`
);
for (var i = 0; i < KeyAuthApp.user_data.subscriptions.length; i++) {
console.log(
` [${i}] Subscription name: ${KeyAuthApp.user_data.subscriptions[i].subscription
} | Expires at: ${moment
.unix(KeyAuthApp.user_data.subscriptions[i].expiry)
.format("DD-MM-YYYY - HH:mm:ss")} | Time left in seconds ${KeyAuthApp.user_data.subscriptions[i].timeleft
}`
);
}
console.log("\n\n Closing in 5 seconds...");
await KeyAuthApp.sleep(5000);
process.exit(0);
}
})();