#!/usr/bin/python # Change log level to suppress annoying IPv6 error import logging logging.getLogger("scapy.runtime").setLevel(logging.ERROR) from scapy.all import * import time # Adjust MAC addresses of sender and recipient of this packet accordingly, the dst MAC # should be the MAC of the gateway to use when the target is not on your local subnet ether=Ether(src="40:eb:60:9f:42:a0",dst="e8:40:f2:d1:b3:a2") # Set up source and destination IP addresses ip=IP(src="192.168.1.217", dst="192.168.1.11") # Assemble an ACK packet with "Hello World\n" as a payload pkt = ether/ip/TCP(sport=31337, dport=1234, flags="A", seq=43, ack=1337) / ("Hello World\n") # Write the packet to a pcap file, which can then be sent using a patched version of tcpreplay wrpcap("ack_with_payload.pcap",pkt)