Grasscutter icon indicating copy to clipboard operation
Grasscutter copied to clipboard

How to get the new feature protobuf file ?

Open sanshi2018 opened this issue 1 year ago • 4 comments

I want to implement some features of the new version of the Genshin Impact . please ask how to get the protobuf file of the official server

sanshi2018 avatar Dec 14 '23 07:12 sanshi2018

dump

Kaguya-1210 avatar Dec 14 '23 13:12 Kaguya-1210

dump

I tried to use wireshark to catch udp packets from official server, but the content looks encrypted .... If this protobuf protocol is encrypted, it may be necessary to crack the client to get the key and understand the encryption method, which is too difficult for me...

I want to know the workflow of this server to get the proto file.

sanshi2018 avatar Dec 14 '23 14:12 sanshi2018

tldr; good luck. it's unlikely/impossibly difficult for beginners

you are missing a lot of things. mhy's protocol is encrypted.

the first 2 messages are encrypted with a hardcoded key. within the first two packets, the server tells the client what seed to run through a random byte generator in order to create an encryption key.

after you break the encryption, you are left with the raw packet data which doesn't mean anything on its own.

this is where protocol buffer files come in: they act as definition files which declare the type and field ID of packet content. think of protobuf as JSON where all the keys are numbers. you need to create these definition files yourself, most likely by dumping the obfuscated names and field IDs from the encrypted and obfuscated part of the client's game assembly.

here is where the problem lies: if you are trying to implement a relatively new feature, you won't be able to. the packet itself is obfuscated and its field IDs are protected behind multiple layers of virtualization.

additionally, without another nameTranslation.txt leak, it's impossible to know what a packet is called and what its data is named.

KingRainbow44 avatar Dec 14 '23 15:12 KingRainbow44

To add to it, if you are searching for packets sent by the client, you can analyze the content easily via ps, if you know how to trigger the send and the ps has enough packages implemented to get to the point to trigger it, but that still won't give you any packets the server sends, and only helps you to analyze them in context (eg. when you press a specific ui button, like from an activity/event) and maybe deobfuscate obfuscated dumped packets.

edited: fixed english

Hartie95 avatar Dec 14 '23 16:12 Hartie95