Socket fake players

Discussion in 'Spigot Plugin Development' started by hackeris, Jul 11, 2018.

  1. there is a way to fake players online with sockets? i mean when you will check server output by sockets you will see fake players number , not real
  2. joehot200


    Could you clarify the question? But yes, the answer is generally yes: You can fake player count, you can create fake physical players, you can create fake players in the tab list.

    Not sure why you'd use sockets specifically though.... In fact, I don't really see what sockets has to do with it.
  3. example
    Code (Text):
    function QueryMinecraft($ip, $port = 25565) {

        @$socket = fsockopen("tcp://" . $ip, $port, $errno, $errstr, 3);
        if (!$socket) { return array('status' => 0); }
        socket_set_timeout($socket, 5);
        fwrite($socket, "\xFE\x01"); //Send the server list ping request (two bytes)
        @$data = fread($socket, 1024); //Get the info and store it in $data
        if ($data != false && substr($data, 0, 1) == "\xFF") //Ensure we're getting a kick message as expected
            $data = substr($data, 9); //Remove packet, length and starting characters
            $data = explode("\x00\x00", $data); //0000 separated info
            $protocolVersion = $data[0]; //Get it all into separate variables
            @$serverVersion = mb_convert_encoding($data[1], 'UTF-8', 'UCS-2');;
            @$motd = $data[2];
            $motd = mb_convert_encoding($motd, 'UTF-8', 'UCS-2');
            @$players = mb_convert_encoding($data[3], 'UTF-8', 'UCS-2');
            @$max_players = mb_convert_encoding($data[4], 'UTF-8', 'UCS-2');
            return array('status' => 1, 'Players' => $players, 'MaxPlayers' => $max_players, 'serverVersion' => $serverVersion);
        } else { return array('status' => 0); }
    In this way the ProtocolLIB SERVER_INFO method doesn't helps , it still shows the original players online count.
  4. If all you're doing it display info on a site you can just change the player value.

    if you're modifying the value others will see in serverlist you'll have to find where minecraft sends the result and modify the contents of that. Which isn't hard, just need to identify what packet out class is used for it and find usages, etc.
  5. please can somebody help?
  6. Tux


    It looks like you're using old server list pinging code, which is probably why you can't "fake" the response (because that's handled through a separate path in the server code). It'll display properly with a library that uses the 1.7+ ping, such as this one.