-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
74 lines (52 loc) · 1.67 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
// Mandatory libraries
var chash = require('js-sha256');
var QRCode = require('qrcode')
let input = {
seedBrute: "123456"
}
motd()
function createSeed(roundedDate) {
// Concatenate the brute seed string and the rounded UTC Date, and gen a SHA256 Hash
let result = chash(input.seedBrute + roundedDate)
return result
}
function getFullDate(){
let fullDate = new Date()
return fullDate
}
function motd(){
console.log(` 🔐 Welcome to TFA.JS`)
console.log(` 💻 Developed by github.com/mavinsi`)
console.log("")
console.log(` 🗝️ Your Seed: ${input.seedBrute}`)
console.log(` ⏰ Actual Date: ${getFullDate()}`)
}
function getRoundedTime() {
// Create and return the current date but rounded
let fullDate = new getFullDate()
let roundedDate = new Date()
if (fullDate.getSeconds() < 30) {
roundedDate.setSeconds(0)
} else {
roundedDate.setSeconds(30)
}
return roundedDate
}
function authCode(input) {
let cleanHash = input.replace(/\D/g, '')
console.log("")
return cleanHash.substring(0, 6)
}
setTimeout(function(){
let myVar = setInterval(function () { timer() }, 1000);
function timer() {
console.clear()
let finalTFA = authCode(createSeed(getRoundedTime()))
console.log(` ⌚ Changing in ${30 - (getFullDate().getSeconds() - getRoundedTime().getSeconds())} seconds!`)
console.log(` 🔑 TFA Code: ${finalTFA.slice(0,3)}-${finalTFA.slice(3)}`)
console.log("")
QRCode.toString(finalTFA, { type: 'terminal' }, function (err, url) {
console.log(url)
})
}
}, 5000);