Last active
July 26, 2018 13:06
-
-
Save hubgit/8b1fcf335e7edd23b05b1a3c21b65075 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 dns = require('dns') | |
const tlds = require('tlds') | |
dns.setServers([ | |
'80.82.77.83', | |
//'8.8.8.8', | |
]) | |
const getAddresses = tld => new Promise((resolve, reject) => { | |
const domain = 'sci-hub.' + tld | |
dns.resolve(domain, (err, addresses) => { | |
if (err) { | |
reject(err) | |
} else { | |
console.log(domain, addresses) | |
resolve(domain) | |
} | |
}) | |
}) | |
const promises = tlds.map(getAddresses) | |
Promise.all(promises.map(p => p.catch(() => undefined))).then(results => { | |
console.log(results.filter(i => i)) | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment