-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbundle.html
132 lines (114 loc) · 4.6 KB
/
bundle.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Recover Tronscan password</title>
<link rel="stylesheet" href="style.css">
<script src="./bundle.js"></script>
</head>
<body>
<script>
//zxcvbn (quality password evaluator)
function getNewInsertion(value){
const evaluation = zxcvbn(value);
document.getElementById("score").innerHTML ="<img src=\"./img/" + evaluation.score + ".png\" />";
//const score = evaluation.score;
//const suggestions = evaluation.feedback;
}
function evalEqual(value){
var p1 = document.getElementById("password1").value;
if(p1===value){
document.getElementById("equal").innerHTML ="<img src='./img/ok.png' width=\"10px\" />";
}else{
document.getElementById("equal").innerHTML ="Passwords are not equal";
}
}
function downloadStringAsFile(contents, filename, mimetype = 'text/plain') {
let a = window.document.createElement('a');
a.href = window.URL.createObjectURL(new Blob([contents], {type: mimetype}));
a.download = filename;
// Append anchor to body.
document.body.appendChild(a);
a.click();
// Remove anchor from body
document.body.removeChild(a);
}
function generateTronscanTxt(){
/* var address = "TEvhscC2eEv2gvENtLgmofGoLe3zZRjKib";
var privateKey = "83D4174854CE2A35226DAE32A83B69C6A08E2F54B802957A362DB060F366BAAD";
var fieldPassword = "$afeP@ssword1234"; */
var address = document.getElementById("address").value;
var privateKey = document.getElementById("pk").value;
var fieldPassword = document.getElementById("password1").value;
var salt = window.uuidv4();
var encryptedKey = encryptKey(fieldPassword, salt);
let {hex, bytes} = encryptString(encryptedKey, privateKey);
var ddd = { encryptedKey, hex, bytes};
var aux = {
version: 1,
key: ddd.hex,
address: address,
salt,
};
var bitArr = byteArray2hexStr(stringToBytes(JSON.stringify(aux)));
//console.log("salt " + salt);
//console.log("hex " + hex);
//console.log("bytes " + bytes);
console.log("bitArr " + bitArr);
document.getElementById("result").innerHTML="";
document.getElementById("result").innerHTML=bitArr;
downloadStringAsFile(bitArr, address + ".txt");
}
</script>
<span class="cn_pass" >
<form>
<center><h1>COMMUNITY NODE - TRON SR CANDIDATE</h1></center>
<p><center>Re-generate your Tronscan.org password file</center></p>
</p>
<table border="0">
<tr>
<td>
<p><div style="display:inline">Account address: <input type="text" name="address" id="address" class="text_box"/> </div></p>
<p><div style="display:inline">Private key: <input type="text" name="pk" id="pk" class="text_box"/> </div></p>
<p><div style="display:inline">Password:
<input
type = "password"
name = "password"
id = "password1"
class = "text_box"
onchange = "getNewInsertion(this.value);"
onkeypress = "getNewInsertion(this.value);"
onpaste = "getNewInsertion(this.value);"
oninput = "getNewInsertion(this.value);" /> <div class="example" id="score"></div>
</div></p>
<p><div style="display:inline">Re-type password:
<input
type = "password"
name = "password2"
id = "password2"
class = "text_box"
onchange = "evalEqual(this.value);"
onkeypress = "evalEqual(this.value);"
onpaste = "evalEqual(this.value);"
oninput = "evalEqual(this.value);" /> <div class="example" id="equal"></div>
</div></p>
<input type="button" id="a" onclick="generateTronscanTxt()" value="Generate and save tronscan file" /><p/>
</form>
</span>
</td>
<td valign="top">
<img src='./img/instructions.jpg' width="400" />
</td>
</tr>
</table>
<textarea id="result" class="text_area" ></textarea>
</br>
</br>
</br>
</br>
<span class="cn_info"><br><center>
This service is brought to you by Community Node. We need your votes to keep protecting the Tron ecosystem.<br /> Source code available here: <a href="https://github.com/bondibox/keystore-regenerate">https://github.com/bondibox/keystore-regenerate</a>
</center>
</span>
</body>
</html>