Scapy 3 way handshake - Wersja do druku
ToolsX Windows 11 Tuning
Scapy 3 way handshake - Wersja do druku

+- ToolsX Windows 11 Tuning (http://darmowe-gry.5v.pl)
+-- Dział:


Linux (http://darmowe-gry.5v.pl/forumdisplay.php?fid=281)
+--- Dział:

Ogólnie

(http://darmowe-gry.5v.pl/forumdisplay.php?fid=286)
+---- Dział: Komendy cmd (http://darmowe-gry.5v.pl/forumdisplay.php?fid=287)
+---- Wątek: Scapy 3 way handshake (/showthread.php?tid=409)



Scapy 3 way handshake - admin - 12-09-2018

TCP 3 Way Basics

s_ip = IP ; s_port = port ; s_seq = seq # ; s_ack = ack #
d_ip = IP ; d_port = port ; d_seq = seq # ; d_ack = ack #

handshake
s_ipConfused_port -> d_ip:d_port, SYN, s_seq, s_ack
d:ip:d_port -> s_ipConfused_port, SYN/ACK, d_seq, d_ack=(s_seq + 1)
s_ipConfused_port -> d_ip:d_port, ACK, d_seq + 1, s_ack=(d_seq + 1)

Sample Script


#!/usr/bin/python
from scapy.all import *

ip=IP(src="10.0.0.1", dst="20.0.0.2")
TCP_SYN=TCP(sport=1500, dport=80, flags="S", seq=100)
TCP_SYNACK=sr1(ip/TCP_SYN)

my_ack = TCP_SYNACK.seq + 1
TCP_ACK=TCP(sport=1500, dport=80, flags="A", seq=101, ack=my_ack)
send(ip/TCP_ACK)

my_payload="space for rent!"
TCP_PUSH=TCP(sport=1500, dport=80, flags="PA", seq=102, ack=my_ack)
send(ip/TCP_PUSH/my_payload)