Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ping function (server advertisement) includes packet size in string header #274

Open
stevarino opened this issue Sep 11, 2022 · 0 comments

Comments

@stevarino
Copy link
Contributor

While testing 1.19.30, I noticed some odd behavior with the advertisement feature. Given the following advertisement:

0000   02 00 00 00 45 00 00 88 80 f8 00 00 80 11 00 00   ....E...........
0010   7f 00 00 01 7f 00 00 01 4a be cf af 00 74 57 26   ........J....tW&
0020   1c 00 00 00 00 a4 02 3e 65 ca a7 6a 06 9f d4 1e   .......>e..j....
0030   87 00 ff ff 00 fe fe fe fe fd fd fd fd 12 34 56   ..............4V
0040   78 00 49 4d 43 50 45 3b 42 65 64 72 6f 63 6b 20   x.IMCPE;Bedrock 
0050   50 72 6f 74 6f 63 6f 6c 20 53 65 72 76 65 72 3b   Protocol Server;
0060   35 35 33 3b 31 2e 31 39 2e 33 30 3b 30 3b 33 3b   553;1.19.30;0;3;
0070   30 3b 62 65 64 72 6f 63 6b 2d 70 72 6f 74 6f 63   0;bedrock-protoc
0080   6f 6c 3b 43 72 65 61 74 69 76 65 3b               ol;Creative;

running bedrock-protocol.ping returns the following object:

ServerAdvertisement {
  motd: 'Bedrock Protocol Server',
  levelName: 'bedrock-protocol',
  playersOnline: '0',
  playersMax: '3',
  gamemode: 'Creative',
  serverId: '0',
  protocol: '553',
  version: '1.19.30',
  header: '\x00IMCPE'
}

The header field has some hex in it, more easily seen if we hex-dump the advertisement before parsing: <Buffer 00 49 4d 43 50 45 3b 42 65 64 72 6f 63 6b 20 50 72 6f 74 6f 63 6f 6c 20 53 65 72 76 65 72 3b 35 35 33 3b 31 2e 31 39 2e 33 30 3b 30 3b 33 3b 30 3b 62 ... 25 more bytes>

00 49 is the Raknet packet string length packet, but is being included in the high-level advertisement function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant