Skip to content

Instantly share code, notes, and snippets.

@thepacketgeek
Last active September 22, 2023 15:35
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thepacketgeek/6919352 to your computer and use it in GitHub Desktop.
Save thepacketgeek/6919352 to your computer and use it in GitHub Desktop.
Scapy - Creating a TCP Christmas Tree Packet
from scapy.all import *
from random import randint
# Create the skeleton of our packet
template = IP(dst="172.16.20.10")/TCP()
# Start lighting up those bits!
template[TCP].flags = "UFP"
# Create a list with a large number of packets to send
# Each packet will have a random TCP dest port for attack obfuscation
xmas = []
for pktNum in range(0,100):
xmas.extend(template)
xmas[pktNum][TCP].dport = randint(1,65535)
# Send the list of packets
send(xmas)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment