-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
26 lines (21 loc) · 697 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
#!/usr/bin/env node
var bruteForce = require('node-bruteforce')
var expand = require('expand-range')
var hasher = require('./hasher')
var hash = process.argv[2]
var ranges = process.argv.slice(3)
// pieces
ranges = ranges.map(function(range) {
return (range.indexOf('..') === -1) ? range.split('') : expand(range)
})
// flatten
ranges = [].concat.apply([], ranges || [expand('a..z'), expand('A..Z'), expand('0..9')])
console.log('Using chars:', ranges.join(' '))
hash = hash.toLocaleLowerCase().replace('*','')
bruteForce(ranges, function(value){
if(hash == hasher(value)) {
console.log('[ Yay!!! ] ', hash + ' = ' + value)
return true;
}
return false;
});