Browse Source

Implement Logon ID (#63)

pull/60/merge
lopezloo 8 years ago
committed by Rossen Georgiev
parent
commit
cd39231b9a
  1. 11
      steam/client/__init__.py
  2. 4
      steam/core/connection.py

11
steam/client/__init__.py

@ -28,7 +28,7 @@ from steam.core.msg import MsgProto
from steam.core.cm import CMClient from steam.core.cm import CMClient
from steam import SteamID from steam import SteamID
from steam.client.builtins import BuiltinBase from steam.client.builtins import BuiltinBase
from steam.util import ip_from_int, proto_fill_from_dict from steam.util import ip_from_int, ip_to_int, proto_fill_from_dict
if six.PY2: if six.PY2:
_cli_input = raw_input _cli_input = raw_input
@ -436,7 +436,7 @@ class SteamClient(CMClient, BuiltinBase):
if self.relogin_available: if self.relogin_available:
self.login(self.username, '', self.login_key) self.login(self.username, '', self.login_key)
def login(self, username, password='', login_key=None, auth_code=None, two_factor_code=None): def login(self, username, password='', login_key=None, auth_code=None, two_factor_code=None, login_id=None):
"""Login as a specific user """Login as a specific user
:param username: username :param username: username
@ -449,6 +449,8 @@ class SteamClient(CMClient, BuiltinBase):
:type auth_code: :class:`str` :type auth_code: :class:`str`
:param two_factor_code: 2FA authentication code :param two_factor_code: 2FA authentication code
:type two_factor_code: :class:`str` :type two_factor_code: :class:`str`
:param login_id: number used for identifying logon session
:type login_id: :class:`int`
:return: logon result, see `CMsgClientLogonResponse.eresult <https://github.com/ValvePython/steam/blob/513c68ca081dc9409df932ad86c66100164380a6/protobufs/steammessages_clientserver.proto#L95-L118>`_ :return: logon result, see `CMsgClientLogonResponse.eresult <https://github.com/ValvePython/steam/blob/513c68ca081dc9409df932ad86c66100164380a6/protobufs/steammessages_clientserver.proto#L95-L118>`_
:rtype: :class:`.EResult` :rtype: :class:`.EResult`
@ -487,6 +489,11 @@ class SteamClient(CMClient, BuiltinBase):
message.body.should_remember_password = True message.body.should_remember_password = True
message.body.supports_rate_limit_response = True message.body.supports_rate_limit_response = True
if login_id is None:
message.body.obfustucated_private_ip = ip_to_int(self.connection.local_address) ^ 0xBAADF00D
else:
message.body.obfustucated_private_ip = login_id
message.body.account_name = username message.body.account_name = username
if login_key: if login_key:

4
steam/core/connection.py

@ -28,6 +28,10 @@ class Connection(object):
self.event_connected = event.Event() self.event_connected = event.Event()
@property
def local_address(self):
return self.socket.getsockname()[0]
def connect(self, server_addr): def connect(self, server_addr):
self._new_socket() self._new_socket()

Loading…
Cancel
Save