#!/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_dst_ip = $options{b}; $dest_ip = $options{c}; $dest_dst_ip = $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 icmp -qE -B $source_ip -b $source_dst_ip -D $dest_ip -S $dest_dst_ip -I 4 -T 250 -P $payload_file"); } } # main_routine(); sub usage() { print STDERR << "EOF"; This program creates and sends out a icmp echo request. With "tcpdump|grep SOURCE_IP" you get something like that in return: nemesis icmp -qE -B 216.239.59.104 -b 81.169.176.103 -D 216.239.59.104 -S 81.169.176.103 -P test.txt tcpdump|grep 216.239.59.104 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes 11:57:16.859954 IP h5880.serverkompetenz.net > 216.239.59.104: icmp 16: echo request seq 13840 11:57:16.912369 IP 216.239.59.104 > h5880.serverkompetenz.net: icmp 16: echo reply seq 13840 11:58:26.296843 IP h5880.serverkompetenz.net > 216.239.59.104: icmp 16: echo request seq 23886 11:58:26.349186 IP 216.239.59.104 > h5880.serverkompetenz.net: icmp 16: echo reply seq 23886 usage: $0 [-habcd] [-f file] -h : this (help) message -a : origninal source ip address -b : origninal destination ip address -c : source ip address -d : destination ip adress -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 151.23.45.67 -c 141.55.123.24 -d 151.23.45.67 -f payload.txt EOF exit; }