Advertisement
Guest User

Untitled

a guest
Feb 13th, 2012
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.28 KB | None | 0 0
  1. <?php
  2.  
  3. // User configuration
  4. $Username = "";
  5. $Password = ""; // The MD5'd password
  6.  
  7. // This is a payload of uknown value. Perhaps a protocol identifier
  8. $payload = "62:31:38:31:35:7c:31:31:7c:30:7c:34:34:65:30:38:38:66:35:62:38:66:33:34:33:64:36:64:39:65:63:66:65:36:36:63:31:62:66:35:65:64:66:3a:30:30:30:38:41:31:39:34:38:35:30:33:2e:30:30:31:35:46:32:35:37:34:42:45:31:2e:2e:30:30:30:30:30:30:30:30:30:30:30:30:30:30:45:30:2e:30:30:30:30:30:30:30:30:30:30:30:30:30:30:45:30:2e:3a:37:32:32:64:33:32:62:32:61:63:31:31:35:61:38:36:35:66:35:31:66:66:63:39:61:30:32:64:64:65:30:38:0d:0a";
  9. $payload = str_replace(':', '', $payload);
  10. $payload = pack("H*" , $payload);
  11.  
  12.  
  13. $fh = fsockopen('50.23.74.90', 13382);
  14. if ($fh) {
  15.         // We're in!
  16.         // Authenticate by sending first, the username\r\n
  17.         echo "Sending Username...\r\n";
  18.         fwrite($fh, "$Username\r\n");
  19.         // Now the password
  20.         echo "Sending Password...\r\n";
  21.         fwrite($fh, "$Password\r\n");
  22.  
  23.         echo "Sending payload...\r\n";
  24.         fwrite($fh, $payload);
  25.         // A third call happens here, I have *no* idea what it is. Lets hope that we don't need it?
  26.         // I suspect this is a call to bancho, some kind of "get me a list of users"
  27.  
  28.         // At this point, we should be 'connected'. Lets inspect the first packet
  29.  
  30.         // Read in some data to verify whether we authenticated properly
  31.         $firstPacket = fread($fh, 9999);
  32.         if ($firstPacket == pack("H*" , "05000004000000ffffffff")) {
  33.                 echo "Error. Authentication failed\r\n";
  34.                 die();
  35.         } else {
  36.                 var_dump($firstPacket);
  37.         }
  38.  
  39.         $olddata = false;
  40.         $i = 0;
  41.         while (true) {
  42.                 $data = fread($fh, 9999);
  43.                 if ($data != $olddata) {
  44.                         var_dump(bin2hex($data));
  45.         //              var_dump($data);
  46.                         $olddata = $data;
  47.                         $i++;
  48.                 } else {
  49.                         echo ".";
  50.                         var_dump($fh);
  51.                         usleep(100);
  52.                 }
  53.                 if ($i > 5) {
  54.                         die();
  55.                 }
  56.         }
  57. } else {
  58.         echo "Could not connect to osu :<";
  59. }
  60.  
  61. var_dump($fh);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement