lethak / frostbite-php-framework

BF4: a lightweight PHP Framework wrapping Frostbite's RCON protocol - Lets you trigger admin command from your website or CLI (tested with Battlefield 4 server up to R42)
12 stars 8 forks source link

PunkBuster-Packet breaks communication #3

Open Bizarrus opened 10 years ago

Bizarrus commented 10 years ago

If the backend receive the PunkBuster-Playerlist over punkBuster.onMessage, the reading will be blocked.

[Europe/Berlin 10/11/2014 17:00:04] engines/frostbite3/frostbite3.class.php(104): "info": Info: RECEIVE [ Sequence=31404, FromServer=True, Response=False, Words={ "2", "punkBuster.onMessage", "4Netplayers-PB Server: Player List: [Slot #] [GUID] [Address] [Status] [Power] [Auth Rate] [Recent SS] [O/S] [Name]" }, Callback=Null ]

I'm working on a Fix. I think the method containsCompletePacket works not correcly. My idea is, that the Method can't handle the Punkbuster-packet, and cant define that the packet is complete - an endless-loop...

while (!self::containsCompletePacket($this->receiveBuffer))
Bizarrus commented 10 years ago

Yep, the Packet is broken. And endless loop will block the application:

static function containsCompletePacket($data)
{
    if (mb_strlen($data) < 8)
        return false;

    $test = self::DecodeInt32(mb_substr($data, 4, 4));
    var_dump($test);

    if (mb_strlen($data) < $test)
        return false;

    return true;
}

If the Player-List packet with punkBuster.onMessage will received, and endless loop with following output comes:

[Europe/Berlin 10/11/2014 17:33:32] engines/frostbite3/frostbite3.class.php(97): "info": Info: RECEIVE [ Sequence=36253, FromServer=False, Response=False, Words={ "2", "punkBuster.onMessage", "4Netplayers-PB Server: Player List: [Slot #] [GUID] [Address] [Status] [Power] [Auth Rate] [Recent SS] [O/S] [Name]" }, Callback=Null ]
int(862348343)
int(862348343)
int(862348343)
int(862348343)
int(862348343)
int(862348343)
....
graczu0x0x0x0x0 commented 8 years ago

Is there way to read server console?

Bizarrus commented 8 years ago

Specific your question; Which server console?

graczu0x0x0x0x0 commented 8 years ago

BF4 ( Frostbite 3 ) Server console output, says, events, pb, everything that is on server console.