From 7faa939af32724f7307fceea52a6864c69030a2b Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Tue, 29 Mar 2022 19:19:22 -0500 Subject: [PATCH] New: (FlareSolverr) DDOS Guard Support (based on Flaresolverr b62c203f96222602964a291b845e4d16c1a0d43a) --- .../FlareSolverr/FlareSolverr.cs | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverr.cs b/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverr.cs index 23e682715..1e78acd6f 100644 --- a/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverr.cs +++ b/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverr.cs @@ -70,7 +70,7 @@ namespace NzbDrone.Core.IndexerProxies.FlareSolverr InjectCookies(newRequest, result); - //Request again with User-Agent and Cookies from Flaresolvrr + //Request again with User-Agent and Cookies from Flaresolverr var finalResponse = _httpClient.Execute(newRequest); return finalResponse; @@ -82,9 +82,25 @@ namespace NzbDrone.Core.IndexerProxies.FlareSolverr if (response.StatusCode.Equals(HttpStatusCode.ServiceUnavailable) || response.StatusCode.Equals(HttpStatusCode.Forbidden)) { - // check response headers - return response.Headers.Any(i => - i.Key != null && i.Key.ToLower() == "server" && CloudflareServerNames.Contains(i.Value.ToLower())); + { + // check response headers for CloudFlare + if (response.Headers.Any(i => + i.Key != null && i.Key.ToLower() == "server" && CloudflareServerNames.Contains(i.Value.ToLower()))) + { + return true; + } + + return false; + } + } + + // detect Custom CloudFlare/DDOS Guard - HTTP will likely return 200 so we do this outside of checking the code + if (response.Headers.Any(i => + i.Key != null && i.Key.ToLower() == "Accept-Encoding,User-Agent") && + response.Headers.ContentType.ToString() == "" && + response.Content.ToLower().Contains("ddos")) + { + return true; } return false;