-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
70 lines (52 loc) · 1.5 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
const { Worker } = require('worker_threads')
const { default: Neon, api, wallet, tx, rpc } = require("@cityofzion/neon-js");
//const passwordChars = ["a", "b", "c", "d", "e", "f", "g", "h"];
const passwordChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789?!@".split('');
const workerThreads = [];
const encryptedPrivateKey = process.argv[2];
const currentPassword = [passwordChars[0]];
const main = async() =>{
for(var i = 0; i < 10; i++)
{
const worker = new Worker('./worker.js', { workerData:{encryptedPrivateKey} });
worker.on('message', message => processMessage(worker, message));
worker.on('error', error => {});
worker.on('exit', code => {});
workerThreads.push(worker);
}
}
const processMessage = (worker, message) =>{
if (message.op == "nextPassword")
{
for(var i = 0; i < currentPassword.length; i++)
{
var index = passwordChars.indexOf(currentPassword[i]);
if (index + 1 < passwordChars.length)
{
currentPassword[i] = passwordChars[index + 1];
break;
}
else
{
currentPassword[i] = passwordChars[0];
if (i + 1 >= currentPassword.length)
{
currentPassword.push(passwordChars[0]);
break;
}
}
}
var currentPasswordStr = currentPassword.join('')
worker.postMessage({
op:"nextPassword",
password: currentPasswordStr
});
console.log("Trying password - " + currentPasswordStr);
}
if (message.op == "foundPassword")
{
console.log("Password found - " + message.password);
process.exit(0);
}
}
main();