-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerator.js
81 lines (60 loc) · 2.16 KB
/
generator.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
75
76
77
78
79
80
const readline = require('readline');
const CoinKey = require('coinkey');
const fs = require('fs');
const rl = readline.createInterface(process.stdin, process.stdout);
process.title = "Bitcoin Sniffer";
function main() {
rl.question('Show failed wallets? Y/N (Slower) \n', (answer) => {
if (answer == "Y" || answer == "y") {
console.log("\x1b[32m%s\x1b[0m", ">> Generating...");
while(true){
generateAddress(true);
}
}
else if (answer == "N" || answer == "n") {
console.log("\x1b[32m%s\x1b[0m", ">> Generating...");
while(true){
generateAddress(false);
}
}
else{
console.log("Invalid input");
main();
}
})
}
const data = fs.readFileSync('./fundedAddresses.txt');
function generateAddress(showFailed) {
let pkHex = r(64);
let ck = new CoinKey(Buffer.from(pkHex, 'hex'));
ck.compressed = false;
if(data.includes(ck.publicAddress)){
;
console.log("\x1b[32m%s\x1b[0m", ">> Success: " + ck.publicAddress);
var successAddressStr = "Wallet Address: " + ck.publicAddress + "\nPrivate Key: " + ck.privateWif;
// save the wallet and its private key (seed) to a Success.txt file in the same folder
fs.writeFileSync('./successfullAddresses.txt', successAddressStr, (err) => {
if (err){
console.log(err);
console.log(`\n\n\nAn error occured while saving the file.\nThe Wallet details are below. \n\n\n${successAddressStr}`)
};
})
// close program after success
process.exit();
}
else{
if(showFailed) {
console.log("\x1b[31m%s\x1b[0m", ">> Failed: " + ck.publicAddress);
}
}
}
// the function to generate random hex string
function r(l) {
let randomChars = 'ABCDF0123456789';
let result = '';
for ( var i = 0; i < l; i++ ) {
result += randomChars.charAt(Math.floor(Math.random() * randomChars.length));
}
return result;
}
main()