SteamRE / SteamKit

SteamKit2 is a .NET library designed to interoperate with Valve's Steam network. It aims to provide a simple, yet extensible, interface to perform various actions on the network.
GNU Lesser General Public License v2.1
2.59k stars 495 forks source link

Short question regarding the GameCoordinator #467

Closed cyborg-nation closed 7 years ago

cyborg-nation commented 7 years ago

How does one set fields that are not explicitly defined like this for example

http://prntscr.com/gumy91

Sorry don't know if this is the right place to ask stuff like this.

yaakov-h commented 7 years ago

When NetHook Analyzer is unable to find a body type for the message (based on fuzzy matching) it reverts to this view.

This just shows the raw structure of the protobuf message. We have a field number, field type, and value, but we don't know what it means.

If you want to create one of these messages, you'll need to figure out what the corresponding message type is. The emsg field should usually point you in the right track.

cyborg-nation commented 7 years ago

As in for example i know it's this one

message CMsgGCCStrike15_v2_ClientRequestWatchInfoFriends { optional uint32 request_id = 1; repeated uint32 account_ids = 2; optional uint64 serverid = 3; optional uint64 matchid = 4; }

And since it's not named in the body i would set

[1] => account_ids = 2; [2] => serverid = 249534563;

to get a matching packet? Did I understand that correctly?

yaakov-h commented 7 years ago

More or less - I think the way repeated fields work means that NetHookAnalyzer is either only showing the first field, or the last field.

If you add an enum-to-type mapping to this dictionary, NetHookAnalyzers should show you the full message structure.

cyborg-nation commented 7 years ago

Okay i'll give it a try first and check it afterwards if i can get the full structur i basically know what the fields are.

cyborg-nation commented 7 years ago

Okay I have no clue how that enum to type mapping would work

yaakov-h commented 7 years ago

Should be along the lines of [(uint)CSGO.SomeEnum.k_EMsgGCCStrike15_v2_ClientRequestWatchInfoFriends2] = typeof(CMsgGCCStrike15_v2_ClientRequestWatchInfoFriends)

cyborg-nation commented 7 years ago

And like you need to define both in a similar way like for example the ClientHello?

yaakov-h commented 7 years ago

You only need to define the ones you want. If you only get a WatchInfoFriends2 then you only need to define that one, but adding both probably won't hurt.

cyborg-nation commented 7 years ago

just to know if I got everything correctly up to this point.

I need to define those enums in order to see the correct field names of the request. Then i need to fix the request type in my source so that I am calling it with valid fields when i do the request.

as in they are not [1] [2] into the field but they have a valid naming?

I mean when i tried just setting them accordingly I didn't get any response and there's really not much options to play around with considering that there's the first field a second one which is read only and a 3rd and a forth so the only thing u can really use is 1 and 3 as in request id and server id which sounds horrible anyway.

cyborg-nation commented 7 years ago

I mean from what the field is (a steamid3 where [1] is the first part and [2] the second it would make sense if that was an array written into account_ids[0] and account_ids[1] but it's read only so I'm confused.

And in the end does that mean i have to edit the steamkit itself in order to fix that then?

Btw. if there's no inner Message does that mean it's not supported by SteamKit?

yaakov-h commented 7 years ago

If the protobuf message you've posted above is the correct message type - and at first glance it looks to be correct - then the correct names are:

[1]: request_id
[2]: account_ids

In protobuf, the names are not part of the serialised data. This is very different to XML/JSON/YAML/etc. Names only form part of the object model used in the client/server code. Valve could rename one of the fields in their servers and we wouldn't know, and neither system would care. The only thing that matters is the field number and field type.

account_ids should be read-only but mutable - it's a List<uint>, so you can .Add(), .Remove() and .Clear() the list to your heart's desire.

You don't have to edit the SteamKit library to send or recieve such a message, but you will have to make the changes above to NetHookAnalyzer2 if you want to view it with correct field names.

cyborg-nation commented 7 years ago

yeah works cheers.