-
Notifications
You must be signed in to change notification settings - Fork 19
/
index.js
33 lines (31 loc) · 989 Bytes
/
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
var Web3 = require("web3");
var web3 = new Web3();
require("yargs")
.scriptName("ethereum-wallet-decrypter")
.usage("$0 <cmd> <args>")
.command("decrypt <publickey>", "find private key to public key", (yargs) => {
yargs.positional("publickey", {
type: "string",
describe: "the public key to decrypt"
})
yargs.positional("entropy", {
type: "number",
describe: "value to increase unpredictability",
default: 32
})
}, function (argv) {
console.log("Starting private key discovery of public key " + argv.publickey);
var antiSolved = true;
var i = 0;
while (antiSolved) {
var account = web3.eth.accounts.create(web3.utils.randomHex(argv.entropy));
i = i+1;
if (account.address == argv.publickey) {
console.log("Private key: " + account.privateKey);
console.log("Completed after " + i + " iterations.");
break;
}
}
})
.help()
.argv