From bde0fe4ab3350fc1b135bbefd2db8031bcb4fef3 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Thu, 19 Jan 2017 19:11:00 +0000 Subject: [PATCH 1/3] Allow login during setup using a provided email or 2FA code --- Program.cs | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/Program.cs b/Program.cs index 8e4919c..535a67b 100644 --- a/Program.cs +++ b/Program.cs @@ -325,10 +325,29 @@ namespace SteamGuard var password = Console.ReadLine(); UserLogin login = new UserLogin(username, password); - Console.Write($"Logging in {username}... "); - LoginResult loginResult = login.DoLogin(); - Console.WriteLine(loginResult); - if (!login.LoggedIn) return; + string emailCode = null, twoFactorCode = null; + while (true) + { + login.EmailCode = emailCode; + login.TwoFactorCode = twoFactorCode; + Console.Write($"Logging in {username}... "); + LoginResult loginResult = login.DoLogin(); + Console.WriteLine(loginResult); + if (loginResult == LoginResult.NeedEmail) + { + Console.Write("Email code: "); + emailCode = Console.ReadLine(); + continue; + } + else if (loginResult == LoginResult.Need2FA) + { + Console.Write("2FA code: "); + twoFactorCode = Console.ReadLine(); + continue; + } + if (!login.LoggedIn) return; + break; + } AuthenticatorLinker linker = new AuthenticatorLinker(login.Session); AuthenticatorLinker.LinkResult linkResult = AuthenticatorLinker.LinkResult.GeneralFailure; From a252a4b0199bb7797915caea142ea0887c5ac7d3 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Thu, 19 Jan 2017 19:11:28 +0000 Subject: [PATCH 2/3] Allow removing the existing authenticator using a revocation code --- Program.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Program.cs b/Program.cs index 535a67b..9fb3114 100644 --- a/Program.cs +++ b/Program.cs @@ -377,8 +377,22 @@ namespace SteamGuard Console.WriteLine("error: Unable to add your phone number. Steam returned GeneralFailure"); return; case AuthenticatorLinker.LinkResult.AuthenticatorPresent: - Console.WriteLine("error: Can't link authenticator, remove the previous authenticator."); - return; + Console.WriteLine("An authenticator is already present."); + Console.WriteLine("If you have the revocation code (Rxxxxx), this program can remove it for you."); + Console.Write("Would you like to remove the current authenticator using your revocation code? (y/n) "); + var answer = Console.ReadLine(); + if (answer != "y") + continue; + Console.Write("Revocation code (Rxxxxx): "); + var revocationCode = Console.ReadLine(); + var account = new SteamGuardAccount(); + account.Session = login.Session; + account.RevocationCode = revocationCode; + if (account.DeactivateAuthenticator()) + Console.WriteLine("Successfully deactivated the current authenticator."); + else + Console.WriteLine("Deactivating the current authenticator was unsuccessful."); + continue; default: Console.WriteLine($"error: Unexpected linker result: {linkResult}"); return; From bdba870c9e053ee5f17f7f3832f1b2701a37cca8 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Thu, 19 Jan 2017 19:21:41 +0000 Subject: [PATCH 3/3] Fix setup without a passkey for new manifests PromptSetupPassKey was never being called with inAccountSetupProcess=true. --- Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Program.cs b/Program.cs index 9fb3114..d99ca7a 100644 --- a/Program.cs +++ b/Program.cs @@ -403,7 +403,7 @@ namespace SteamGuard if (Manifest.Entries.Count == 0) { Console.WriteLine("Looks like we are setting up your first account."); - passKey = Manifest.PromptSetupPassKey(); + passKey = Manifest.PromptSetupPassKey(true); } else if (Manifest.Entries.Count > 0 && Manifest.Encrypted) {