Skip to content

Commit 67c2e9c

Browse files
committed
Record input from the user in the logs as well
1 parent ec151c3 commit 67c2e9c

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

ArchiSteamFarm/Localization/Strings.resx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,4 +792,8 @@ Process uptime: {1}</value>
792792
<data name="CustomPluginUpdatesEnabled" xml:space="preserve">
793793
<value>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.</value>
794794
</data>
795+
<data name="Input" xml:space="preserve">
796+
<value>Input: {0}</value>
797+
<comment>{0} will be replaced by text input from the user.</comment>
798+
</data>
795799
</root>

ArchiSteamFarm/NLog/Logging.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ internal static void EnableTraceLogging() {
106106
Console.Write(cryptKeyText);
107107
result = ConsoleReadLineMasked();
108108

109+
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(new string('*', result.Length)));
110+
109111
break;
110112
case ASF.EUserInputType.DeviceConfirmation:
111113
string deviceConfirmationText = Bot.FormatBotResponse(Strings.UserInputDeviceConfirmation, botName);
@@ -116,6 +118,8 @@ internal static void EnableTraceLogging() {
116118
Console.Write(deviceConfirmationText);
117119
result = ConsoleReadLine();
118120

121+
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result));
122+
119123
if (string.IsNullOrEmpty(result) || result.Equals("Y", StringComparison.OrdinalIgnoreCase) || result.Equals("N", StringComparison.OrdinalIgnoreCase)) {
120124
break;
121125
}
@@ -130,6 +134,8 @@ internal static void EnableTraceLogging() {
130134
Console.Write(loginText);
131135
result = ConsoleReadLine();
132136

137+
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result));
138+
133139
break;
134140
case ASF.EUserInputType.Password:
135141
string passwordText = Bot.FormatBotResponse(Strings.UserInputSteamPassword, botName);
@@ -139,6 +145,8 @@ internal static void EnableTraceLogging() {
139145
Console.Write(passwordText);
140146
result = ConsoleReadLineMasked();
141147

148+
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(new string('*', result.Length)));
149+
142150
break;
143151
case ASF.EUserInputType.SteamGuard:
144152
string steamGuardText = Bot.FormatBotResponse(Strings.UserInputSteamGuard, botName);
@@ -148,6 +156,8 @@ internal static void EnableTraceLogging() {
148156
Console.Write(steamGuardText);
149157
result = ConsoleReadLine();
150158

159+
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result));
160+
151161
break;
152162
case ASF.EUserInputType.SteamParentalCode:
153163
string steamParentalCodeText = Bot.FormatBotResponse(Strings.UserInputSteamParentalCode, botName);
@@ -157,6 +167,8 @@ internal static void EnableTraceLogging() {
157167
Console.Write(steamParentalCodeText);
158168
result = ConsoleReadLineMasked();
159169

170+
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(new string('*', result.Length)));
171+
160172
break;
161173
case ASF.EUserInputType.TwoFactorAuthentication:
162174
string twoFactorAuthenticationText = Bot.FormatBotResponse(Strings.UserInputSteam2FA, botName);
@@ -166,6 +178,8 @@ internal static void EnableTraceLogging() {
166178
Console.Write(twoFactorAuthenticationText);
167179
result = ConsoleReadLine();
168180

181+
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(result));
182+
169183
break;
170184
default:
171185
ASF.ArchiLogger.LogGenericError(Strings.FormatWarningUnknownValuePleaseReport(nameof(userInputType), userInputType));
@@ -423,6 +437,8 @@ private static async Task HandleConsoleInteractively() {
423437
Console.Write(enterCommandText);
424438
string? command = ConsoleReadLine();
425439

440+
ASF.ArchiLogger.LogGenericInfo(Strings.FormatInput(command));
441+
426442
if (string.IsNullOrEmpty(command)) {
427443
continue;
428444
}

0 commit comments

Comments
 (0)