def handle_update_machine_auth(self, msg): message = msg_base.ProtobufMessage( steammessages_clientserver_pb2.CMsgClientUpdateMachineAuth) message.parse(msg) sentryfile = message.body.bytes hash = Util.sha1_hash(sentryfile) self.callback.store_sentry_file(self.username, sentryfile) response = msg_base.ProtobufMessage( steammessages_clientserver_pb2.CMsgClientUpdateMachineAuthResponse, EMsg.ClientUpdateMachineAuthResponse) response.header.target_jobid = message.header.source_jobid response.body.cubwrote = message.body.cubtowrite response.body.eresult = EResult.OK response.body.filename = message.body.filename response.body.filesize = message.body.cubtowrite response.body.getlasterror = 0 response.body.offset = message.body.offset response.body.sha_file = hash response.body.otp_identifier = message.body.otp_identifier response.body.otp_type = message.body.otp_type self.connection.send_message(response)
def login(self, username=None, password=None, login_key=None, auth_code=None, steamid=0, two_factor_code=None): self.username = username message = msg_base.ProtobufMessage( steammessages_clientserver_pb2.CMsgClientLogon, EMsg.ClientLogon) message.proto_header.client_sessionid = 0 if steamid > 0: message.proto_header.steamid = steamid else: message.proto_header.steamid = SteamID.make_from( 0, 0, EUniverse.Public, EAccountType.Individual).steamid message.body.protocol_version = 65575 message.body.client_package_version = 1771 message.body.client_os_type = 10 message.body.client_language = "english" message.body.machine_id = "OK" message.body.account_name = username message.body.password = password if login_key: message.body.login_key = login_key if auth_code: message.body.auth_code = auth_code if two_factor_code: message.body.two_factor_code = two_factor_code sentryfile = self.callback.get_sentry_file(username) if sentryfile: message.body.sha_sentryfile = Util.sha1_hash(sentryfile) message.body.eresult_sentryfile = EResult.OK else: message.body.eresult_sentryfile = EResult.FileNotFound localip = self.connection.get_bound_address() message.body.obfustucated_private_ip = 1111 self.connection.send_message(message) logonResponse = self.wait_for_message(EMsg.ClientLogOnResponse) if self.steamid: self.account_type = self.steamid.accounttype return logonResponse.body
def _make_request_url(self, action, params='', token=None): absolute_uri = '/%s/%s' % (action, params) url = 'http://%s:%s%s%s' % (self.host, self.port, absolute_uri, token if token else '') if self.type == 'CDN': return (url, {}) self.req_counter += 1 hash_buffer = struct.pack('<QQ', self.session_id, self.req_counter) + self.session_key + absolute_uri sha_hash = Util.sha1_hash(hash_buffer, True) headers = {'x-steam-auth': 'sessionid=%d;req-counter=%d;hash=%s;' % (self.session_id, self.req_counter, sha_hash)} return (url, headers)
def _make_request_url(self, action, params="", token=None): absolute_uri = "/%s/%s" % (action, params) url = "http://%s:%s%s%s" % (self.host, self.port, absolute_uri, token if token else "") if self.type == "CDN": return (url, {}) self.req_counter += 1 hash_buffer = struct.pack("<QQ", self.session_id, self.req_counter) + self.session_key + absolute_uri sha_hash = Util.sha1_hash(hash_buffer, True) headers = { "x-steam-auth": "sessionid=%d;req-counter=%d;hash=%s;" % (self.session_id, self.req_counter, sha_hash) } return (url, headers)
def login(self, username=None, password=None, login_key=None, auth_code=None, steamid=0, two_factor_code=None): self.username = username message = msg_base.ProtobufMessage(steammessages_clientserver_pb2.CMsgClientLogon, EMsg.ClientLogon) message.proto_header.client_sessionid = 0 if steamid > 0: message.proto_header.steamid = steamid else: message.proto_header.steamid = SteamID.make_from(0, 0, EUniverse.Public, EAccountType.Individual).steamid message.body.protocol_version = 65575 message.body.client_package_version = 1771 message.body.client_os_type = 10 message.body.client_language = "english" message.body.machine_id = "OK" message.body.account_name = username message.body.password = password if login_key: message.body.login_key = login_key if auth_code: message.body.auth_code = auth_code if two_factor_code: message.body.two_factor_code = two_factor_code sentryfile = self.callback.get_sentry_file(username) if sentryfile: message.body.sha_sentryfile = Util.sha1_hash(sentryfile) message.body.eresult_sentryfile = EResult.OK else: message.body.eresult_sentryfile = EResult.FileNotFound localip = self.connection.get_bound_address() message.body.obfustucated_private_ip = 1111 self.connection.send_message(message) logonResponse = self.wait_for_message(EMsg.ClientLogOnResponse) if self.steamid: self.account_type = self.steamid.accounttype return logonResponse.body
def handle_update_machine_auth(self, msg): message = msg_base.ProtobufMessage(steammessages_clientserver_pb2.CMsgClientUpdateMachineAuth) message.parse(msg) sentryfile = message.body.bytes hash = Util.sha1_hash(sentryfile) self.callback.store_sentry_file(self.username, sentryfile) response = msg_base.ProtobufMessage(steammessages_clientserver_pb2.CMsgClientUpdateMachineAuthResponse, EMsg.ClientUpdateMachineAuthResponse) response.header.target_jobid = message.header.source_jobid response.body.cubwrote = message.body.cubtowrite response.body.eresult = EResult.OK response.body.filename = message.body.filename response.body.filesize = message.body.cubtowrite response.body.getlasterror = 0 response.body.offset = message.body.offset response.body.sha_file = hash response.body.otp_identifier = message.body.otp_identifier response.body.otp_type = message.body.otp_type self.connection.send_message(response)