From 85692e6949740b06e8057405c338e7edd63a9b09 Mon Sep 17 00:00:00 2001 From: "Jill \"oatmealine\" Monoids" Date: Fri, 13 May 2022 05:17:59 +0300 Subject: [PATCH] decode some json data --- packets.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/packets.md b/packets.md index 003a1d8..2811aef 100644 --- a/packets.md +++ b/packets.md @@ -18,7 +18,7 @@ It's unknown to me how the UUID of a packet is obtained. This UUID is not sent b 4. The length of the payload. 5. The JSON-encoded payload. -The payload will be encoded using a custom GSON config which encodes simple JSON keys into single characters. For instance, a payload of `{"className":"connection.ClientConnectionLoginPacket","packetId":1}` will be converted into `{"a":"connection.ClientConnectionLoginPacket","b":1}`. This seems to be a networking optimization and obfuscation tactic. The keys will always stay consistent and seem to be based on definition order; if a constructor of a packet lists the properties `id` and `type`, then you can always know that `a` will mean `id` and `b` will mean `type`. It seems that both parties always maintain packet definitions for both sides to decode recieved packets. +The payload will be encoded using a custom GSON config which encodes simple JSON keys into single characters. For instance, a payload of `{"className":"connection.ClientConnectionLoginPacket","packetId":1}` will be converted into `{"a":"connection.ClientConnectionLoginPacket","b":1}`. This seems to be a networking optimization and obfuscation tactic. The keys will always stay consistent and seem to be based on the `@SerializedName` annotation, however commonly they're properly ordered in the constructor; if a constructor of a packet lists the properties `id` and `type`, then you can always know that `a` will mean `id` and `b` will mean `type`. It seems that both parties always maintain packet definitions for both sides to decode recieved packets. ## Packets @@ -54,31 +54,31 @@ This packet seems to provide the client with "trusted hosts". As of writing, thi ```json { - "a": [ + "trustedHosts": [ { - "a": "60cb24a50dc956941869312d", - "b": "Discord", - "c": [ "cdn.discordapp.com", "media.discordapp.net" ] + "id": "60cb24a50dc956941869312d", + "name": "Discord", + "domains": [ "cdn.discordapp.com", "media.discordapp.net" ] }, { - "a": "60cb24a50dc956941869312e", - "b": "BadLion", - "c": [ "i.badlion.net" ] + "id": "60cb24a50dc956941869312e", + "name": "BadLion", + "domains": [ "i.badlion.net" ] }, { - "a": "60cb24a50dc956941869312f", - "b": "Imgur", - "c": [ "i.imgur.com", "imgur.com" ] + "id": "60cb24a50dc956941869312f", + "name": "Imgur", + "domains": [ "i.imgur.com", "imgur.com" ] }, { - "a": "60cb24a50dc9569418693130", - "b": "Reddit", - "c": [ "i.redd.it" ] + "id": "60cb24a50dc9569418693130", + "name": "Reddit", + "domains": [ "i.redd.it" ] }, { - "a": "60cb24a50dc9569418693131", - "b": "Twitter", - "c": [ "pbs.twimg.com" ] + "id": "60cb24a50dc9569418693131", + "name": "Twitter", + "domains": [ "pbs.twimg.com" ] } ] }