-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfindrightword.js
48 lines (42 loc) · 1.27 KB
/
findrightword.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
var hdkey = require("ethereumjs-wallet/hdkey");
var bip39 = require("bip39");
const fs = require("fs");
const Web3 = require("web3");
const web3 = new Web3(
new Web3.providers.HttpProvider("https://bsc-dataseed1.binance.org:443")
);
const args = process.argv.slice(2);
let fileName = args[0];
console.log("checking", fileName);
var path = "m/44'/60'/0'/0/0";
var counter = 0;
var addressToCheck = "".toLowerCase();
fs.readFile(fileName, "utf8", function (err, content) {
let mnemonic = content.split("\n");
mnemonic.forEach((m) => {
bip39.mnemonicToSeed(m).then(function (seed) {
var hdwallet = hdkey.fromMasterSeed(seed);
var wallet = hdwallet.derivePath(path).getWallet();
var address = "0x" + wallet.getAddress().toString("hex");
if (address == addressToCheck) {
console.log("BINGO", m);
}
if (addressToCheck.length === 0) {
asyncCall(address);
}
});
});
fs.rename(fileName, "Checked" + fileName, function (err) {
if (err) throw err;
console.log("Successfully renamed");
});
});
async function asyncCall(address) {
let result = await web3.eth.getBalance(address);
console.log(result);
if (result > 0) {
console.log(
web3.utils.fromWei(result, "BNB") + " BNB on address " + address
);
}
}