#!/usr/bin/env ruby # # $Id: icmpv6-spew 152 2009-12-13 06:21:32Z jhart $ # # Given a source and destination IP address # and a data size, spew all 65536 possible ICMPv6 require 'rubygems' require 'racket' include Racket if (ARGV.size != 4) puts "Usage #{$0} " exit! end def tick @it += 1 @it = 0 if @it >= @ticks.size print "\r#{@ticks[@it]}" STDOUT.flush end def rand_icmp6(n) n.l4 = L4::ICMPv6.new(Misc.randstring(40)) n.l4.payload = Misc.randstring(ARGV[3].to_i) n.l4.fix!(n.l3.src_ip, n.l3.dst_ip) n.sendpacket tick end @it = 0 @ticks = %w( / - \\ | ) n = Racket::Racket.new n.iface = ARGV[0] n.l2 = L2::Ethernet.new(Misc.randstring(14)) n.l2.ethertype = 0x86DD n.l3 = L3::IPv6.new n.l3.src_ip= L3::Misc.ipv62long(ARGV[1]) n.l3.dst_ip= L3::Misc.ipv62long(ARGV[2]) n.l3.nhead = 58 puts "Spewing..." while (true) rand_icmp6(n) end # vim: set ts=2 et sw=2: