smiley/steamapi

IP finding?

CultureCoder opened this issue · 5 comments

Is there a way to print what server IP a user is on? It's so I can make a script do something like this:

What is your SteamID? : CultureCoder
Game information:
Counter-Strike Source
82.39.79.142:27015

Sorry about the (ridiculously) late reply. I looked into it when you asked this, and I couldn't find a way to ask the API that. I can ask whose game server it is (i.e.: for a given IP address, I can ask which SteamID runs it), but I can't ask which game server a user is on. I'm guessing there might be a privileged API for that, accessible to game publishers -- but I can't see it with a standard API key.

@smiley I was looking at the Steam API documentation here and if you Ctrl+F for "gameserverip" there apparently is a method under GetPlayerSummaries. Again, I'm a Python noob so I apologize if I'm missing something but there it is in case you accidentally glossed over it. 😄

It's a part of the spec, but it never actually appears. I just tested it out to be sure, and calling the API with a key & IDs of people currently playing CS:GO (with a "Join Game" button, so they're actually on a server) doesn't actually return their current server.

It was probably exploited in the past and currently offered just to privileged (game devs) & authorised (OAuth) keys.

Hey, I know this is closed but I feel like opening a new issue would be redundant -- you said

I can ask whose game server it is (i.e.: for a given IP address, I can ask which SteamID runs it)...

Does this mean if you have a server's IP you can get the SteamID of everyone in the server? If so, is it possible to do in the current version or was it something you coded up on the spot just to see if it was possible? If it is possible in the current version, how would you do it? I only see stuff regarding Steam profiles, nothing with servers. Thanks!

No. "whose game server it is" refers to the Steam ID of the owner. Every Steamworks-based server needs to be registered under a Steam ID to enter the master list, and (it looks like) the API grants you the option to see who is registered as the owner of that server. (Usually basic accounts created for that purpose)

Given an IP, you can query a game server to ask for game details and who's on it, but currently only via the original Steam game server API. (Which this library doesn't implement) And you can't get the IP at the moment with a normal web API key.