decode some json data

This commit is contained in:
Jill 2022-05-13 05:17:59 +03:00
parent c69bd953bb
commit 85692e6949
1 changed files with 17 additions and 17 deletions

View File

@ -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. 4. The length of the payload.
5. The JSON-encoded 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 ## Packets
@ -54,31 +54,31 @@ This packet seems to provide the client with "trusted hosts". As of writing, thi
```json ```json
{ {
"a": [ "trustedHosts": [
{ {
"a": "60cb24a50dc956941869312d", "id": "60cb24a50dc956941869312d",
"b": "Discord", "name": "Discord",
"c": [ "cdn.discordapp.com", "media.discordapp.net" ] "domains": [ "cdn.discordapp.com", "media.discordapp.net" ]
}, },
{ {
"a": "60cb24a50dc956941869312e", "id": "60cb24a50dc956941869312e",
"b": "BadLion", "name": "BadLion",
"c": [ "i.badlion.net" ] "domains": [ "i.badlion.net" ]
}, },
{ {
"a": "60cb24a50dc956941869312f", "id": "60cb24a50dc956941869312f",
"b": "Imgur", "name": "Imgur",
"c": [ "i.imgur.com", "imgur.com" ] "domains": [ "i.imgur.com", "imgur.com" ]
}, },
{ {
"a": "60cb24a50dc9569418693130", "id": "60cb24a50dc9569418693130",
"b": "Reddit", "name": "Reddit",
"c": [ "i.redd.it" ] "domains": [ "i.redd.it" ]
}, },
{ {
"a": "60cb24a50dc9569418693131", "id": "60cb24a50dc9569418693131",
"b": "Twitter", "name": "Twitter",
"c": [ "pbs.twimg.com" ] "domains": [ "pbs.twimg.com" ]
} }
] ]
} }