From 90b5947a19299fc1790f39e2e4e41bad4d39720e Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Thu, 14 Apr 2016 20:44:49 +0200 Subject: [PATCH] Fixed Deluge and BTN cleanse password logic. --- .../InstrumentationTests/CleanseLogMessageFixture.cs | 2 ++ src/NzbDrone.Common/Instrumentation/CleanseLogMessage.cs | 4 ++++ src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs | 3 +-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs b/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs index 34857fed5..4f1b549b2 100644 --- a/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs +++ b/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs @@ -39,8 +39,10 @@ namespace NzbDrone.Common.Test.InstrumentationTests // Deluge [TestCase(@",{""download_location"": ""C:\Users\\mySecret mySecret\\Downloads""}")] [TestCase(@",{""download_location"": ""/home/mySecret/Downloads""}")] + [TestCase(@"auth.login(""mySecret"")")] // BroadcastheNet [TestCase(@"method: ""getTorrents"", ""params"": [ ""mySecret"",")] + [TestCase(@"getTorrents(""mySecret"", [asdfasdf], 100, 0)")] [TestCase(@"""DownloadURL"":""https:\/\/broadcasthe.net\/torrents.php?action=download&id=123&authkey=mySecret&torrent_pass=mySecret""")] public void should_clean_message(string message) { diff --git a/src/NzbDrone.Common/Instrumentation/CleanseLogMessage.cs b/src/NzbDrone.Common/Instrumentation/CleanseLogMessage.cs index e0dd27eb2..ef33968e5 100644 --- a/src/NzbDrone.Common/Instrumentation/CleanseLogMessage.cs +++ b/src/NzbDrone.Common/Instrumentation/CleanseLogMessage.cs @@ -31,8 +31,12 @@ namespace NzbDrone.Common.Instrumentation new Regex(@"\[""[a-z._]*(username|password)"",\d,""(?[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase), new Regex(@"\[""(boss_key|boss_key_salt|proxy\.proxy)"",\d,""(?[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase), + // Deluge + new Regex(@"auth.login\(""(?[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase), + // BroadcastheNet new Regex(@"""?method""?\s*:\s*""(getTorrents)"",\s*""?params""?\s*:\s*\[\s*""(?[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase), + new Regex(@"getTorrents\(""(?[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase), new Regex(@"(?<=\?|&)(authkey|torrent_pass)=(?[^&=]+?)(?=""|&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase) }; diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs index 6239b4aa6..fd2ae5322 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs @@ -92,7 +92,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge public string AddTorrentFromFile(string filename, byte[] fileContent, DelugeSettings settings) { - var response = ProcessRequest(settings, "core.add_torrent_file", filename, Convert.ToBase64String(fileContent), new JObject()); + var response = ProcessRequest(settings, "core.add_torrent_file", filename, fileContent, new JObject()); return response; } @@ -256,7 +256,6 @@ namespace NzbDrone.Core.Download.Clients.Deluge _authCookieCache.Remove(authKey); var authLoginRequest = requestBuilder.Call("auth.login", settings.Password).Build(); - authLoginRequest.ContentSummary = "auth.login(\"(removed)\")"; var response = _httpClient.Execute(authLoginRequest); var result = Json.Deserialize>(response.Content); if (!result.Result)