From 4181f3ba21e0414a96a1000ed0af921c10874fa1 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Mon, 14 Mar 2016 20:38:17 +0100 Subject: [PATCH] Add workaround for broken GenerateMachineID(), #154 --- ArchiSteamFarm/ArchiHandler.cs | 30 ++++++++++++++++++++++++++++++ ArchiSteamFarm/Bot.cs | 17 +++++++++++++++++ ArchiSteamFarm/GlobalConfig.cs | 4 ++++ ArchiSteamFarm/config/ASF.json | 1 + 4 files changed, 52 insertions(+) diff --git a/ArchiSteamFarm/ArchiHandler.cs b/ArchiSteamFarm/ArchiHandler.cs index 6ff691a591d50..97c8d50f0fe6e 100644 --- a/ArchiSteamFarm/ArchiHandler.cs +++ b/ArchiSteamFarm/ArchiHandler.cs @@ -265,6 +265,36 @@ internal async Task RedeemKey(string key) { } } + // TODO: Please remove me immediately after https://github.com/SteamRE/SteamKit/issues/254 gets fixed + internal void HackedLogOn(SteamUser.LogOnDetails details) { + if (!Client.IsConnected) { + return; + } + + SteamID steamID = new SteamID(details.AccountID, details.AccountInstance, Client.ConnectedUniverse, EAccountType.Individual); + + var logon = new ClientMsgProtobuf(EMsg.ClientLogon); + logon.Body.obfustucated_private_ip = details.LoginID.Value; + logon.ProtoHeader.client_sessionid = 0; + logon.ProtoHeader.steamid = steamID.ConvertToUInt64(); + logon.Body.account_name = details.Username; + logon.Body.password = details.Password; + logon.Body.should_remember_password = details.ShouldRememberPassword; + logon.Body.protocol_version = MsgClientLogon.CurrentProtocol; + logon.Body.client_os_type = (uint) details.ClientOSType; + logon.Body.client_language = details.ClientLanguage; + logon.Body.cell_id = details.CellID; + logon.Body.steam2_ticket_request = details.RequestSteam2Ticket; + logon.Body.client_package_version = 1771; + logon.Body.auth_code = details.AuthCode; + logon.Body.two_factor_code = details.TwoFactorCode; + logon.Body.login_key = details.LoginKey; + logon.Body.sha_sentryfile = details.SentryFileHash; + logon.Body.eresult_sentryfile = (int) (details.SentryFileHash != null ? EResult.OK : EResult.FileNotFound); + + Client.Send(logon); + } + /* _ _ _ _ | | | | __ _ _ __ __| || | ___ _ __ ___ diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 6d66fd344d374..553e81f53de16 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -1083,6 +1083,23 @@ private void OnConnected(SteamClient.ConnectedCallback callback) { InitializeLoginAndPassword(); Logging.LogGenericInfo("Logging in...", BotName); + + // TODO: Please remove me immediately after https://github.com/SteamRE/SteamKit/issues/254 gets fixed + if (Program.GlobalConfig.HackIgnoreMachineID) { + Logging.LogGenericWarning("Using workaround for broken GenerateMachineID()!", BotName); + ArchiHandler.HackedLogOn(new SteamUser.LogOnDetails { + Username = BotConfig.SteamLogin, + Password = BotConfig.SteamPassword, + AuthCode = AuthCode, + LoginID = LoginID, + LoginKey = BotDatabase.LoginKey, + TwoFactorCode = TwoFactorAuth, + SentryFileHash = sentryHash, + ShouldRememberPassword = true + }); + return; + } + SteamUser.LogOn(new SteamUser.LogOnDetails { Username = BotConfig.SteamLogin, Password = BotConfig.SteamPassword, diff --git a/ArchiSteamFarm/GlobalConfig.cs b/ArchiSteamFarm/GlobalConfig.cs index c728fbbdc1d13..55f324c3210e5 100644 --- a/ArchiSteamFarm/GlobalConfig.cs +++ b/ArchiSteamFarm/GlobalConfig.cs @@ -80,6 +80,10 @@ internal enum EUpdateChannel : byte { [JsonProperty(Required = Required.DisallowNull)] internal bool Statistics { get; private set; } = true; + // TODO: Please remove me immediately after https://github.com/SteamRE/SteamKit/issues/254 gets fixed + [JsonProperty(Required = Required.DisallowNull)] + internal bool HackIgnoreMachineID { get; private set; } = false; + [JsonProperty(Required = Required.DisallowNull)] internal HashSet Blacklist { get; private set; } = new HashSet(GlobalBlacklist); diff --git a/ArchiSteamFarm/config/ASF.json b/ArchiSteamFarm/config/ASF.json index 6b8c9dbb362b9..8580aeb4bf154 100644 --- a/ArchiSteamFarm/config/ASF.json +++ b/ArchiSteamFarm/config/ASF.json @@ -13,6 +13,7 @@ "WCFHostname": "localhost", "WCFPort": 1242, "Statistics": true, + "HackIgnoreMachineID": false, "Blacklist": [ 267420, 303700,