是否有一个python模块与nslookup做同样的事情?我打算使用nslookup挖掘有关要废弃的URL域的一些信息.我知道我可以使用os.sys来调用nslookup,但我只是想知道是否已经有了这个python模块.提前致谢!
我的环境中有很多没有正确清点的计算机.基本上,没有人知道哪个IP与哪个mac地址和哪个主机名相关.所以我写了以下内容:
# This script goes down the entire IP range and attempts to
# retrieve the Hostname and mac address and outputs them
# into a file. Yay!
require "socket"
TwoOctets = "10.26"
def computer_exists?(computerip)
system("ping -c 1 -W 1 #{computerip}")
end
def append_to_file(line)
file = File.open("output.txt", "a")
file.puts(line)
file.close
end
def getInfo(current_ip)
begin
if computer_exists?(current_ip)
arp_output = `arp -v #{current_ip}`
mac_addr = arp_output.to_s.match(/..:..:..:..:..:../)
host_name = Socket.gethostbyname(current_ip)
append_to_file("#{host_name[0]} - #{current_ip} - #{mac_addr}\n")
end
rescue SocketError => mySocketError
append_to_file("unknown - #{current_ip} …Run Code Online (Sandbox Code Playgroud) 对于nslookup命令,它有nslookup somewhere.com some.dns.server.
但是,似乎golang dnsclient只加载配置 /etc/resolv.conf
代码在这里:https://golang.org/src/net/dnsclient_unix.go#L225
golang标准库是否提供类似的功能
func LookupTXT(name string, dnsServer string) (txt []string, err error)?
requirement:1.不要更改默认值/etc/resolv.conf.
如何使用PHP将主机名解析为IP地址,但使用不同的名称服务器(例如OpenDNS或Google Public DNS).
它似乎不能dns_get_record()或gethostbyname()不能使用与当前在系统上设置的名称服务器不同的名称服务器(在TCP/IP设置或中/etc/resolv.conf).
我发现的唯一方法是使用PEAR类Net/DNS,但它在PHP 5.4下给了我很多警告
以下是重现步骤:
minikube start
kubectl run nginx --image=nginx
kubectl expose deployment nginx --port=80 --type=ClusterIP
kubectl run -i --tty --rm alpine --image=alpine --restart=Never -- sh
apk add --no-cache bind-tools
Run Code Online (Sandbox Code Playgroud)
现在让我们尝试查询 kibe-dns 的nginx服务
和nslookup:
/ # nslookup nginx.default 10.96.0.10
Server: 10.96.0.10
Address: 10.96.0.10#53
Name: nginx.default.svc.cluster.local
Address: 10.97.239.175
Run Code Online (Sandbox Code Playgroud)
与dig:
dig nginx.default @10.96.0.10 any
; <<>> DiG 9.11.3 <<>> nginx.default @10.96.0.10 any
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46414
;; flags: …Run Code Online (Sandbox Code Playgroud) 如何执行反向DNS查找,即如何在Perl中将IP地址解析为其DNS主机名?
我的C#服务需要定期轮询nslookup host server.目前它产生了一个Process执行批处理脚本的程序.由于性能原因,我正在考虑使用一些进行此检查API.但问题是,使用,例如,System.Net.Dns.GetHostAddresses我只能模拟nslookup host检查,但不能nslookup host server(没有秒参数).
我看过一堆类似的SO问题,但似乎都没有解决我的问题.
有没有办法nslookup host server在C#没有使用一些沉重的第三方库的情况下执行?
我正在编写一些代码来确定网络域是否已注册.例如,我想检查"Google123.com"是否可用.至少有两种方法可以通过编程方式执行此操作,但我不确定哪种方法更有效:
我的问题是:
我使用intel I219-v适配器(集成到主板)中使用新的Windows 10 Pro构建时遇到了一个非常奇怪的问题.每次DNS查找发生时,无论是在浏览器中还是通过命令提示符手动触发,第一个请求都会超时,然后下一个请求会正确解析.我只有两个google服务器(8.8.8.8和8.8.4.4)在适配器设置中配置为dns服务器并在路由器上配置(尝试手动和自动发现).从我所看到的wirehark捕获看起来正常.我整天都在扯掉头发,因为它完全破坏了电脑上的浏览体验.
以下是一些说明问题的屏幕截图:
wireshark:http:// i.stack.imgur.com/ETpTa.png
我在ubuntu上,我正在运行一个docker默认网桥.我有容器化版本的zookeeper,kafka,以及我写的一个与kafka对话的应用程序.
我做了一个:
docker exec -it <my-app id> /bin/bash
Run Code Online (Sandbox Code Playgroud)
然后在我的应用程序的容器内运行 nslookup kafka
/go # nslookup schmafka
nslookup: can't resolve '(null)': Name does not resolve
Name: schmafka
Address 1: 172.20.0.8 docker_kafka_1.docker_default
Run Code Online (Sandbox Code Playgroud)
我不明白为什么我得到输出"无法解析'(null)'"然后我得到预期的IP地址打印出来.我试图谷歌nslookup和这个输出消息,但我无法弄清楚为什么会发生这种情况.
我的/etc/resolv.conf文件如下所示:
/go # cat /etc/resolv.conf
search valhalla.local valhalla v
nameserver 127.0.0.11
options ndots:0
Run Code Online (Sandbox Code Playgroud)