Last active
March 28, 2017 05:41
-
-
Save frozeman/26510d02af674abd4b39 to your computer and use it in GitHub Desktop.
Presale wallet file brute force tools. This is to help people who don't exactly remember their passwords
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const spawn = require('child_process').spawn; | |
var bruteForce = function(path, pw, callback) { | |
var error = false; | |
// start import process | |
var nodeProcess = spawn(nodeBinary, ['wallet', 'import', path]); | |
nodeProcess.once('error',function(){ | |
error = true; | |
callback('Couldn\'t start the "geth wallet import <file.json>" process.'); | |
}); | |
nodeProcess.stdout.on('data', function(data) { | |
var data = data.toString(); | |
if(data.indexOf('Decryption failed:') !== -1 || data.indexOf('not equal to expected addr') !== -1) { | |
callback(data); | |
// if imported, return the address | |
} else if(data.indexOf('Address:') !== -1) { | |
var find = data.match(/\{([a-f0-9]+)\}/i); | |
if(find.length && find[1]) | |
callback(null, '0x'+ find[1]); | |
else | |
callback(data); | |
// if not stop, so we don't kill the process | |
} else { | |
return; | |
} | |
nodeProcess.stdout.removeAllListeners('data'); | |
nodeProcess.removeAllListeners('error'); | |
nodeProcess.kill('SIGINT'); | |
}); | |
// file password | |
setTimeout(function(){ | |
if(!error && nodeProcess.stdin.writable) { | |
nodeProcess.stdin.write(pw +"\n"); | |
pw = null; | |
} | |
}, 500); | |
}; | |
count = 0; | |
var id = setInterval(function(){ | |
var pw = passwords[count++]; | |
console.log('Password:', pw); | |
bruteForce(path, pw, function(e, result){ | |
if(e) { | |
console.log('ERROR:', e); | |
} else { | |
console.log('FOUND!:', result, ' Password: "'+ pw +'"'); | |
clearInterval(id); | |
} | |
}); | |
if(count === passwords.length) | |
clearInterval(id); | |
}, 1000); | |
// ---------------------------------------------------------------------------------- | |
var nodeBinary = 'geth'; | |
var path = './ethereum-wallet-xxxxxxxxxxxxxxxxxxxxxx.json'; | |
var passwords = [ | |
'AddPasswords', | |
'Here', | |
'WhichYouThinkMightBeIt' | |
]; | |
// add lower and uppercase versions | |
passwords.forEach(function(pw){ | |
passwords.push(pw.toLowerCase()); | |
passwords.push(pw.toUpperCase()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change the last variables:
And run using
node bruteforce-presale.js
.NOTE, you need to have geth installed