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.
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" ]
}
]
}