Skip to content

Instantly share code, notes, and snippets.

@HugoPoi
Last active September 8, 2018 14:43
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HugoPoi/4694a99f5a9d9b2c558557bbdd113f54 to your computer and use it in GitHub Desktop.
Save HugoPoi/4694a99f5a9d9b2c558557bbdd113f54 to your computer and use it in GitHub Desktop.
Generate /etc/whois.conf file for gnu whois command
/*
* Usage : node generateWhoisConf.js > /etc/whois.conf
*/
var json = require('comment-json');
var request = require('request');
request('https://github.com/weppos/whois/raw/master/data/tld.json', function(error, response, body){
var obj = json.parse(body);
Object.keys(obj).forEach(function(key){
if(obj[key].host){
console.log(key.replace(/\./g,'\\.') + '$ ' + obj[key].host);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment