Project

General

Profile

Security #4513 » test-nozero-ack.py

Peter Manev, 05/28/2021 10:02 AM

 
from scapy.all import *

# VARIABLES
src = sys.argv[1]
dst = sys.argv[2]
sport = random.randint(1024,65535)
dport = int(sys.argv[3])

# SYN
ip=IP(src=src,dst=dst)
#SYN=TCP(sport=sport,dport=dport,flags='S', seq=1000)
SYN=TCP(sport=sport,dport=dport,flags='S', ack=1234567, seq=1000)
SYNACK=sr1(ip/SYN)

# ACK
ACK=TCP(sport=sport, dport=dport, flags='A', seq=SYNACK.ack, ack=SYNACK.seq + 1)
send(ip/ACK)
(1-1/2)