Skip to content

Instantly share code, notes, and snippets.

@nboubakr
Created September 23, 2013 13:18
Show Gist options
  • Save nboubakr/6670282 to your computer and use it in GitHub Desktop.
Save nboubakr/6670282 to your computer and use it in GitHub Desktop.
Three Way Handshaking using Scapy
#!/usr/bin/env python
#! -*- coding: utf-8 -*-
# Three Way Handshaking using Scapy
from scapy.all import *
ip = IP(src="192.168.0.2", dst="172.16.24.1")
SYN = TCP(sport=1500, dport=80, flags='S', seq=100)
SYNACK = sr1(ip/SYN)
my_ack = SYNACK.seq + 1
ACK = TCP(sport=1050, dport=80, flags='A', seq=101, ack=my_ack)
send(ip/ACK)
payload = "stuff"
PUSH = TCP(sport=1050, dport=80, flags='PA', seq=11, ack=my_ack)
send(ip/PUSH/payload)
@62019
Copy link

62019 commented Jan 9, 2020

issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment