#!/usr/bin/perl eval ("use Getopt::Long;");die "[error] Getopt::Long perl module is not installed \n" if $@; eval ("use Net::RawIP;");die "[error] Net::RawIP perl module is not installed \n" if $@; eval ("use Term::ProgressBar;");die "[error] Term::ProgressBar perl module is not installed \n" if $@; my $VERSION = "0.1"; print "$0, $PgmName, V $VERSION \n"; GetOptions ( "help" =>\$usage, "device=s" => \$device, "source=s" =>\$sourceip, "dest=s"=>\$destip, "sourcemac=s"=>\$sourcemac, "destmac=s"=>\$destmac, "port=n"=> \$tcpport, ); ######################## Config option ############################################# my $timeout = "0,1"; # Timeout if ($usage) {&usage;} if (!$device) { $device= 'eth0'; # Network device } if (!$destmac) {print "Dest MAC not found \n"; &usage;} if (!$sourceip) {print "Source IP not found \n"; &usage;} if (!$destip) {print "Dest IP not found \n"; &usage;} if (!$tcpport) {print "TCP port not found \n"; &usage;} my $syn="1"; # TCP SYN SET my $tcpdata = "TEST"; # TCP payload my $count=0; #################################################################################### #Initialize Progres Bar my $progress = Term::ProgressBar->new(32768); $progress->minor(0); $packet = new Net::RawIP; $packet-> ethnew($device); if (!$sourcemac) { $packet -> ethset( dest => $destmac); }else { $packet -> ethset( source =>$sourcemac, dest => $destmac); } for ($count=0; $count< 65537 ; $count++) { $packet->set({ ip => { saddr => $sourceip, daddr => $destip }, tcp => { check => 0x0010 , # TCP Packet Checksum 0 for auto correct source => $count, dest => $tcpport, syn => $syn, data => $tcpdata }}); $packet->ethsend($timeout); #$packet->send($timeout); $progress->update($_); $count++; } sub usage { print <