diff --git a/ArchiSteamFarm/ArchiHandler.cs b/ArchiSteamFarm/ArchiHandler.cs index 390a6d197..78c408cc0 100644 --- a/ArchiSteamFarm/ArchiHandler.cs +++ b/ArchiSteamFarm/ArchiHandler.cs @@ -180,60 +180,5 @@ namespace ArchiSteamFarm { Client.PostCallback(new NotificationCallback(notification)); } } - - // TODO: Please remove me entirely once https://github.com/SteamRE/SteamKit/pull/217 gets merged - internal void HackedLogOn(uint id, SteamUser.LogOnDetails details) { - if (details == null) { - throw new ArgumentNullException("details"); - } - - if (string.IsNullOrEmpty(details.Username) || (string.IsNullOrEmpty(details.Password) && string.IsNullOrEmpty(details.LoginKey))) { - throw new ArgumentException("LogOn requires a username and password to be set in 'details'."); - } - - if (!string.IsNullOrEmpty(details.LoginKey) && !details.ShouldRememberPassword) { - // Prevent consumers from screwing this up. - // If should_remember_password is false, the login_key is ignored server-side. - // The inverse is not applicable (you can log in with should_remember_password and no login_key). - throw new ArgumentException("ShouldRememberPassword is required to be set to true in order to use LoginKey."); - } - - if (!Client.IsConnected) { - return; - } - - var logon = new ClientMsgProtobuf(EMsg.ClientLogon); - - SteamID steamId = new SteamID(details.AccountID, details.AccountInstance, Client.ConnectedUniverse, EAccountType.Individual); - - logon.ProtoHeader.client_sessionid = 0; - logon.ProtoHeader.steamid = steamId.ConvertToUInt64(); - - logon.Body.obfustucated_private_ip = id; - - 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; - - // steam guard - 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); - } } } \ No newline at end of file diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index dd180efe4..f6eb73a99 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -35,7 +35,9 @@ using System.Xml; namespace ArchiSteamFarm { internal sealed class Bot { + private const ulong ArchiSCFarmGroup = 103582791440160998; private const ushort CallbackSleep = 500; // In miliseconds + private const uint LoginID = 0xBAADF00D; // This must be the same for all ASF bots and all ASF processes private static readonly ConcurrentDictionary Bots = new ConcurrentDictionary(); @@ -548,11 +550,11 @@ namespace ArchiSteamFarm { SteamPassword = Program.GetUserInput(BotName, Program.EUserInputType.Password); } - // TODO: We should use SteamUser.LogOn with proper LoginID once https://github.com/SteamRE/SteamKit/pull/217 gets merged - ArchiHandler.HackedLogOn(Program.UniqueID, new SteamUser.LogOnDetails { + SteamUser.LogOn(new SteamUser.LogOnDetails { Username = SteamLogin, Password = SteamPassword, AuthCode = AuthCode, + LoginID = LoginID, LoginKey = LoginKey, TwoFactorCode = TwoFactorAuth, SentryFileHash = sentryHash, @@ -777,8 +779,8 @@ namespace ArchiSteamFarm { } if (Statistics) { - await ArchiWebHandler.JoinClan(Program.ArchiSCFarmGroup).ConfigureAwait(false); - SteamFriends.JoinChat(Program.ArchiSCFarmGroup); + await ArchiWebHandler.JoinClan(ArchiSCFarmGroup).ConfigureAwait(false); + SteamFriends.JoinChat(ArchiSCFarmGroup); } Trading.CheckTrades(); diff --git a/ArchiSteamFarm/Program.cs b/ArchiSteamFarm/Program.cs index ebb2f4c76..3b54a5339 100644 --- a/ArchiSteamFarm/Program.cs +++ b/ArchiSteamFarm/Program.cs @@ -43,8 +43,6 @@ namespace ArchiSteamFarm { } private const string LatestGithubReleaseURL = "https://api.github.com/repos/JustArchi/ArchiSteamFarm/releases/latest"; - - internal const ulong ArchiSCFarmGroup = 103582791440160998; internal const string ConfigDirectoryPath = "config"; private static readonly SemaphoreSlim SteamSemaphore = new SemaphoreSlim(1); @@ -55,7 +53,6 @@ namespace ArchiSteamFarm { private static readonly object ConsoleLock = new object(); //private static readonly string ExeName = AssemblyName.Name + ".exe"; - internal static readonly uint UniqueID = (uint) Utilities.Random.Next(); internal static readonly string Version = AssemblyName.Version.ToString(); internal static bool ConsoleIsBusy { get; private set; } = false; diff --git a/ArchiSteamFarm/Utilities.cs b/ArchiSteamFarm/Utilities.cs index e2eb56b0d..24f264a96 100644 --- a/ArchiSteamFarm/Utilities.cs +++ b/ArchiSteamFarm/Utilities.cs @@ -22,14 +22,11 @@ */ -using System; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace ArchiSteamFarm { internal static class Utilities { - internal static readonly Random Random = new Random(); - internal static async Task SleepAsync(int miliseconds) { await Task.Delay(miliseconds).ConfigureAwait(false); }