Nslookup or dig in Google App Script -


is there way run nslookup / dig in google app script? m looking results of command in google spreadsheet.

thanks

find web service let use or post anonymously query dns info using restful api, , you'll able use urlfetchapp.fetch() access it.

for example, statdns has simple api. here's custom function resolve domain name ipv4 address.

screenshot

code

/**  * peform network service lookup, using statdns api.  *  * @param {"google.com"} dn    well-formed domain name resolve.  * @return {string}            resolved ip address  * @customfunction  */ function nslookup(dn) {   var url = "http://api.statdns.com/%fqdn%/a".replace("%fqdn%",dn);   var result = urlfetchapp.fetch(url,{mutehttpexceptions:true});   var rc = result.getresponsecode();   var response = json.parse(result.getcontenttext());   if (rc !== 200) {     throw new error( response.message );   }   var ip = response.answer[0].rdata;   return ip; } 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -