首页 > 解决方案 > 路由器不响应欺骗性 DNS 查询

问题描述

我正在编写一个带有 scapy 的 Python 脚本来欺骗 DNS 查询的地址。到目前为止,路由器没有回复欺骗性查询。

我已将 IP 和 MAC 地址设置为在脚本上匹配,并且非欺骗性 DNS 请求工作正常。

这是脚本。

from scapy.all import *

packet=sendp(Ether(src="B0:70:2D:CF:4D:8F")/IP(id=random.randint(0, 0xFFFF),dst="192.168.0.1",src="192.168.0.123")/UDP(dport=53,sport=11333)/DNS(id=random.randint(0, 0xFFFF),rd=1,qd=DNSQR(qname="www.duckduckgo.org")))

这是数据包捕获

Frame 323: 78 bytes on wire (624 bits), 78 bytes captured (624 bits) on interface wlp0s20f0u9, id 0
Ethernet II
    Destination: <DNS Server>
    Source: <Spoofed MAC Address>
    Type: IPv4 (0x0800)
Internet Protocol Version 4, Src: 192.168.0.123, Dst: 192.168.0.1
    0100 .... = Version: 4
    .... 0101 = Header Length: 20 bytes (5)
    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
    Total Length: 64
    Identification: 0xfd74 (64884)
    Flags: 0x0000
    Fragment offset: 0
    Time to live: 64
    Protocol: UDP (17)
    Header checksum: 0xfb6b [correct]
    [Header checksum status: Good]
    [Calculated Checksum: 0xfb6b]
    Source: 192.168.0.123
    Destination: 192.168.0.1
User Datagram Protocol, Src Port: 11333, Dst Port: 53
    Source Port: 11333
    Destination Port: 53
    Length: 44
    Checksum: 0x89a7 [correct]
    [Checksum Status: Good]
    [Stream index: 20]
    [Timestamps]
Domain Name System (query)
    Transaction ID: 0x404c
    Flags: 0x0100 Standard query
    Questions: 1
    Answer RRs: 0
    Authority RRs: 0
    Additional RRs: 0
    Queries

    Destination: 192.168.0.1

标签: pythonnetworkingdnsscapy

解决方案


推荐阅读