Skip to content

Instantly share code, notes, and snippets.

@sebmck
Created March 26, 2012 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sebmck/2203943 to your computer and use it in GitHub Desktop.
Save sebmck/2203943 to your computer and use it in GitHub Desktop.
Harbour.prototype.parseTargets = function(){
var longestIP, longestHost;
var newTargets = [];
var oldTargets = this.options.targets.split(',');
oldTargets.forEach(function(target){
if(net.isIP(target)){
dns.reverse(target, function(err, domains){
newTargets.push([(domains ? domains[0] : ''), target]);
});
} else {
dns.resolve(target, function(err, ips){
if(ips){
ips.forEach(function(ip){
newTargets.push([target, ip]);
});
}
});
}
});
puts(newTargets);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment