From 67c2e9c6d3726dc7577c885f188410a46ffe853d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Domeradzki?= Date: Mon, 27 Jan 2025 19:57:42 +0100 Subject: [PATCH] Record input from the user in the logs as well --- ArchiSteamFarm/Localization/Strings.resx | 4 ++++ ArchiSteamFarm/NLog/Logging.cs | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/ArchiSteamFarm/Localization/Strings.resx b/ArchiSteamFarm/Localization/Strings.resx index 08cfbf99c..a0329be5d 100644 --- a/ArchiSteamFarm/Localization/Strings.resx +++ b/ArchiSteamFarm/Localization/Strings.resx @@ -792,4 +792,8 @@ Process uptime: {1} Custom plugins have been registered for automatic updates. ASF team would like to remind you that, for your own safety, you should enable automatic updates only from trusted parties. If you didn't intend to do this, you can disable plugin updates in ASF global config. + + Input: {0} + {0} will be replaced by text input from the user. + diff --git a/ArchiSteamFarm/NLog/Logging.cs b/ArchiSteamFarm/NLog/Logging.cs index 6f52ca101..4237c70c7 100644 --- a/ArchiSteamFarm/NLog/Logging.cs +++ b/ArchiSteamFarm/NLog/Logging.cs @@ -106,6 +106,8 @@ internal static class Logging { Console.Write(cryptKeyText); result = ConsoleReadLineMasked(); + ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(new string('*', result.Length))); + break; case ASF.EUserInputType.DeviceConfirmation: string deviceConfirmationText = Bot.FormatBotResponse(Strings.UserInputDeviceConfirmation, botName); @@ -116,6 +118,8 @@ internal static class Logging { Console.Write(deviceConfirmationText); result = ConsoleReadLine(); + ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result)); + if (string.IsNullOrEmpty(result) || result.Equals("Y", StringComparison.OrdinalIgnoreCase) || result.Equals("N", StringComparison.OrdinalIgnoreCase)) { break; } @@ -130,6 +134,8 @@ internal static class Logging { Console.Write(loginText); result = ConsoleReadLine(); + ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result)); + break; case ASF.EUserInputType.Password: string passwordText = Bot.FormatBotResponse(Strings.UserInputSteamPassword, botName); @@ -139,6 +145,8 @@ internal static class Logging { Console.Write(passwordText); result = ConsoleReadLineMasked(); + ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(new string('*', result.Length))); + break; case ASF.EUserInputType.SteamGuard: string steamGuardText = Bot.FormatBotResponse(Strings.UserInputSteamGuard, botName); @@ -148,6 +156,8 @@ internal static class Logging { Console.Write(steamGuardText); result = ConsoleReadLine(); + ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result)); + break; case ASF.EUserInputType.SteamParentalCode: string steamParentalCodeText = Bot.FormatBotResponse(Strings.UserInputSteamParentalCode, botName); @@ -157,6 +167,8 @@ internal static class Logging { Console.Write(steamParentalCodeText); result = ConsoleReadLineMasked(); + ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(new string('*', result.Length))); + break; case ASF.EUserInputType.TwoFactorAuthentication: string twoFactorAuthenticationText = Bot.FormatBotResponse(Strings.UserInputSteam2FA, botName); @@ -166,6 +178,8 @@ internal static class Logging { Console.Write(twoFactorAuthenticationText); result = ConsoleReadLine(); + ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result)); + break; default: ASF.ArchiLogger.LogGenericError(Strings.FormatWarningUnknownValuePleaseReport(nameof(userInputType), userInputType)); @@ -423,6 +437,8 @@ internal static class Logging { Console.Write(enterCommandText); string? command = ConsoleReadLine(); + ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(command)); + if (string.IsNullOrEmpty(command)) { continue; }