dns lookup - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: dns lookup (/showthread.php?tid=3626) |
dns lookup - toujour - 18.10.2021 Hi, what is the function to resolve the dns name of a site (similar to nslookup) ? I 'm looking for a script to obtain the IP address from a name server. BR, Alberto RE: dns lookup - admin - 18.10.2021 Use this: Code: function resolve(domain) RE: dns lookup - toujour - 20.10.2021 Thanks...TOP RE: dns lookup - myg - 20.02.2023 Hi, I've tried suggested code but it returns only single IP for a domain. Is there a way to get all resolved IPs for a given name? also how resource intensive for LM is to resolve dozens (double digit number) names in a script? or it's best to offload this task to another platform? RE: dns lookup - admin - 20.02.2023 There's no way of getting all IP addresses for a given host. Why do you need to get all? If some kind of load balancing is used then the list is not static and can change over time. DNS requests are very lightweight and should not cause high load. You can put a small delay between them so there are no CPU load spikes. RE: dns lookup - myg - 22.02.2023 (20.02.2023, 11:03)admin Wrote: There's no way of getting all IP addresses for a given host. Why do you need to get all? If some kind of load balancing is used then the list is not static and can change over time. I'm building a bot to manage dns-based ip routes on the router (vpn tunnel), for this reason i need all returned IPs by a single DNS query (like if you do nslookup). I understand there're some sites that are using dns round robin with 10+ addresses, but most of them are using 2-3 static and i want to make sure i add all of them to the routing policy. RE: dns lookup - admin - 22.02.2023 You can run nslookup via os.execute(). RE: dns lookup - myg - 22.02.2023 (22.02.2023, 14:15)admin Wrote: You can run nslookup via os.execute(). but that's gonna be more expensive for tens of lookups than network lookups, right? RE: dns lookup - admin - 22.02.2023 Yes but I doubt that you need to execute them all the time. RE: dns lookup - myg - 22.02.2023 (22.02.2023, 14:18)admin Wrote: Yes but I doubt that you need to execute them all the time. if i have a collection of 30 domain names that should be tunneled, i need to refresh them from time to time, for that i need to do 30 lookups one after another in a single run. Ok thanks for the info, i think i've got an idea Here's the code i'm using and after that i need to parse response Code: handle = io.popen('nslookup domainname.com') |