76 lines
2.4 KiB
JavaScript
76 lines
2.4 KiB
JavaScript
let Web3 = require("web3");
|
|
let ethNetwork = 'https://cloudflare-eth.com';
|
|
let ethscan = require('@mycrypto/eth-scan');
|
|
let web3 = new Web3(new Web3.providers.HttpProvider(ethNetwork));
|
|
let fs = require('fs');
|
|
let nodemailer = require("nodemailer");
|
|
|
|
let transporter = nodemailer.createTransport({
|
|
service: 'gmail',
|
|
auth: {
|
|
user: process.env.EMAIL_USER,
|
|
pass: process.env.EMAIL_PASS
|
|
}
|
|
});
|
|
|
|
function makeMoney(count = 0){
|
|
console.log('\033[2J');
|
|
console.log("Addresses checked: " + count)
|
|
|
|
// let accounts = [{address: '0x8735015837bD10e05d9cf5EA43A2486Bf4Be156F', privateKey: 'fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364150'}]
|
|
|
|
let accounts = []
|
|
let x = 0
|
|
while(x < 100) {
|
|
accounts.push(web3.eth.accounts.create())
|
|
count++
|
|
x++
|
|
}
|
|
|
|
search(accounts, count)
|
|
}
|
|
|
|
function search(accounts, count) {
|
|
let addresses = accounts.map((account) => { return account.address })
|
|
ethscan.getEtherBalances(web3, addresses).then(balanceMap => {
|
|
for (const [key, value] of Object.entries(balanceMap)) {
|
|
if(BigInt(value) > 0) {
|
|
message = key + ": " + accounts[addresses.indexOf(key)].privateKey + "\n"
|
|
writeToFile('/output/output.txt', message)
|
|
transporter.sendMail({
|
|
from: '"Random Ethereum Scanner" <foo@example.com>',
|
|
to: process.env.EMAIL_TO, // Test email address
|
|
subject: "$$$ We Found Ethereum!",
|
|
text: message,
|
|
}).catch(emailError)
|
|
}
|
|
}
|
|
makeMoney(count)
|
|
}).catch(emailError)
|
|
}
|
|
|
|
function emailError(err){
|
|
transporter.sendMail({
|
|
from: '"Random Ethereum Scanner" <foo@example.com>',
|
|
to: process.env.EMAIL_TO, // Test email address
|
|
subject: "Error detected",
|
|
text: err.toString(),
|
|
}).catch((err)=>{writeToFile('/output/err.txt', err.toString())})
|
|
}
|
|
|
|
function writeToFile(filename, message) {
|
|
fs.appendFile(filename, message, err => {
|
|
if (err) {
|
|
console.log(err)
|
|
}
|
|
});
|
|
}
|
|
|
|
transporter.sendMail({
|
|
from: '"Random Ethereum Scanner" <foo@example.com>',
|
|
to: process.env.EMAIL_TO, // Test email address
|
|
subject: "Scanner Started",
|
|
text: "Random Ethereum Scanner Started Successfully",
|
|
}).catch((err)=>{writeToFile('/output/err.txt', err.toString())})
|
|
|
|
makeMoney() |