当我试图回答自己的dns请求时,为什么会出现这个错误


import scapy.all as scapy
p = scapy.DNS(qd=scapy.DNSQR(qname='www.example.com'), an=scapy.DNSRR(rrname='127.0.0.1'))
scapy.send(p)

结果:

Traceback (most recent call last):
File "/home/kali/PROJECTS/server.py", line 3, in <module>
scapy.send(p)
File "/usr/lib/python3/dist-packages/scapy/sendrecv.py", line 425, in send
return _send(
File "/usr/lib/python3/dist-packages/scapy/sendrecv.py", line 395, in _send
results = __gen_send(socket, x, inter=inter, loop=loop,
File "/usr/lib/python3/dist-packages/scapy/sendrecv.py", line 360, in __gen_send
s.send(p)
File "/usr/lib/python3/dist-packages/scapy/arch/linux.py", line 605, in send
self.outs.bind(sdto)
TypeError: AF_PACKET address must be a tuple of two to five elements

当我试图回答自己的dns请求时,为什么会出现这个错误?

您必须指定目标地址和端口。

p = scapy.IP(dst='127.0.0.1') / scapy.UDP(sport=53, dport = client_port) / scapy.DNS(qd=scapy.DNSQR(qname='www.example.com'), an=scapy.DNSRR(rrname='127.0.0.1'))

相关内容

  • 没有找到相关文章

最新更新