From a3b3fbc3aef630cffa10f10c87abf55640f06e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CCarson?= Date: Mon, 12 Oct 2020 11:49:26 -0400 Subject: [PATCH 1/4] add test maFiles folder to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 739e65f..277cae8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,6 @@ bin/ obj/ .idea/ SteamAuth/SteamAuth/packages/ +test_maFiles/ *.deb \ No newline at end of file From 972677f515509ce1f81d996665b5252046990e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CCarson?= Date: Mon, 12 Oct 2020 12:35:31 -0400 Subject: [PATCH 2/4] update steamauth --- SteamAuth | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SteamAuth b/SteamAuth index 2f9f8b9..e061952 160000 --- a/SteamAuth +++ b/SteamAuth @@ -1 +1 @@ -Subproject commit 2f9f8b92cd365414196b90cae3ab25ff430a4fab +Subproject commit e0619528fbe8f4c6f74135283b3f991219e73cf4 From 812683c6242255f151888644e58861a49728a921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CCarson?= Date: Mon, 12 Oct 2020 12:38:22 -0400 Subject: [PATCH 3/4] refactor setup login, add captcha support --- Program.cs | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/Program.cs b/Program.cs index 851bb2d..73fde2f 100644 --- a/Program.cs +++ b/Program.cs @@ -364,29 +364,40 @@ namespace SteamGuard var password = Utils.ReadLineSecure(); UserLogin login = new UserLogin(username, password); - string emailCode = null, twoFactorCode = null; - while (true) + LoginResult loginResult; + do { - login.EmailCode = emailCode; - login.TwoFactorCode = twoFactorCode; Console.Write($"Logging in {username}... "); - LoginResult loginResult = login.DoLogin(); + loginResult = login.DoLogin(); Console.WriteLine(loginResult); - if (loginResult == LoginResult.NeedEmail) + switch (loginResult) { - Console.Write("Email code: "); - emailCode = Console.ReadLine(); - continue; + case LoginResult.NeedEmail: + Console.Write("Email code: "); + login.EmailCode = Console.ReadLine(); + break; + case LoginResult.Need2FA: + Console.Write("2FA code: "); + login.TwoFactorCode = Console.ReadLine(); + break; + case LoginResult.NeedCaptcha: + Console.WriteLine($"Please open: https://steamcommunity.com/public/captcha.php?gid={login.CaptchaGID}"); + Console.Write("Captcha text: "); + login.CaptchaText = Console.ReadLine(); + break; + case LoginResult.BadCredentials: + Console.WriteLine("error: Bad Credentials"); + return; + case LoginResult.TooManyFailedLogins: + Console.WriteLine("error: Too many failed logins. Wait a bit before trying again."); + return; + case LoginResult.LoginOkay: + break; + default: + Console.WriteLine($"Unknown login result: {loginResult}"); + break; } - else if (loginResult == LoginResult.Need2FA) - { - Console.Write("2FA code: "); - twoFactorCode = Console.ReadLine(); - continue; - } - if (!login.LoggedIn) return; - break; - } + } while (loginResult != LoginResult.LoginOkay); AuthenticatorLinker linker = new AuthenticatorLinker(login.Session); AuthenticatorLinker.LinkResult linkResult = AuthenticatorLinker.LinkResult.GeneralFailure; From 08ba664bfce4d1953d987607dc9a71c6b9618d04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CCarson?= Date: Mon, 12 Oct 2020 13:12:11 -0400 Subject: [PATCH 4/4] handle MustConfirmEmail, fixes #41 --- Program.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Program.cs b/Program.cs index 73fde2f..c4eab85 100644 --- a/Program.cs +++ b/Program.cs @@ -418,6 +418,10 @@ namespace SteamGuard linker.PhoneNumber = phonenumber; } while (!PhoneNumberOkay(phonenumber)); break; + case AuthenticatorLinker.LinkResult.MustConfirmEmail: + Console.WriteLine("Check your email. Before continuing, click the link in the email to confirm your phone number. Press enter to continue..."); + Console.ReadLine(); + break; case AuthenticatorLinker.LinkResult.MustRemovePhoneNumber: linker.PhoneNumber = null; break;