Skip to content

Commit

Permalink
Add workaround for broken GenerateMachineID(), #154
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Mar 14, 2016
1 parent c189b39 commit 4181f3b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
30 changes: 30 additions & 0 deletions ArchiSteamFarm/ArchiHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,36 @@ internal async Task<PurchaseResponseCallback> 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<CMsgClientLogon>(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);
}

/*
_ _ _ _
| | | | __ _ _ __ __| || | ___ _ __ ___
Expand Down
17 changes: 17 additions & 0 deletions ArchiSteamFarm/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions ArchiSteamFarm/GlobalConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint> Blacklist { get; private set; } = new HashSet<uint>(GlobalBlacklist);

Expand Down
1 change: 1 addition & 0 deletions ArchiSteamFarm/config/ASF.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"WCFHostname": "localhost",
"WCFPort": 1242,
"Statistics": true,
"HackIgnoreMachineID": false,
"Blacklist": [
267420,
303700,
Expand Down

0 comments on commit 4181f3b

Please sign in to comment.