From a6c27ece310b2771b6fbd063fdec157a4a55a46b Mon Sep 17 00:00:00 2001 From: Guiorgy Date: Thu, 25 Nov 2021 15:58:05 +0400 Subject: [PATCH] match number of * characters with the length of password in the debug log --- Service.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Service.cs b/Service.cs index 0cdc079..7044abb 100644 --- a/Service.cs +++ b/Service.cs @@ -64,7 +64,9 @@ private void ReadJsonConfig() { DebugLog($"Loading configuration \"{configPath}\":"); string json = File.ReadAllText(configPath); - DebugLog(new Regex("(\"password\":)(.*?)(,|\n|\r)").Replace(json, "$1\"********\"$3")); + DebugLog(Regex.Replace(json, + "(\"password\"\\s*:\\s*\")(.*?)(\")(,|\n|\r)", + m => m.Groups[1].Value + new string('*', m.Groups[2].Length) + '"' + m.Groups[4].Value)); configurations = JsonConvert.DeserializeObject>(json); DebugLog("Configuration loaded:"); foreach (var cfg in configurations)