From 47a0a4658bbb95b128bc39bb0b658868003a9c08 Mon Sep 17 00:00:00 2001
From: M Sasan MH
Date: Mon, 14 Oct 2024 18:27:08 +0330
Subject: [PATCH] v3.2.5
---
ConsoleAppTest/Program.cs | 12 +-
MsmhToolsClass/MsmhToolsClass.csproj | 5 +-
.../MsmhToolsClass/ExtensionsMethods.cs | 20 +-
MsmhToolsClass/MsmhToolsClass/HtmlTool.cs | 676 -------
MsmhToolsClass/MsmhToolsClass/HttpRequest.cs | 2 +-
MsmhToolsClass/MsmhToolsClass/IPRange.cs | 260 +++
MsmhToolsClass/MsmhToolsClass/JsonTool.cs | 125 +-
.../MsmhAgnosticServer/AgnosticSettings.cs | 4 +-
.../MsmhAgnosticServer/CommonTools.cs | 82 +-
.../DnsServer/DnsClient/Bootstrap.cs | 8 +-
.../DnsServer/DnsClient/DNSCryptClient.cs | 2 +-
.../DnsServer/DnsClient/DNSCryptDns.cs | 411 -----
.../DnsServer/DnsClient/DnsClient.cs | 30 +
.../DnsServer/DnsClient/DoHDns.cs | 78 -
.../DnsServer/DnsClient/DoQDns.cs | 52 -
.../DnsServer/DnsClient/DoTClient.cs | 8 +-
.../DnsServer/DnsClient/DoTDns.cs | 106 --
.../DnsServer/DnsClient/SystemDns.cs | 55 -
.../DnsServer/DnsClient/TcpPlainClient.cs | 2 +-
.../DnsServer/DnsClient/TcpPlainDns.cs | 79 -
.../DnsServer/DnsClient/UdpPlainDns.cs | 58 -
.../DnsServer/DnsTool/DnsReader.cs | 2 +-
.../MsmhAgnosticServer/DnsServer/DnsTunnel.cs | 117 +-
.../MsmhAgnosticServer/MsmhAgnosticServer.cs | 29 +-
.../MsmhAgnosticServer/Programs/DnsRules.cs | 180 --
.../Programs/DnsRules_Get.cs | 129 --
.../MsmhAgnosticServer/Programs/ProxyRules.cs | 301 ---
.../Programs/ProxyRules_ConnectToUpStream.cs | 26 -
.../Programs/ProxyRules_Get.cs | 186 --
.../MsmhAgnosticServer/Programs/Rules.cs | 769 +++++++-
.../MsmhAgnosticServer/Programs/Rules_Get.cs | 228 +++
.../MsmhAgnosticServer/Programs/Rules_Init.cs | 228 +++
.../ProxyServer/ApplyPrograms.cs | 444 +++--
.../ProxyServer/ProxyClient.cs | 4 +-
.../ProxyServer/ProxyClientSSL.cs | 33 +-
.../ProxyServer/ProxyRequest.cs | 10 +-
.../ProxyServer/ProxyRequestsCache.cs | 8 +-
.../ProxyServer/ProxyTunnel.cs | 53 +-
MsmhToolsClass/MsmhToolsClass/NetworkTool.cs | 173 +-
.../MsmhToolsClass/ProcessConsole.cs | 53 +-
.../MsmhToolsClass/ProcessManager.cs | 43 +-
.../MsmhToolsClass/ProcessMonitor.cs | 19 +-
MsmhToolsClass/MsmhToolsClass/StringTool.cs | 564 ------
MsmhToolsClass/MsmhToolsClass/Texts.cs | 30 -
MsmhToolsClass/MsmhToolsClass/WebAPI.cs | 169 +-
.../MsmhToolsWinFormsClass/Controllers.cs | 116 +-
SDCAgnosticServer/ConsoleTools.cs | 1 -
SDCAgnosticServer/ExecuteCommands.cs | 264 +--
SDCAgnosticServer/Help.cs | 110 +-
SDCAgnosticServer/Profiles.cs | 14 +-
SDCAgnosticServer/Program.cs | 96 +-
.../PublishProfiles/X64.pubxml.user | 2 +-
.../PublishProfiles/X86.pubxml.user | 2 +-
SDCAgnosticServer/SDCAgnosticServer.csproj | 2 +-
.../SDCAgnosticServer.csproj.user | 2 +-
SDCAgnosticServer/Structs.cs | 17 +-
.../PublishProfiles/X64.pubxml.user | 2 +-
.../PublishProfiles/X86.pubxml.user | 2 +-
SDCLookup/SDCLookup.csproj | 2 +-
SecureDNSClient/Forms/Assets.cs | 209 +++
SecureDNSClient/Forms/Buttons.cs | 33 +-
SecureDNSClient/Forms/Certificate.cs | 2 +-
SecureDNSClient/Forms/Connect.cs | 65 +-
.../Forms/ConnectToFPUsingGoodbyeDPI.cs | 68 +-
.../Forms/ConnectToFPUsingProxyDPI.cs | 98 +-
.../Forms/ConnectToServersUsingProxy.cs | 79 +-
.../Forms/ConnectToWorkingServers.cs | 73 +-
SecureDNSClient/Forms/ContextMenuStripIcon.cs | 14 +-
SecureDNSClient/Forms/Debug.cs | 6 +-
SecureDNSClient/Forms/DefaultSettings.cs | 26 +-
.../Forms/DnsServersSubscription.cs | 4 +-
SecureDNSClient/Forms/Events.cs | 27 +-
.../Forms/FormIpScanner.Designer.cs | 96 +-
SecureDNSClient/Forms/FormIpScanner.cs | 136 +-
SecureDNSClient/Forms/FormMain.Designer.cs | 768 +++++---
SecureDNSClient/Forms/FormMain.cs | 50 +-
SecureDNSClient/Forms/FormMain.resx | 16 -
SecureDNSClient/Forms/InitializeStatements.cs | 8 +-
SecureDNSClient/Forms/Methods.cs | 1000 +++++-----
SecureDNSClient/Forms/QuickConnect.cs | 6 +-
SecureDNSClient/Forms/ScreenHighDpiScale.cs | 32 +-
SecureDNSClient/Forms/SetDNS.cs | 10 +-
SecureDNSClient/Forms/ShareViaProxy.cs | 155 +-
.../Forms/ShareViaProxy_RulesReader.cs | 25 +-
SecureDNSClient/Forms/UpdateStatusAuto.cs | 24 +-
SecureDNSClient/HostToCompany.txt | 1612 ++++++++++++++++-
.../NecessaryFiles/Resource1.Designer.cs | 12 +-
SecureDNSClient/NecessaryFiles/versions.txt | 12 +-
.../PublishProfiles/X64.pubxml.user | 2 +-
.../PublishProfiles/X86.pubxml.user | 2 +-
SecureDNSClient/SecureDNS/IpScanner.cs | 292 ++-
SecureDNSClient/SecureDNS/SecureDNS.cs | 16 +-
SecureDNSClient/SecureDNS/SetDnsOnNic.cs | 56 +-
SecureDNSClient/SecureDNS/SettingsWindow.cs | 10 +-
SecureDNSClient/SecureDNSClient.csproj | 2 +-
SecureDNSClient/SecureDNSClient.csproj.user | 3 +
.../PublishProfiles/X64.pubxml.user | 2 +-
.../PublishProfiles/X86.pubxml.user | 2 +-
.../SecureDNSClientPortable.csproj | 2 +-
.../SecureDNSClientPortable.csproj.user | 2 +-
100 files changed, 6267 insertions(+), 5295 deletions(-)
delete mode 100644 MsmhToolsClass/MsmhToolsClass/HtmlTool.cs
create mode 100644 MsmhToolsClass/MsmhToolsClass/IPRange.cs
delete mode 100644 MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DNSCryptDns.cs
delete mode 100644 MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoHDns.cs
delete mode 100644 MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoQDns.cs
delete mode 100644 MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoTDns.cs
delete mode 100644 MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/SystemDns.cs
delete mode 100644 MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/TcpPlainDns.cs
delete mode 100644 MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/UdpPlainDns.cs
delete mode 100644 MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/DnsRules.cs
delete mode 100644 MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/DnsRules_Get.cs
delete mode 100644 MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/ProxyRules.cs
delete mode 100644 MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/ProxyRules_ConnectToUpStream.cs
delete mode 100644 MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/ProxyRules_Get.cs
create mode 100644 MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/Rules_Get.cs
create mode 100644 MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/Rules_Init.cs
delete mode 100644 MsmhToolsClass/MsmhToolsClass/StringTool.cs
delete mode 100644 MsmhToolsClass/MsmhToolsClass/Texts.cs
create mode 100644 SecureDNSClient/Forms/Assets.cs
diff --git a/ConsoleAppTest/Program.cs b/ConsoleAppTest/Program.cs
index d53efcd..cb090c6 100644
--- a/ConsoleAppTest/Program.cs
+++ b/ConsoleAppTest/Program.cs
@@ -69,13 +69,13 @@ static async Task Main(string[] args)
fragment.Set(AgnosticProgram.Fragment.Mode.Program, 50, AgnosticProgram.Fragment.ChunkMode.SNI, 5, 2, 1);
server1.EnableFragment(fragment);
- AgnosticProgram.DnsRules dnsRules1 = new();
- dnsRules1.Set(AgnosticProgram.DnsRules.Mode.Text, dnsRulesContent);
- server1.EnableDnsRules(dnsRules1);
+ AgnosticProgram.Rules dnsRules1 = new();
+ await dnsRules1.SetAsync(AgnosticProgram.Rules.Mode.Text, dnsRulesContent);
+ server1.EnableRules(dnsRules1);
- AgnosticProgram.ProxyRules proxyRules1 = new();
- proxyRules1.Set(AgnosticProgram.ProxyRules.Mode.Text, proxyRulesContent);
- server1.EnableProxyRules(proxyRules1);
+ AgnosticProgram.Rules proxyRules1 = new();
+ await proxyRules1.SetAsync(AgnosticProgram.Rules.Mode.Text, proxyRulesContent);
+ server1.EnableRules(proxyRules1);
List dnsServers2 = new()
diff --git a/MsmhToolsClass/MsmhToolsClass.csproj b/MsmhToolsClass/MsmhToolsClass.csproj
index 05cc147..21d0524 100644
--- a/MsmhToolsClass/MsmhToolsClass.csproj
+++ b/MsmhToolsClass/MsmhToolsClass.csproj
@@ -5,7 +5,7 @@
enable
enable
AnyCPU;x64;x86
- $(VersionPrefix)1.6.5
+ $(VersionPrefix)1.6.6
MSasanMH
@@ -190,11 +190,12 @@
+
-
+
diff --git a/MsmhToolsClass/MsmhToolsClass/ExtensionsMethods.cs b/MsmhToolsClass/MsmhToolsClass/ExtensionsMethods.cs
index d3aac0b..4ea6ac4 100644
--- a/MsmhToolsClass/MsmhToolsClass/ExtensionsMethods.cs
+++ b/MsmhToolsClass/MsmhToolsClass/ExtensionsMethods.cs
@@ -345,6 +345,24 @@ public static List> SplitToLists(this List list, int nSize)
}
//-----------------------------------------------------------------------------------
public static List SplitToLines(this string s)
+ {
+ List lines = new();
+
+ try
+ {
+ s = s.ReplaceLineEndings();
+ string[] split = s.Split(Environment.NewLine);
+ if (split.Length > 0) lines = split.ToList();
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("ExtensionsMethods SplitToLines: " + ex.Message);
+ }
+
+ return lines;
+ }
+
+ public static List SplitToLinesOld(this string s)
{
// Original non-optimized version: return source.Replace("\r\r\n", "\n").Replace("\r\n", "\n").Replace('\r', '\n').Replace('\u2028', '\n').Split('\n');
List lines = new();
@@ -400,7 +418,7 @@ public static List SplitToLines(this string s)
}
catch (Exception ex)
{
- Debug.WriteLine("ExtensionsMethods ToString: " + ex.Message);
+ Debug.WriteLine("ExtensionsMethods SplitToLinesOld: " + ex.Message);
}
return lines;
diff --git a/MsmhToolsClass/MsmhToolsClass/HtmlTool.cs b/MsmhToolsClass/MsmhToolsClass/HtmlTool.cs
deleted file mode 100644
index 4d58d4b..0000000
--- a/MsmhToolsClass/MsmhToolsClass/HtmlTool.cs
+++ /dev/null
@@ -1,676 +0,0 @@
-using System;
-using System.Drawing;
-using System.Text;
-using System.Text.RegularExpressions;
-
-namespace MsmhToolsClass;
-
-public class HtmlTool
-{
- public static string RemoveHtmlFontTag(string s)
- {
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
-
- while (s.ToLower().Contains(""), startIndex + 4);
- s = s.Remove(startIndex, (endIndex - startIndex) + 1);
- }
- return s;
- }
- //-----------------------------------------------------------------------------------
- public static string? RemoveHtmlTags(string s)
- {
- if (string.IsNullOrEmpty(s))
- return null;
- //if (s == null)
- // return null;
- if (!s.Contains('<'))
- return s;
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = RemoveParagraphTag(s);
- return RemoveHtmlFontTag(s).Trim();
- }
- //-----------------------------------------------------------------------------------
- internal static string GetHtmlColorCode(Color color)
- {
- return string.Format("#{0:x2}{1:x2}{2:x2}", color.R, color.G, color.B);
- }
- //-----------------------------------------------------------------------------------
- internal static string RemoveBrackets(string inputString)
- {
- string pattern = @"^[\[\{\(]|[\]\}\)]$";
- return Regex.Replace(inputString, pattern, string.Empty).Trim();
- }
- //-----------------------------------------------------------------------------------
- internal static string RemoveParagraphTag(string s)
- {
- s = s.Replace("
", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("", string.Empty);
- s = s.Replace("
", string.Empty);
-
- while (s.ToLower().Contains("
"), startIndex + 4);
- s = s.Remove(startIndex, endIndex - startIndex + 1);
- }
- return s;
- }
- //===================================================================
- public static string TagItalic => "i";
- public static string TagBold => "b";
- public static string TagUnderline => "u";
- public static string TagFont => "font";
- public static string TagCyrillicI => "\u0456"; // Cyrillic Small Letter Byelorussian-Ukrainian i (http://graphemica.com/%D1%96)
-
- private static readonly Regex TagOpenRegex = new(@"<\s*(?:/\s*)?(\w+)[^>]*>", RegexOptions.Compiled);
-
- ///
- /// Remove all of the specified opening and closing tags from the source HTML string.
- ///
- /// The source string to search for specified HTML tags.
- /// The HTML tags to remove.
- /// A new string without the specified opening and closing tags.
- public static string RemoveOpenCloseTags(string source, params string[] tags)
- {
- if (string.IsNullOrEmpty(source) || source.IndexOf('<') < 0)
- {
- return source;
- }
-
- // This pattern matches these tag formats:
- //
- // < tag*>
- //
- // < /tag*>
- // tag*>
- // < / tag*>
- return TagOpenRegex.Replace(source, m => tags.Contains(m.Groups[1].Value, StringComparer.OrdinalIgnoreCase) ? string.Empty : m.Value);
- }
-
- ///
- /// Converts a string to an HTML-encoded string using named character references.
- ///
- /// The string to encode.
- /// An encoded string.
- public static string EncodeNamed(string source)
- {
- if (string.IsNullOrEmpty(source))
- {
- return string.Empty;
- }
-
- var encoded = new StringBuilder(source.Length);
- foreach (var ch in source)
- {
- switch (ch)
- {
- case '<':
- encoded.Append("<");
- break;
- case '>':
- encoded.Append(">");
- break;
- case '"':
- encoded.Append(""");
- break;
- case '&':
- encoded.Append("&");
- break;
- case '\'':
- encoded.Append("'");
- break;
- case ' ':
- encoded.Append(" ");
- break;
- case '–':
- encoded.Append("–");
- break;
- case '—':
- encoded.Append("—");
- break;
- case '¡':
- encoded.Append("¡");
- break;
- case '¿':
- encoded.Append("¿");
- break;
- case '“':
- encoded.Append("“");
- break;
- case '”':
- encoded.Append("”");
- break;
- case '‘':
- encoded.Append("‘");
- break;
- case '’':
- encoded.Append("’");
- break;
- case '«':
- encoded.Append("«");
- break;
- case '»':
- encoded.Append("»");
- break;
- case '¢':
- encoded.Append("¢");
- break;
- case '©':
- encoded.Append("©");
- break;
- case '÷':
- encoded.Append("÷");
- break;
- case 'µ':
- encoded.Append("µ");
- break;
- case '·':
- encoded.Append("·");
- break;
- case '¶':
- encoded.Append("¶");
- break;
- case '±':
- encoded.Append("±");
- break;
- case '€':
- encoded.Append("€");
- break;
- case '£':
- encoded.Append("£");
- break;
- case '®':
- encoded.Append("®");
- break;
- case '§':
- encoded.Append("§");
- break;
- case '™':
- encoded.Append("™");
- break;
- case '¥':
- encoded.Append("¥");
- break;
- case 'á':
- encoded.Append("á");
- break;
- case 'Á':
- encoded.Append("Á");
- break;
- case 'à':
- encoded.Append("à");
- break;
- case 'À':
- encoded.Append("À");
- break;
- case 'â':
- encoded.Append("â");
- break;
- case 'Â':
- encoded.Append("Â");
- break;
- case 'å':
- encoded.Append("å");
- break;
- case 'Å':
- encoded.Append("Å");
- break;
- case 'ã':
- encoded.Append("ã");
- break;
- case 'Ã':
- encoded.Append("Ã");
- break;
- case 'ä':
- encoded.Append("ä");
- break;
- case 'Ä':
- encoded.Append("Ä");
- break;
- case 'æ':
- encoded.Append("æ");
- break;
- case 'Æ':
- encoded.Append("Æ");
- break;
- case 'ç':
- encoded.Append("ç");
- break;
- case 'Ç':
- encoded.Append("Ç");
- break;
- case 'é':
- encoded.Append("é");
- break;
- case 'É':
- encoded.Append("É");
- break;
- case 'è':
- encoded.Append("è");
- break;
- case 'È':
- encoded.Append("È");
- break;
- case 'ê':
- encoded.Append("ê");
- break;
- case 'Ê':
- encoded.Append("Ê");
- break;
- case 'ë':
- encoded.Append("ë");
- break;
- case 'Ë':
- encoded.Append("Ë");
- break;
- case 'í':
- encoded.Append("í");
- break;
- case 'Í':
- encoded.Append("Í");
- break;
- case 'ì':
- encoded.Append("ì");
- break;
- case 'Ì':
- encoded.Append("Ì");
- break;
- case 'î':
- encoded.Append("î");
- break;
- case 'Î':
- encoded.Append("Î");
- break;
- case 'ï':
- encoded.Append("ï");
- break;
- case 'Ï':
- encoded.Append("Ï");
- break;
- case 'ñ':
- encoded.Append("ñ");
- break;
- case 'Ñ':
- encoded.Append("Ñ");
- break;
- case 'ó':
- encoded.Append("ó");
- break;
- case 'Ó':
- encoded.Append("Ó");
- break;
- case 'ò':
- encoded.Append("ò");
- break;
- case 'Ò':
- encoded.Append("Ò");
- break;
- case 'ô':
- encoded.Append("ô");
- break;
- case 'Ô':
- encoded.Append("Ô");
- break;
- case 'ø':
- encoded.Append("ø");
- break;
- case 'Ø':
- encoded.Append("Ø");
- break;
- case 'õ':
- encoded.Append("õ");
- break;
- case 'Õ':
- encoded.Append("Õ");
- break;
- case 'ö':
- encoded.Append("ö");
- break;
- case 'Ö':
- encoded.Append("Ö");
- break;
- case 'ß':
- encoded.Append("ß");
- break;
- case 'ú':
- encoded.Append("ú");
- break;
- case 'Ú':
- encoded.Append("Ú");
- break;
- case 'ù':
- encoded.Append("ù");
- break;
- case 'Ù':
- encoded.Append("Ù");
- break;
- case 'û':
- encoded.Append("û");
- break;
- case 'Û':
- encoded.Append("Û");
- break;
- case 'ü':
- encoded.Append("ü");
- break;
- case 'Ü':
- encoded.Append("Ü");
- break;
- case 'ÿ':
- encoded.Append("ÿ");
- break;
- default:
- if (ch > 127)
- {
- encoded.Append("").Append((int)ch).Append(';');
- }
- else
- {
- encoded.Append(ch);
- }
- break;
- }
- }
- return encoded.ToString();
- }
-
- ///
- /// Converts a string to an HTML-encoded string using numeric character references.
- ///
- /// The string to encode.
- /// An encoded string.
- public static string EncodeNumeric(string source)
- {
- if (string.IsNullOrEmpty(source))
- {
- return string.Empty;
- }
-
- var encoded = new StringBuilder(source.Length);
- foreach (var ch in source)
- {
- if (ch == ' ')
- {
- encoded.Append("");
- encoded.Append(160); //
- encoded.Append(';');
- }
- else if (ch > 127 || ch == '<' || ch == '>' || ch == '"' || ch == '&' || ch == '\'')
- {
- encoded.Append("");
- encoded.Append((int)ch);
- encoded.Append(';');
- }
- else
- {
- encoded.Append(ch);
- }
- }
- return encoded.ToString();
- }
-
- ///
- /// Optimized method to remove common html tags, like , , , and
- ///
- /// Text to remove html tags from
- /// Text stripped from common html tags
- private static string RemoveCommonHtmlTags(string s)
- {
- char[] array = new char[s.Length];
- int arrayIndex = 0;
- bool inside = false;
-
- for (int i = 0; i < s.Length; i++)
- {
- char ch = s[i];
- if (ch == '<' && i < s.Length - 2)
- {
- var next = s[i + 1];
- var nextNext = s[i + 2];
- if (nextNext == '>' &&
- (next == 'i' || //
- next == 'I' || //
- next == 'b' || //
- next == 'B' || //
- next == 'u' || //
- next == 'U')) //
- {
- inside = true;
- continue;
- }
-
- if (next == '/' && i < s.Length - 3)
- {
- var nextNextNext = s[i + 3];
- if (nextNextNext == '>' &&
- (nextNext == 'i' || //
- nextNext == 'I' || //
- nextNext == 'b' || //
- nextNext == 'B' || //
- nextNext == 'u' || //
- nextNext == 'U')) //
- {
- inside = true;
- continue;
- }
-
- if (nextNext == 'c' && nextNextNext == '.')
- {
- inside = true;
- continue;
- }
- }
-
- if (nextNext == '/' && i < s.Length - 3)
- { // some bad end tags sometimes seen
- var nextNextNext = s[i + 3];
- if (nextNextNext == '>' &&
- (next == 'i' || //
- next == 'I' || //
- next == 'b' || //
- next == 'B' || //
- next == 'u' || //
- next == 'U')) //
- {
- inside = true;
- continue;
- }
- }
-
- if ((next == 'f' || next == 'F') && s[i..].StartsWith("", StringComparison.OrdinalIgnoreCase) || //
- next == ' ' && nextNext == '/' && s[i..].StartsWith("< /font>", StringComparison.OrdinalIgnoreCase) || // < /font>
- next == '/' && nextNext == ' ' && s[i..].StartsWith(" font>", StringComparison.OrdinalIgnoreCase)) // font>
- {
- inside = true;
- continue;
- }
-
- if (next == 'c' && nextNext == '.')
- {
- inside = true;
- continue;
- }
- }
- if (inside && ch == '>')
- {
- inside = false;
- continue;
- }
- if (!inside)
- {
- array[arrayIndex] = ch;
- arrayIndex++;
- }
- }
- return new string(array, 0, arrayIndex);
- }
-
- public static bool IsUrl(string text)
- {
- if (string.IsNullOrWhiteSpace(text) || text.Length < 6 || text.IndexOf('.') < 0 || text.Contains(' '))
- {
- return false;
- }
-
- var allLower = text.ToLowerInvariant();
- if (allLower.StartsWith("http://", StringComparison.Ordinal) || allLower.StartsWith("https://", StringComparison.Ordinal) ||
- allLower.StartsWith("www.", StringComparison.Ordinal) || allLower.EndsWith(".org", StringComparison.Ordinal) ||
- allLower.EndsWith(".com", StringComparison.Ordinal) || allLower.EndsWith(".net", StringComparison.Ordinal))
- {
- return true;
- }
-
- if (allLower.Contains(".org/") || allLower.Contains(".com/") || allLower.Contains(".net/"))
- {
- return true;
- }
-
- return false;
- }
-
- public static bool StartsWithUrl(string text)
- {
- if (string.IsNullOrWhiteSpace(text))
- {
- return false;
- }
-
- var arr = text.Trim().TrimEnd('.').TrimEnd().Split();
- if (arr.Length == 0)
- {
- return false;
- }
-
- return IsUrl(arr[0]);
- }
-
- private static readonly string[] UppercaseTags = { "", "", "", "", "", "", "" };
-
- public static string FixUpperTags(string input)
- {
- if (string.IsNullOrEmpty(input) || input.IndexOf('<') < 0)
- {
- return input;
- }
-
- var text = input;
- var idx = text.IndexOfAny(UppercaseTags, StringComparison.Ordinal);
- while (idx >= 0)
- {
- var endIdx = text.IndexOf('>', idx + 2);
- if (endIdx < idx)
- {
- break;
- }
-
- var tag = text[idx..endIdx].ToLowerInvariant();
- text = text.Remove(idx, endIdx - idx).Insert(idx, tag);
- idx = text.IndexOfAny(UppercaseTags, StringComparison.Ordinal);
- }
- return text;
- }
-
- public static string ToggleTag(string input, string tag, bool wholeLine, bool assa)
- {
- var text = input;
-
- if (assa)
- {
- var onOffTags = new List { "i", "b", "u", "s", "be" };
- if (onOffTags.Contains(tag))
- {
- if (text.Contains($"\\{tag}1"))
- {
- text = text.Replace($"{{\\{tag}1}}", string.Empty);
- text = text.Replace($"{{\\{tag}0}}", string.Empty);
- text = text.Replace($"\\{tag}1", string.Empty);
- text = text.Replace($"\\{tag}0", string.Empty);
- }
- else
- {
- text = wholeLine ? $"{{\\{tag}1}}{text}" : $"{{\\{tag}1}}{text}{{\\{tag}0}}";
- }
- }
- else
- {
- if (text.Contains($"\\{tag}"))
- {
- text = text.Replace($"{{\\{tag}}}", string.Empty);
- text = text.Replace($"\\{tag}", string.Empty);
- }
- else
- {
- text = $"{{\\{tag}}}{text}";
- }
- }
-
- return text;
- }
-
- if (text.Contains("<" + tag + ">", StringComparison.OrdinalIgnoreCase) ||
- text.Contains("" + tag + ">", StringComparison.OrdinalIgnoreCase))
- {
- text = text.Replace("<" + tag + ">", string.Empty);
- text = text.Replace("" + tag + ">", string.Empty);
- text = text.Replace("<" + tag.ToUpperInvariant() + ">", string.Empty);
- text = text.Replace("" + tag.ToUpperInvariant() + ">", string.Empty);
- }
- else
- {
- int indexOfEndBracket = text.IndexOf('}');
- if (text.StartsWith("{\\", StringComparison.Ordinal) && indexOfEndBracket > 1 && indexOfEndBracket < 6)
- {
- text = $"{text[..(indexOfEndBracket + 1)]}<{tag}>{text.Remove(0, indexOfEndBracket + 1)}{tag}>";
- }
- else
- {
- text = $"<{tag}>{text}{tag}>";
- }
- }
- return text;
- }
-
- public static Color GetColorFromString(string color)
- {
- Color c = Color.White;
- try
- {
- if (color.StartsWith("rgb(", StringComparison.Ordinal))
- {
- string[] arr = color.Remove(0, 4).TrimEnd(')').Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
- c = Color.FromArgb(int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2]));
- }
- else
- {
- c = ColorTranslator.FromHtml(color);
- }
- }
- catch
- {
- // ignored
- }
-
- return c;
- }
-}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/HttpRequest.cs b/MsmhToolsClass/MsmhToolsClass/HttpRequest.cs
index 3e8df9e..9324284 100644
--- a/MsmhToolsClass/MsmhToolsClass/HttpRequest.cs
+++ b/MsmhToolsClass/MsmhToolsClass/HttpRequest.cs
@@ -616,7 +616,7 @@ public static async Task SendAsync(HttpRequest hr)
break;
}
}
- Debug.WriteLine($"HttpRequest SendAsync. URL: {hr.URI}, Host Header: {host}");
+ //Debug.WriteLine($"HttpRequest SendAsync. URL: {hr.URI}, Host Header: {host}");
Debug.WriteLine("HttpRequest SendAsync: " + ex.GetInnerExceptions());
}
catch (Exception) { }
diff --git a/MsmhToolsClass/MsmhToolsClass/IPRange.cs b/MsmhToolsClass/MsmhToolsClass/IPRange.cs
new file mode 100644
index 0000000..6f6877f
--- /dev/null
+++ b/MsmhToolsClass/MsmhToolsClass/IPRange.cs
@@ -0,0 +1,260 @@
+using System.Diagnostics;
+using System.Net;
+using System.Numerics;
+
+namespace MsmhToolsClass;
+
+public class IPRange : IDisposable
+{
+ private readonly List CIDR_List = new();
+ private string CIDR = string.Empty;
+ private bool PPause = false;
+ private bool Cancel = false;
+ private List? PIPs = new();
+
+ public bool IsRunning { get; private set; }
+ public bool IsPaused { get; private set; }
+ public List IPs
+ {
+ get
+ {
+ List ips = new();
+ if (PIPs == null) return ips;
+ lock (PIPs)
+ {
+ ips = PIPs.ToList();
+ }
+ return ips;
+ }
+ }
+ public BigInteger NubmerOfGeneratedIPs { get; private set; } = 0;
+
+ ///
+ /// Get All IPs In The CIDR Range
+ ///
+ /// IPv4 CIDR List Or IPv6 CIDR List
+ public IPRange(List cidrList)
+ {
+ CIDR_List = cidrList;
+ }
+
+ ///
+ /// Get All IPs In The CIDR Range
+ ///
+ /// IPv4 CIDR Or IPv6 CIDR
+ public IPRange(string cidr)
+ {
+ CIDR = cidr;
+ }
+
+ public async void StartGenerateIPs()
+ {
+ await Task.Run(async () =>
+ {
+ try
+ {
+ Cancel = false;
+ if (PIPs == null) return;
+ IsRunning = true;
+ IsPaused = false;
+ PIPs.Clear();
+ NubmerOfGeneratedIPs = 0;
+
+ for (int n = 0; n < CIDR_List.Count; n++)
+ {
+ if (Cancel) break;
+ while (true)
+ {
+ if (Cancel) break;
+ if (!PPause) break;
+ IsPaused = PPause;
+ await Task.Delay(50);
+ }
+ IsPaused = PPause;
+
+ CIDR = CIDR_List[n];
+
+
+ foreach (IPAddress? ip in GetIPsInCIDR(CIDR))
+ {
+ if (Cancel) break;
+ while (true)
+ {
+ if (Cancel) break;
+ if (!PPause) break;
+ IsPaused = PPause;
+ await Task.Delay(50);
+ }
+ IsPaused = PPause;
+
+ if (ip != null)
+ {
+ lock (PIPs) // Just In Case
+ {
+ try
+ {
+ PIPs.Add(ip);
+ NubmerOfGeneratedIPs++;
+ }
+ catch (Exception) { }
+ }
+ }
+ }
+ }
+
+ IsRunning = false;
+ IsPaused = false;
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("IPRange StartGenerateIPs: " + ex.Message);
+ IsRunning = false;
+ IsPaused = false;
+ }
+ }).ConfigureAwait(false);
+ }
+
+ public void Pause(bool pause)
+ {
+ PPause = pause;
+ }
+
+ public void Stop()
+ {
+ Cancel = true;
+ }
+
+ public void Dispose()
+ {
+ try
+ {
+ Cancel = true;
+ PIPs = null;
+ NubmerOfGeneratedIPs = 0;
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ GC.SuppressFinalize(this);
+ }
+ catch (Exception) { }
+ }
+
+ public static IEnumerable GetIPsInCIDR(string cidr)
+ {
+ if (cidr.Contains('/'))
+ {
+ // Split CIDR Into Base IP And Prefix Length
+ string[] split = cidr.Split('/', StringSplitOptions.TrimEntries);
+ if (split.Length == 2)
+ {
+ string cidrBase = split[0];
+ string prefix = split[1];
+ bool isInt = int.TryParse(prefix, out int prefixLength);
+ if (isInt)
+ {
+ bool isCidrBaseIP = IPAddress.TryParse(cidrBase, out IPAddress? cidrIP);
+ if (isCidrBaseIP && cidrIP != null)
+ {
+ byte[] cidrBytes = cidrIP.GetAddressBytes();
+ bool isCidrBaseIPv6 = NetworkTool.IsIPv6(cidrIP);
+ if (!isCidrBaseIPv6)
+ {
+ // IPv4 // Calculate The Number Of Hosts
+ int numberOfHosts = -1;
+
+ try
+ {
+ numberOfHosts = (int)Math.Pow(2, 32 - prefixLength);
+ }
+ catch (Exception) { }
+
+ if (numberOfHosts == -1) yield break;
+
+ // Generate All IPs In Range
+ for (int i = 0; i < numberOfHosts; i++)
+ {
+ byte[] currentIpBytes = new byte[cidrBytes.Length];
+
+ try
+ {
+ Buffer.BlockCopy(cidrBytes, 0, currentIpBytes, 0, cidrBytes.Length);
+ }
+ catch (Exception)
+ {
+ yield break;
+ }
+
+ bool isSuccess = addToIP(currentIpBytes, i);
+ if (!isSuccess) yield break;
+
+ yield return new IPAddress(currentIpBytes);
+ }
+
+ // Add An Int Value To An IP Byte Array
+ static bool addToIP(byte[] ip, int value)
+ {
+ try
+ {
+ for (int n = ip.Length - 1; n >= 0; n--)
+ {
+ int result = ip[n] + value;
+ ip[n] = (byte)(result & 0xFF);
+ value = result >> 8;
+ }
+ return true;
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ // IPv6 // Calculate The Number Of Hosts
+ BigInteger numberOfHosts = -1;
+
+ try
+ {
+ numberOfHosts = BigInteger.Pow(2, 128 - prefixLength);
+ }
+ catch (Exception) { }
+
+ if (numberOfHosts == -1) yield break;
+
+ // Convert Base IP To BigInteger
+ BigInteger baseIpBigInt = new(cidrBytes, isUnsigned: true, isBigEndian: true);
+
+ // Generate All IPs In Range
+ for (BigInteger i = 0; i < numberOfHosts; i++)
+ {
+ byte[] currentIpBytes;
+
+ try
+ {
+ BigInteger currentIpBigInt = baseIpBigInt + i;
+ currentIpBytes = currentIpBigInt.ToByteArray(isUnsigned: true, isBigEndian: true);
+
+ // Ensure The Array Is Always 16 Bytes Long (IPv6 Is 128 Bits Or 16 Bytes)
+ if (currentIpBytes.Length < 16)
+ {
+ //Array.Resize(ref currentIpBytes, 16);
+ byte[] paddedBytes = new byte[16];
+ Buffer.BlockCopy(currentIpBytes, 0, paddedBytes, 16 - currentIpBytes.Length, currentIpBytes.Length);
+ currentIpBytes = paddedBytes;
+ }
+ }
+ catch (Exception)
+ {
+ yield break;
+ }
+
+ yield return new IPAddress(currentIpBytes);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/JsonTool.cs b/MsmhToolsClass/MsmhToolsClass/JsonTool.cs
index 8b33ded..4ee7324 100644
--- a/MsmhToolsClass/MsmhToolsClass/JsonTool.cs
+++ b/MsmhToolsClass/MsmhToolsClass/JsonTool.cs
@@ -19,7 +19,7 @@ public static bool IsValidJson(string content)
}
catch (Exception ex)
{
- Debug.WriteLine("IsValidJson: " + ex.Message);
+ Debug.WriteLine("JsonTool IsValidJson: " + ex.Message);
}
return result;
@@ -40,13 +40,36 @@ public static bool IsValidJsonFile(string jsonFilePath)
}
catch (Exception ex)
{
- Debug.WriteLine("IsValidJsonFile: " + ex.Message);
+ Debug.WriteLine("JsonTool IsValidJsonFile: " + ex.Message);
}
return result;
}
- public static List GetValues(string jsonStr, List path)
+ public struct JsonPath
+ {
+ public JsonPath() { }
+ ///
+ /// Key (Name) To Find
+ ///
+ public string Key { get; set; } = string.Empty;
+ ///
+ /// Break After N Elements
+ ///
+ public int Count { get; set; } = int.MaxValue;
+ ///
+ /// Conditions To Match
+ ///
+ public List Conditions { get; set; } = new();
+ }
+
+ public struct JsonCondition
+ {
+ public string Key { get; set; }
+ public string Value { get; set; }
+ }
+
+ public static List GetValues(string jsonStr, List path)
{
List values = new();
@@ -62,7 +85,38 @@ public static List GetValues(string jsonStr, List path)
using JsonDocument jsonDocument = JsonDocument.Parse(jsonStr, jsonDocumentOptions);
JsonElement json = jsonDocument.RootElement;
- static List loop(string path, List elements)
+ static bool checkCondition(JsonPath path, JsonElement element)
+ {
+ bool go = false;
+
+ try
+ {
+ int counted = 0;
+ foreach (JsonCondition condition in path.Conditions)
+ {
+ foreach (JsonProperty jp in element.EnumerateObject())
+ {
+ // JSON is case sensitive to both field names and data
+ if (condition.Key.Equals(jp.Name) &&
+ condition.Value.Equals(jp.Value.ToString().Trim().Trim('"'), StringComparison.OrdinalIgnoreCase)) // True False
+ {
+ counted++;
+ }
+ }
+ if (counted == path.Conditions.Count) break;
+ }
+ if (counted == path.Conditions.Count) go = true;
+ if (path.Conditions.Count == 0) go = true;
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("JsonTool GetValues checkCondition: " + ex.Message);
+ }
+
+ return go;
+ }
+
+ static List loop(JsonPath path, List elements)
{
List jsonElements = new();
@@ -71,12 +125,20 @@ static List loop(string path, List elements)
for (int n = 0; n < elements.Count; n++)
{
JsonElement element = elements[n];
-
+
if (element.ValueKind == JsonValueKind.Object)
{
- foreach (JsonProperty jp in element.EnumerateObject())
+ bool go = checkCondition(path, element);
+ if (go)
{
- if (path.Equals(jp.Name, StringComparison.OrdinalIgnoreCase)) jsonElements.Add(jp.Value);
+ foreach (JsonProperty jp in element.EnumerateObject())
+ {
+ if (path.Key.Equals(jp.Name))
+ {
+ jsonElements.Add(jp.Value);
+ break;
+ }
+ }
}
}
else if (element.ValueKind == JsonValueKind.Array)
@@ -84,11 +146,13 @@ static List loop(string path, List elements)
List jsonElements2 = loop(path, element.EnumerateArray().ToList());
jsonElements.AddRange(jsonElements2);
}
+
+ if (n + 1 >= path.Count && jsonElements.Count > 0) break;
}
}
catch (Exception ex)
{
- Debug.WriteLine("Json Tool, Get Values: " + ex.Message);
+ Debug.WriteLine("JsonTool GetValues loop: " + ex.Message);
}
return jsonElements;
@@ -96,10 +160,43 @@ static List loop(string path, List elements)
if (path.Any())
{
+ static List loop2(List elements)
+ {
+ List values = new();
+
+ try
+ {
+ for (int n = 0; n < elements.Count; n++)
+ {
+ JsonElement element = elements[n];
+
+ if (element.ValueKind == JsonValueKind.Array)
+ {
+ List values2 = loop2(element.EnumerateArray().ToList());
+ values.AddRange(values2);
+ }
+ else if (element.ValueKind == JsonValueKind.String ||
+ element.ValueKind == JsonValueKind.Number ||
+ element.ValueKind == JsonValueKind.True ||
+ element.ValueKind == JsonValueKind.False ||
+ element.ValueKind == JsonValueKind.Undefined)
+ {
+ values.Add(element.GetRawText().Trim().Trim('"'));
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("JsonTool GetValues loop2: " + ex.Message);
+ }
+
+ return values;
+ }
+
List jsonElements = new();
for (int n = 0; n < path.Count; n++)
{
- string p = path[n];
+ JsonPath p = path[n];
if (n == 0)
{
jsonElements = loop(p, new List() { json });
@@ -110,19 +207,15 @@ static List loop(string path, List elements)
}
}
- for (int n = 0; n < jsonElements.Count; n++)
- {
- JsonElement jsonElement = jsonElements[n];
- string output = jsonElement.GetRawText().Trim().Trim('"');
- if (!output.StartsWith('{') && !output.StartsWith('[')) values.Add(output);
- }
+ values = loop2(jsonElements);
}
}
catch (Exception ex)
{
- Debug.WriteLine("Json Tool, Get Values: " + ex.Message);
+ Debug.WriteLine("JsonTool GetValues: " + ex.Message);
}
return values;
}
+
}
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/AgnosticSettings.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/AgnosticSettings.cs
index 98e2513..402b275 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/AgnosticSettings.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/AgnosticSettings.cs
@@ -32,7 +32,7 @@ public int ListenerPort
public WorkingMode Working_Mode { get; set; } = WorkingMode.DnsAndProxy;
- private int PMaxRequests { get; set; } = 5000;
+ private int PMaxRequests { get; set; } = 10000;
///
/// Maximum Number Of Threads Per Second. (Min: 20)
///
@@ -128,7 +128,7 @@ public AgnosticSettings()
else
{
IsIPv4SupportedByISP = true;
- IsIPv6SupportedByISP = false;
+ IsIPv6SupportedByISP = true;
}
IsIPv4SupportedByOS = NetworkTool.IsIPv4Supported();
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/CommonTools.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/CommonTools.cs
index 0b066e4..27cb259 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/CommonTools.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/CommonTools.cs
@@ -52,7 +52,7 @@ public static string GetWildCardDomainName(string hostname)
// Example www.google.com or gstatic.google.com
// But NOT for google.com or IP address
- if (NetworkTool.IsIp(hostname, out _)) return hostname;
+ if (NetworkTool.IsIP(hostname, out _)) return hostname;
NetworkTool.GetHostDetails(hostname, 443, out _, out _, out string baseHost, out _, out _, out _);
@@ -61,62 +61,44 @@ public static string GetWildCardDomainName(string hostname)
return $"*.{baseHost}";
}
- public static bool IsCfIP(string ipString)
+ public static bool IsCfIP(string ipStr)
{
try
{
- List cloudflareIPs = new()
+ bool isIp = NetworkTool.IsIP(ipStr, out _);
+ if (!isIp) return false;
+
+ List cloudflareCIDRs = new()
{
- "103.21.244.0 - 103.21.244.255",
- "103.22.200.0 - 103.22.200.255",
- "103.31.4.0 - 103.31.5.255",
- "104.16.0.0 - 104.31.255.255",
- "108.162.192.0 - 108.162.207.255",
- "131.0.72.0 - 131.0.75.255",
- "141.101.64.0 - 141.101.65.255",
- "162.158.0.0 - 162.158.3.255",
- "172.64.0.0 - 172.67.255.255",
- "173.245.48.0 - 173.245.48.255",
- "188.114.96.0 - 188.114.99.255",
- "190.93.240.0 - 190.93.243.255",
- "197.234.240.0 - 197.234.243.255",
- "198.41.128.0 - 198.41.143.255"
+ "103.21.244.0/22",
+ "103.22.200.0/22",
+ "103.31.4.0/22",
+ "104.16.0.0/13",
+ "104.24.0.0/14",
+ "108.162.192.0/18",
+ "131.0.72.0/22",
+ "141.101.64.0/18",
+ "162.158.0.0/15",
+ "172.64.0.0/13",
+ "173.245.48.0/20",
+ "188.114.96.0/20",
+ "190.93.240.0/20",
+ "197.234.240.0/22",
+ "198.41.128.0/17",
+ "2400:cb00::/32",
+ "2405:8100::/32",
+ "2405:b500::/32",
+ "2606:4700::/32",
+ "2803:f800::/32",
+ "2a06:98c0::/29",
+ "2c0f:f248::/32"
};
- string[] ips = ipString.Split('.');
- int ip1 = int.Parse(ips[0]);
- int ip2 = int.Parse(ips[1]);
- int ip3 = int.Parse(ips[2]);
- int ip4 = int.Parse(ips[3]);
-
- for (int n = 0; n < cloudflareIPs.Count; n++)
+ for (int n = 0; n < cloudflareCIDRs.Count; n++)
{
- string ipRange = cloudflareIPs[n].Trim();
-
- if (!string.IsNullOrEmpty(ipRange))
- {
- string[] split = ipRange.Split('-', StringSplitOptions.TrimEntries);
- string ipMin = split[0].Trim();
- string ipMax = split[1].Trim();
-
- string[] ipMins = ipMin.Split('.');
- int ipMin1 = int.Parse(ipMins[0]);
- int ipMin2 = int.Parse(ipMins[1]);
- int ipMin3 = int.Parse(ipMins[2]);
- int ipMin4 = int.Parse(ipMins[3]);
-
- string[] ipMaxs = ipMax.Split('.');
- int ipMax1 = int.Parse(ipMaxs[0]);
- int ipMax2 = int.Parse(ipMaxs[1]);
- int ipMax3 = int.Parse(ipMaxs[2]);
- int ipMax4 = int.Parse(ipMaxs[3]);
-
- if (ip1 >= ipMin1 && ip1 <= ipMax1)
- if (ip2 >= ipMin2 && ip2 <= ipMax2)
- if (ip3 >= ipMin3 && ip3 <= ipMax3)
- if (ip4 >= ipMin4 && ip4 <= ipMax4)
- return true;
- }
+ string cidr = cloudflareCIDRs[n].Trim();
+ bool isInRange = NetworkTool.IsIpInRange(ipStr, cidr);
+ if (isInRange) return true;
}
return false;
}
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/Bootstrap.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/Bootstrap.cs
index 8279fba..18a907b 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/Bootstrap.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/Bootstrap.cs
@@ -7,7 +7,7 @@ public static class Bootstrap
public static async Task GetDnsIpAsync(string domain, IPAddress bootstrapIP, int bootstrapPort, int timeoutSec, bool getIPv6, string? proxyScheme = null, string? proxyUser = null, string? proxyPass = null)
{
string domainIP = domain;
- bool isIP = NetworkTool.IsIp(domain, out _);
+ bool isIP = NetworkTool.IsIP(domain, out _);
if (!isIP)
{
if (bootstrapIP == IPAddress.None || bootstrapIP == IPAddress.IPv6None || bootstrapPort < 1)
@@ -17,7 +17,11 @@ public static async Task GetDnsIpAsync(string domain, IPAddress bootstra
}
else
{
- string bootstrap = $"tcp://{bootstrapIP}:{bootstrapPort}"; // TCP Usually Don't Get Hijack!
+ string bootstrap;
+ if (NetworkTool.IsIPv6(bootstrapIP))
+ bootstrap = $"tcp://[{bootstrapIP}]:{bootstrapPort}"; // TCP Usually Don't Get Hijack! - IPv6
+ else
+ bootstrap = $"tcp://{bootstrapIP}:{bootstrapPort}"; // TCP Usually Don't Get Hijack! - IPv4
IPAddress ip = await GetIP.GetIpFromDnsAddressAsync(domain, bootstrap, false, timeoutSec, getIPv6, IPAddress.None, 0, proxyScheme, proxyUser, proxyPass);
if (ip != IPAddress.None && ip != IPAddress.IPv6None) domainIP = ip.ToString();
}
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DNSCryptClient.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DNSCryptClient.cs
index 151c639..73fe511 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DNSCryptClient.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DNSCryptClient.cs
@@ -204,7 +204,7 @@ public async Task GetResponseAsync()
ep = new(Reader.DNSCryptRelayIP, Reader.DNSCryptRelayPort);
}
- TcpClient tcpClient = new();
+ TcpClient tcpClient = new(ep.AddressFamily);
tcpClient.SendTimeout = TimeoutMS;
tcpClient.ReceiveTimeout = TimeoutMS;
tcpClient.Client.NoDelay = true;
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DNSCryptDns.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DNSCryptDns.cs
deleted file mode 100644
index 8c6e705..0000000
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DNSCryptDns.cs
+++ /dev/null
@@ -1,411 +0,0 @@
-using MsmhToolsClass.ExternLibs;
-using MsmhToolsClass.ProxifiedClients;
-using System.Buffers.Binary;
-using System.Diagnostics;
-using System.Net;
-using System.Net.Sockets;
-using System.Text;
-
-namespace MsmhToolsClass.MsmhAgnosticServer;
-
-// https://github.com/DNSCrypt/dnscrypt-protocol/blob/master/DNSCRYPT-V2-PROTOCOL.txt
-public class DNSCryptDns
-{
- private byte[] QueryBuffer { get; set; } = Array.Empty();
- private DnsReader Reader { get; set; } = new();
- private int TimeoutMS { get; set; } = 5;
- private CancellationToken CT { get; set; }
- private string? ProxyScheme { get; set; }
- private string? ProxyUser { get; set; }
- private string? ProxyPass { get; set; }
-
- private TextRecord.TXTCertificate Certificate { get; set; } = new();
-
- public DNSCryptDns(byte[] queryBuffer, DnsReader reader, int timeoutMS, CancellationToken cT, string? proxyScheme = null, string? proxyUser = null, string? proxyPass = null)
- {
- QueryBuffer = queryBuffer;
- Reader = reader;
- TimeoutMS = timeoutMS;
- CT = cT;
- ProxyScheme = proxyScheme;
- ProxyUser = proxyUser;
- ProxyPass = proxyPass;
- }
-
- private async Task InitializeAsync(DnsEnums.DnsProtocol protocol)
- {
- bool result = false;
- Task task = Task.Run(async () =>
- {
- try
- {
- DnsMessage initializeQuery = DnsMessage.CreateQuery(protocol, Reader.StampReader.ProviderName, DnsEnums.RRType.TEXT, DnsEnums.CLASS.IN);
- DnsMessage.TryWrite(initializeQuery, out byte[] initializeQueryBuffer);
-
- IPEndPoint ep = new(Reader.StampReader.IP, Reader.Port);
-
- bool upStreamProxyApplied = false;
- TcpClient? tcpClient = null;
- Socket? initSocket = null;
-
- try
- {
- if (protocol == DnsEnums.DnsProtocol.UDP)
- initSocket = new(ep.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
- else if (protocol == DnsEnums.DnsProtocol.TCP)
- {
- tcpClient = new();
- initSocket = tcpClient.Client;
-
- // Support Upstream Proxy
- ProxifiedTcpClient proxifiedTcpClient = new(ProxyScheme, ProxyUser, ProxyPass);
- var upstream = await proxifiedTcpClient.TryGetConnectedProxifiedTcpClient(ep);
- if (upstream.isSuccess && upstream.proxifiedTcpClient != null)
- {
- tcpClient = upstream.proxifiedTcpClient;
- initSocket = tcpClient.Client;
- upStreamProxyApplied = true;
- }
- }
-
- if (initSocket != null)
- {
- initSocket.SendTimeout = TimeoutMS;
- initSocket.ReceiveTimeout = TimeoutMS;
-
- if (!upStreamProxyApplied) await initSocket.ConnectAsync(ep, CT).ConfigureAwait(false);
- await initSocket.SendAsync(initializeQueryBuffer, SocketFlags.None, CT).ConfigureAwait(false);
-
- byte[] initBuffer = new byte[MsmhAgnosticServer.MaxDataSize];
- int receivedLength = 0;
- for (int i = 0; i < 5; i++)
- {
- receivedLength = await initSocket.ReceiveAsync(initBuffer, SocketFlags.None, CT).ConfigureAwait(false);
- if (receivedLength > 0) break;
- }
-
- //Debug.WriteLine("========= DnsCrypt ReceivedLength => " + receivedLength);
- initBuffer = initBuffer[..receivedLength];
-
- bool isCertValid = false;
- uint serial = 0;
-
- DnsMessage verifyInitDM = DnsMessage.Read(initBuffer, protocol);
- foreach (IResourceRecord answer in verifyInitDM.Answers.AnswerRecords)
- {
- if (answer is not TextRecord textRecord) continue;
- //Debug.WriteLine("Number Of Certs: " + textRecord.TXTCertificates.Count);
- foreach (var cert in textRecord.TXTCertificates)
- {
- if (cert.Serial > serial)
- {
- serial = cert.Serial;
- Certificate = cert;
- }
-
- byte[] serverSignature = Convert.FromHexString(cert.Signature);
- TextRecord.TXTCertificate.TryWrite(cert, out byte[] certBuffer);
- byte[] afterServerSignature = certBuffer[72..];
- byte[] providerPublicKey = Convert.FromHexString(Reader.StampReader.PublicKey);
-
- int verify = LibSodium.crypto_sign_verify_detached(serverSignature, afterServerSignature, afterServerSignature.Length, providerPublicKey);
- if (verify == 0) isCertValid = true;
- }
- }
-
- result = isCertValid;
- }
- }
- catch (Exception) { }
-
- initSocket?.Shutdown(SocketShutdown.Both);
- initSocket?.Close();
- _ = Task.Run(() => initSocket?.Dispose());
- _ = Task.Run(() => tcpClient?.Dispose());
- }
- catch (Exception) { }
- });
- try { await task.WaitAsync(TimeSpan.FromMilliseconds(TimeoutMS), CT).ConfigureAwait(false); } catch (Exception) { }
-
- return result;
- }
-
- public async Task GetResponseAsync()
- {
- byte[] result = Array.Empty();
-
- Task task = Task.Run(async () =>
- {
- try
- {
- bool isInitialized = await InitializeAsync(DnsEnums.DnsProtocol.UDP);
- if (!isInitialized) isInitialized = await InitializeAsync(DnsEnums.DnsProtocol.TCP);
-
- //Debug.WriteLine("Is Certificate Valid: " + isInitialized);
- if (isInitialized)
- {
- byte[] clientNonce = ByteArrayTool.GenerateRandom(12);
- byte[] clientNoncePad = new byte[12];
- byte[] paddedClientNonce = clientNonce.Concat(clientNoncePad).ToArray();
-
- byte[] queryPad = GenerateQueryPad(QueryBuffer.Length);
- byte[] paddedQuery = QueryBuffer.Concat(queryPad).ToArray();
-
- byte[] certPublicKey = Convert.FromHexString(Certificate.PublicKey);
-
- byte[] clientSecretKey = ByteArrayTool.GenerateRandom(32);
-
- bool isCreateSharedKeySuccess = CreateSharedKey(Certificate, certPublicKey, clientSecretKey, out byte[] sharedKeyBuffer);
- //Debug.WriteLine("Is Create SharedKey Success: " + isCreateSharedKeySuccess);
- //Debug.WriteLine("SharedKey: " + Convert.ToHexString(sharedKeyBuffer).ToLower());
- if (isCreateSharedKeySuccess)
- {
- bool isEncryptedQuerySuccess = Encrypt(Certificate, ref paddedQuery, ref paddedClientNonce, sharedKeyBuffer, out byte[] encryptedQuery);
- //Debug.WriteLine("Is Encrypted Query Success: " + isEncryptedQuerySuccess);
- //Debug.WriteLine("Encrypted Query: " + Convert.ToHexString(encryptedQuery).ToLower());
- if (isEncryptedQuerySuccess)
- {
- bool isCreateClientPublicKeySuccess = CreateClientPublicKey(clientSecretKey, out byte[] clientPublicKey);
- //Debug.WriteLine("Is Create Client PublicKey Success: " + isCreateClientPublicKeySuccess);
- //Debug.WriteLine("Client PublicKey: " + Convert.ToHexString(clientPublicKey).ToLower());
- if (isCreateClientPublicKeySuccess)
- {
- //Debug.WriteLine("Certificate ClientMagic: " + Certificate.ClientMagic);
- List queryPacketList = new();
- queryPacketList.AddRange(Convert.FromHexString(Certificate.ClientMagic));
- queryPacketList.AddRange(clientPublicKey);
- queryPacketList.AddRange(clientNonce);
- queryPacketList.AddRange(encryptedQuery);
- byte[] queryPacket = queryPacketList.ToArray();
-
- IPEndPoint ep = new(Reader.StampReader.IP, Reader.Port);
-
- TcpClient tcpClient = new();
- tcpClient.SendTimeout = TimeoutMS;
- tcpClient.ReceiveTimeout = TimeoutMS;
- tcpClient.Client.NoDelay = true;
-
- // Support Upstream Proxy
- ProxifiedTcpClient proxifiedTcpClient = new(ProxyScheme, ProxyUser, ProxyPass);
- var upstream = await proxifiedTcpClient.TryGetConnectedProxifiedTcpClient(ep);
- if (upstream.isSuccess && upstream.proxifiedTcpClient != null) tcpClient = upstream.proxifiedTcpClient;
-
- try
- {
- if (!upstream.isSuccess)
- await tcpClient.Client.ConnectAsync(ep, CT).ConfigureAwait(false);
- //Debug.WriteLine("Is TCP Socket Connected: " + tcpSocket.Connected);
-
- byte[] prefix = new byte[2];
- BinaryPrimitives.WriteUInt16BigEndian(prefix, (ushort)queryPacket.Length);
- byte[] queryPacketToSend = prefix.Concat(queryPacket).ToArray();
-
- await tcpClient.Client.SendAsync(queryPacketToSend, SocketFlags.None).ConfigureAwait(false);
-
- int lengthP = await tcpClient.Client.ReceiveAsync(prefix, SocketFlags.None).ConfigureAwait(false);
- //Debug.WriteLine("=== Received Prefix Length: " + lengthP);
- ushort size = BinaryPrimitives.ReadUInt16BigEndian(prefix);
-
- if (size > 0)
- {
- byte[] answerPacket = new byte[size];
- int lengthR = await tcpClient.Client.ReceiveAsync(answerPacket, SocketFlags.None).ConfigureAwait(false);
- if (answerPacket[0] == 0)
- lengthR = await tcpClient.Client.ReceiveAsync(answerPacket, SocketFlags.None).ConfigureAwait(false);
- if (answerPacket[0] == 0)
- lengthR = await tcpClient.Client.ReceiveAsync(answerPacket, SocketFlags.None).ConfigureAwait(false);
- if (answerPacket[0] == 0)
- lengthR = await tcpClient.Client.ReceiveAsync(answerPacket, SocketFlags.None).ConfigureAwait(false);
-
- //Debug.WriteLine("=== Received Answer Length: " + lengthR);
-
- string clientMagic = Encoding.UTF8.GetString(answerPacket[..8]);
- //Debug.WriteLine("Received Client Magic: " + clientMagic);
-
- string constClientMagic = "r6fnvWj8";
- if (clientMagic != constClientMagic)
- Debug.WriteLine("Invalid DNSCrypt Client Magic Received.");
-
- if (!clientNonce.SequenceEqual(answerPacket[8..20]))
- Debug.WriteLine("Invalid DNSCrypt Client Nonce Received.");
-
- byte[] serverNonce = answerPacket[20..32];
- byte[] nonce = clientNonce.Concat(serverNonce).ToArray();
-
- byte[] encryptedAnswer = answerPacket[32..];
-
- bool isDecryptedAnswerSuccess = Decrypt(Certificate, ref encryptedAnswer, ref nonce, sharedKeyBuffer, out byte[] decryptedAnswer);
- //Debug.WriteLine("Is Decrypted Answer Success: " + isDecryptedAnswerSuccess);
- if (isDecryptedAnswerSuccess)
- result = decryptedAnswer;
- }
- }
- catch (Exception) { }
-
- tcpClient.Client.Shutdown(SocketShutdown.Both);
- tcpClient.Client.Close();
- _ = Task.Run(() => tcpClient.Dispose());
- }
- }
- }
- }
- }
- catch (Exception) { }
- });
- try { await task.WaitAsync(TimeSpan.FromMilliseconds(TimeoutMS), CT).ConfigureAwait(false); } catch (Exception) { }
-
- return result;
- }
-
- private static bool CreateClientPublicKey(byte[] clientSecretKey, out byte[] clientPublicKey)
- {
- try
- {
- byte[] publicKey = new byte[clientSecretKey.Length];
- int result = LibSodium.crypto_scalarmult_base(publicKey, clientSecretKey);
- if (result == 0)
- {
- clientPublicKey = publicKey;
- return true;
- }
- clientPublicKey = Array.Empty();
- return false;
- }
- catch (Exception ex)
- {
- Debug.WriteLine("DNSCryptDns CreateClientPublicKey: " + ex.Message);
- clientPublicKey = Array.Empty();
- return false;
- }
- }
-
- private static bool CreateSharedKey(TextRecord.TXTCertificate certificate, byte[] certPublicKey, byte[] secretKey, out byte[] sharedKey)
- {
- try
- {
- byte[] sharedKeyText = new byte[32];
- if (certificate.Version == TextRecord.ESVersion.X25519_XSalsa20Poly1305)
- {
- int result = LibSodium.crypto_box_beforenm(sharedKeyText, certPublicKey, secretKey);
- if (result == 0)
- {
- sharedKey = sharedKeyText;
- return true;
- }
- }
- else if (certificate.Version == TextRecord.ESVersion.X25519_XChacha20Poly1305)
- {
- int result = LibSodium.crypto_box_curve25519xchacha20poly1305_beforenm(sharedKeyText, certPublicKey, secretKey);
- if (result == 0)
- {
- sharedKey = sharedKeyText;
- return true;
- }
- }
- sharedKey = Array.Empty();
- return false;
- }
- catch (Exception ex)
- {
- Debug.WriteLine("DNSCryptDns CreateSharedKey: " + ex.Message);
- sharedKey = Array.Empty();
- return false;
- }
- }
-
- private static bool Encrypt(TextRecord.TXTCertificate certificate, ref byte[] paddedQuery, ref byte[] clientNonce, byte[] sharedKey, out byte[] encrypted)
- {
- try
- {
- byte[] encryptedText = new byte[paddedQuery.Length + 16];
- if (certificate.Version == TextRecord.ESVersion.X25519_XSalsa20Poly1305)
- {
- int result = LibSodium.crypto_box_easy_afternm(encryptedText, paddedQuery, paddedQuery.Length, clientNonce, sharedKey);
- if (result == 0)
- {
- encrypted = encryptedText;
- return true;
- }
- }
- else if (certificate.Version == TextRecord.ESVersion.X25519_XChacha20Poly1305)
- {
- int result = LibSodium.crypto_box_curve25519xchacha20poly1305_easy_afternm(encryptedText, paddedQuery, paddedQuery.Length, clientNonce, sharedKey);
- if (result == 0)
- {
- encrypted = encryptedText;
- return true;
- }
- }
- encrypted = Array.Empty();
- return false;
- }
- catch (Exception ex)
- {
- Debug.WriteLine("DNSCryptDns Encrypt: " + ex.Message);
- encrypted = Array.Empty();
- return false;
- }
- }
-
- private static bool Decrypt(TextRecord.TXTCertificate certificate, ref byte[] encryptedAnswer, ref byte[] serverNonce, byte[] sharedKey, out byte[] decrypted)
- {
- try
- {
- byte[] decryptedText = new byte[encryptedAnswer.Length - 16];
- if (certificate.Version == TextRecord.ESVersion.X25519_XSalsa20Poly1305)
- {
- int result = LibSodium.crypto_box_open_easy_afternm(decryptedText, encryptedAnswer, encryptedAnswer.Length, serverNonce, sharedKey);
- if (result == 0)
- {
- decrypted = decryptedText;
- return true;
- }
- }
- else if (certificate.Version == TextRecord.ESVersion.X25519_XChacha20Poly1305)
- {
- int result = LibSodium.crypto_box_curve25519xchacha20poly1305_open_easy_afternm(decryptedText, encryptedAnswer, encryptedAnswer.Length, serverNonce, sharedKey);
- if (result == 0)
- {
- decrypted = decryptedText;
- return true;
- }
- }
- decrypted = Array.Empty();
- return false;
- }
- catch (Exception ex)
- {
- Debug.WriteLine("DNSCryptDns Decrypt: " + ex.Message);
- decrypted = Array.Empty();
- return false;
- }
- }
-
- private static byte[] GenerateQueryPad(int queryLength)
- {
- byte[] pad = Array.Empty();
-
- try
- {
- if (queryLength < 256) pad = new byte[256 - queryLength];
-
- if (queryLength > 256)
- {
- int paddingLength = 256 + 64;
- while (paddingLength < queryLength)
- {
- paddingLength += 64;
- }
- pad = new byte[paddingLength - queryLength];
- }
-
- pad[0] = 0x80;
- }
- catch (Exception ex)
- {
- Debug.WriteLine("DNSCryptDns GenerateQueryPad: " + ex.Message);
- }
-
- return pad;
- }
-}
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DnsClient.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DnsClient.cs
index 82afb16..13ad833 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DnsClient.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DnsClient.cs
@@ -141,26 +141,56 @@ public async static Task QueryAsync(byte[] queryBuffer, DnsEnums.DnsProt
{
TcpPlainClient tcpPlainClient = new(queryBuffer, dnsReader, timeoutMS, proxyScheme, proxyUser, proxyPass, ct);
result = await tcpPlainClient.GetResponseAsync().ConfigureAwait(false);
+
+ if (result.Length == 0 && !string.IsNullOrWhiteSpace(proxyScheme)) // Try Without Upstream
+ {
+ tcpPlainClient = new(queryBuffer, dnsReader, timeoutMS, null, null, null, ct);
+ result = await tcpPlainClient.GetResponseAsync().ConfigureAwait(false);
+ }
}
else if (dnsReader.Protocol == DnsEnums.DnsProtocol.DoT)
{
DoTClient doTClient = new(queryBuffer, dnsReader, allowInsecure, bootstrapIP, bootstrapPort, timeoutMS, proxyScheme, proxyUser, proxyPass, ct);
result = await doTClient.GetResponseAsync().ConfigureAwait(false);
+
+ if (result.Length == 0 && !string.IsNullOrWhiteSpace(proxyScheme)) // Try Without Upstream
+ {
+ doTClient = new(queryBuffer, dnsReader, allowInsecure, bootstrapIP, bootstrapPort, timeoutMS, null, null, null, ct);
+ result = await doTClient.GetResponseAsync().ConfigureAwait(false);
+ }
}
else if (dnsReader.Protocol == DnsEnums.DnsProtocol.DoH)
{
DoHClient doHClient = new(queryBuffer, dnsReader, allowInsecure, bootstrapIP, bootstrapPort, timeoutMS, proxyScheme, proxyUser, proxyPass, ct);
result = await doHClient.GetResponseAsync().ConfigureAwait(false);
+
+ if (result.Length == 0 && !string.IsNullOrWhiteSpace(proxyScheme)) // Try Without Upstream
+ {
+ doHClient = new(queryBuffer, dnsReader, allowInsecure, bootstrapIP, bootstrapPort, timeoutMS, null, null, null, ct);
+ result = await doHClient.GetResponseAsync().ConfigureAwait(false);
+ }
}
else if (dnsReader.Protocol == DnsEnums.DnsProtocol.ObliviousDohTarget) // Not Implemented Yet
{
ODoHClient oDoHClient = new(queryBuffer, dnsReader, allowInsecure, bootstrapIP, bootstrapPort, timeoutMS, proxyScheme, proxyUser, proxyPass, ct);
result = await oDoHClient.GetResponseAsync().ConfigureAwait(false);
+
+ if (result.Length == 0 && !string.IsNullOrWhiteSpace(proxyScheme)) // Try Without Upstream
+ {
+ oDoHClient = new(queryBuffer, dnsReader, allowInsecure, bootstrapIP, bootstrapPort, timeoutMS, null, null, null, ct);
+ result = await oDoHClient.GetResponseAsync().ConfigureAwait(false);
+ }
}
else if (dnsReader.Protocol == DnsEnums.DnsProtocol.DnsCrypt || dnsReader.Protocol == DnsEnums.DnsProtocol.AnonymizedDNSCrypt)
{
DNSCryptClient dnsCryptClient = new(queryBuffer, dnsReader, timeoutMS, proxyScheme, proxyUser, proxyPass, ct);
result = await dnsCryptClient.GetResponseAsync().ConfigureAwait(false);
+
+ if (result.Length == 0 && !string.IsNullOrWhiteSpace(proxyScheme)) // Try Without Upstream
+ {
+ dnsCryptClient = new(queryBuffer, dnsReader, timeoutMS, null, null, null, ct);
+ result = await dnsCryptClient.GetResponseAsync().ConfigureAwait(false);
+ }
}
//sw.Stop();
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoHDns.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoHDns.cs
deleted file mode 100644
index 2fb8beb..0000000
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoHDns.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-using System.Net;
-
-namespace MsmhToolsClass.MsmhAgnosticServer;
-
-public class DoHDns
-{
- private byte[] QueryBuffer { get; set; } = Array.Empty();
- private DnsReader Reader { get; set; } = new();
- private bool AllowInsecure { get; set; }
- private IPAddress BootstrapIP { get; set; }
- private int BootstrapPort { get; set; }
- private int TimeoutMS { get; set; } = 5;
- private CancellationToken CT { get; set; }
- private string? ProxyScheme { get; set; }
- private string? ProxyUser { get; set; }
- private string? ProxyPass { get; set; }
-
- public DoHDns(byte[] queryBuffer, DnsReader reader, bool allowInsecure, IPAddress bootstrapIP, int bootstrapPort, int timeoutMS, CancellationToken ct, string? proxyScheme = null, string? proxyUser = null, string? proxyPass = null)
- {
- QueryBuffer = queryBuffer;
- Reader = reader;
- AllowInsecure = allowInsecure;
- BootstrapIP = bootstrapIP;
- BootstrapPort = bootstrapPort;
- TimeoutMS = timeoutMS;
- CT = ct;
- ProxyScheme = proxyScheme;
- ProxyUser = proxyUser;
- ProxyPass = proxyPass;
- }
-
- public async Task GetResponseAsync()
- {
- byte[] result = Array.Empty();
-
- Task task = Task.Run(async () =>
- {
- try
- {
- string dnsServerIP = await Bootstrap.GetDnsIpAsync(Reader.Host, BootstrapIP, BootstrapPort, 3, false, ProxyScheme, ProxyUser, ProxyPass);
- if (dnsServerIP.Equals(Reader.Host))
- dnsServerIP = await Bootstrap.GetDnsIpAsync(Reader.Host, BootstrapIP, BootstrapPort, 3, true, ProxyScheme, ProxyUser, ProxyPass);
-
- UriBuilder uriBuilder = new()
- {
- Scheme = Reader.Scheme,
- Host = dnsServerIP,
- Port = Reader.Port,
- Path = Reader.Path
- };
-
- Uri uri = uriBuilder.Uri;
-
- HttpRequest hr = new()
- {
- CT = CT,
- URI = uri,
- Method = HttpMethod.Post,
- ContentType = MsmhAgnosticServer.DnsMessageContentType,
- DataToSend = QueryBuffer,
- TimeoutMS = TimeoutMS,
- AllowInsecure = AllowInsecure,
- ProxyScheme = ProxyScheme,
- ProxyUser = ProxyUser,
- ProxyPass = ProxyPass,
- };
- hr.Headers.Add("host", Reader.Host); // In Case Of Using Bootstrap
-
- HttpRequestResponse hrr = await HttpRequest.SendAsync(hr).ConfigureAwait(false);
- result = hrr.Data;
- }
- catch (Exception) { }
- });
- try { await task.WaitAsync(TimeSpan.FromMilliseconds(TimeoutMS), CT).ConfigureAwait(false); } catch (Exception) { }
-
- return result;
- }
-}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoQDns.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoQDns.cs
deleted file mode 100644
index 0d629c8..0000000
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoQDns.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System.Net;
-
-namespace MsmhToolsClass.MsmhAgnosticServer;
-
-public class DoQDns
-{
- private byte[] QueryBuffer { get; set; } = Array.Empty();
- private DnsReader Reader { get; set; } = new();
- private IPAddress BootstrapIP { get; set; }
- private int BootstrapPort { get; set; }
- private int TimeoutSec { get; set; } = 5;
- private CancellationToken CT { get; set; }
- private string? ProxyScheme { get; set; }
- private string? ProxyUser { get; set; }
- private string? ProxyPass { get; set; }
-
- public DoQDns(byte[] queryBuffer, DnsReader reader, IPAddress bootstrapIP, int bootstrapPort, int timeoutSec, CancellationToken cT, string? proxyScheme = null, string? proxyUser = null, string? proxyPass = null)
- {
- QueryBuffer = queryBuffer;
- Reader = reader;
- BootstrapIP = bootstrapIP;
- BootstrapPort = bootstrapPort;
- TimeoutSec = timeoutSec;
- CT = cT;
- ProxyScheme = proxyScheme;
- ProxyUser = proxyUser;
- ProxyPass = proxyPass;
- }
-
- public async Task GetResponseAsync()
- {
- byte[] result = Array.Empty();
-
- Task task = Task.Run(() =>
- {
- try
- {
- // Reserved For .NET 8
- //QuicClientConnectionOptions options = new();
- //options.RemoteEndPoint
-
- //QuicConnection quic = await QuicConnection.ConnectAsync();
-
-
- }
- catch (Exception) { }
- });
- try { await task.WaitAsync(TimeSpan.FromSeconds(TimeoutSec), CT).ConfigureAwait(false); } catch (Exception) { }
-
- return result;
- }
-}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoTClient.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoTClient.cs
index 0bac36a..e316d62 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoTClient.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoTClient.cs
@@ -48,7 +48,13 @@ public async Task GetResponseAsync()
if (dnsServerIP.Equals(Reader.Host))
dnsServerIP = await Bootstrap.GetDnsIpAsync(Reader.Host, BootstrapIP, BootstrapPort, 3, true, ProxyScheme, ProxyUser, ProxyPass);
- tcpClient = new();
+ if (NetworkTool.IsIP(dnsServerIP, out IPAddress? ip) && ip != null)
+ {
+ IPEndPoint ep = new(ip, Reader.Port);
+ tcpClient = new(ep.AddressFamily);
+ }
+ else
+ tcpClient = new();
tcpClient.SendTimeout = TimeoutMS;
tcpClient.ReceiveTimeout = TimeoutMS;
tcpClient.Client.NoDelay = true;
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoTDns.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoTDns.cs
deleted file mode 100644
index 5e05c0f..0000000
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/DoTDns.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-using MsmhToolsClass.ProxifiedClients;
-using System.Net;
-using System.Net.Security;
-using System.Net.Sockets;
-using System.Security.Cryptography.X509Certificates;
-
-namespace MsmhToolsClass.MsmhAgnosticServer;
-
-public class DoTDns
-{
- private byte[] QueryBuffer { get; set; } = Array.Empty();
- private DnsReader Reader { get; set; } = new();
- private bool AllowInsecure { get; set; }
- private IPAddress BootstrapIP { get; set; }
- private int BootstrapPort { get; set; }
- private int TimeoutMS { get; set; } = 5;
- private CancellationToken CT { get; set; }
- private string? ProxyScheme { get; set; }
- private string? ProxyUser { get; set; }
- private string? ProxyPass { get; set; }
-
- public DoTDns(byte[] queryBuffer, DnsReader reader, bool allowInsecure, IPAddress bootstrapIP, int bootstrapPort, int timeoutMS, CancellationToken ct, string? proxyScheme = null, string? proxyUser = null, string? proxyPass = null)
- {
- QueryBuffer = queryBuffer;
- Reader = reader;
- AllowInsecure = allowInsecure;
- BootstrapIP = bootstrapIP;
- BootstrapPort = bootstrapPort;
- TimeoutMS = timeoutMS;
- CT = ct;
- ProxyScheme = proxyScheme;
- ProxyUser = proxyUser;
- ProxyPass = proxyPass;
- }
-
- public async Task GetResponseAsync()
- {
- byte[] result = Array.Empty();
-
- Task task = Task.Run(async () =>
- {
- TcpClient? tcpClient = null;
- SslStream? sslStream = null;
-
- try
- {
- string dnsServerIP = await Bootstrap.GetDnsIpAsync(Reader.Host, BootstrapIP, BootstrapPort, 3, false, ProxyScheme, ProxyUser, ProxyPass);
- if (dnsServerIP.Equals(Reader.Host))
- dnsServerIP = await Bootstrap.GetDnsIpAsync(Reader.Host, BootstrapIP, BootstrapPort, 3, true, ProxyScheme, ProxyUser, ProxyPass);
-
- tcpClient = new();
- tcpClient.SendTimeout = TimeoutMS;
- tcpClient.ReceiveTimeout = TimeoutMS;
- tcpClient.Client.NoDelay = true;
-
- // Support Upstream Proxy
- ProxifiedTcpClient proxifiedTcpClient = new(ProxyScheme, ProxyUser, ProxyPass);
- var upstream = await proxifiedTcpClient.TryGetConnectedProxifiedTcpClient(dnsServerIP, Reader.Port);
- if (upstream.isSuccess && upstream.proxifiedTcpClient != null) tcpClient = upstream.proxifiedTcpClient;
-
- if (!upstream.isSuccess)
- await tcpClient.Client.ConnectAsync(dnsServerIP, Reader.Port, CT).ConfigureAwait(false);
-
- SslClientAuthenticationOptions optionsClient = new();
- optionsClient.TargetHost = Reader.Host;
- optionsClient.EnabledSslProtocols = MsmhAgnosticServer.SSL_Protocols;
- if (AllowInsecure)
- {
- optionsClient.CertificateRevocationCheckMode = X509RevocationMode.NoCheck;
- optionsClient.RemoteCertificateValidationCallback = MsmhAgnosticServer.Callback;
- }
-
- sslStream = new(tcpClient.GetStream(), false, MsmhAgnosticServer.Callback, null);
- await sslStream.AuthenticateAsClientAsync(optionsClient, CT).ConfigureAwait(false);
-
- if (sslStream.IsAuthenticated && sslStream.CanWrite)
- {
- await sslStream.WriteAsync(QueryBuffer, CT).ConfigureAwait(false);
-
- if (sslStream.CanRead)
- {
- byte[] buffer = new byte[MsmhAgnosticServer.MaxDataSize];
- int receivedLength = await sslStream.ReadAsync(buffer, CT).ConfigureAwait(false);
-
- if (receivedLength > 0) result = buffer[..receivedLength];
- }
- }
- }
- catch (Exception) { }
- finally
- {
- try
- {
- tcpClient?.Client.Shutdown(SocketShutdown.Both);
- tcpClient?.Client.Close();
- tcpClient?.Dispose();
- sslStream?.Dispose();
- }
- catch (Exception) { }
- }
- });
- try { await task.WaitAsync(TimeSpan.FromMilliseconds(TimeoutMS), CT).ConfigureAwait(false); } catch (Exception) { }
-
- return result;
- }
-}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/SystemDns.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/SystemDns.cs
deleted file mode 100644
index 9172152..0000000
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/SystemDns.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Net;
-
-namespace MsmhToolsClass.MsmhAgnosticServer;
-
-public class SystemDns
-{
- private byte[] QueryBuffer { get; set; } = Array.Empty();
- private int TimeoutMS { get; set; } = 5;
- private CancellationToken CT { get; set; }
- public static DnsEnums.DnsProtocol Protocol { get; private set; } = DnsEnums.DnsProtocol.UDP;
-
- public SystemDns(byte[] queryBuffer, int timeoutMS, CancellationToken cT)
- {
- QueryBuffer = queryBuffer;
- TimeoutMS = timeoutMS;
- CT = cT;
- }
-
- public async Task GetResponseAsync()
- {
- byte[] result = Array.Empty();
-
- Task task = Task.Run(() =>
- {
- try
- {
- DnsMessage dmQ = DnsMessage.Read(QueryBuffer, Protocol);
- if (dmQ.IsSuccess && dmQ.Header.QuestionsCount > 0)
- {
- string host = dmQ.Questions.QuestionRecords[0].QNAME;
- DnsEnums.RRType typeQ = dmQ.Questions.QuestionRecords[0].QTYPE;
- bool getIpv6 = typeQ == DnsEnums.RRType.AAAA;
- List ips = GetIP.GetIpsFromSystem(host, getIpv6);
-
- if (ips.Count != 0)
- {
- DnsMessage dmR = DnsMessage.CreateResponse(dmQ, (ushort)ips.Count, 0, 0);
- if (dmR.IsSuccess)
- {
- if (getIpv6) foreach (IPAddress ip in ips) dmR.Answers.AnswerRecords.Add(new AaaaRecord(host, 30, ip));
- else foreach (IPAddress ip in ips) dmR.Answers.AnswerRecords.Add(new ARecord(host, 30, ip));
-
- bool isWriteSuccess = DnsMessage.TryWrite(dmR, out byte[] aBuffer);
- if (isWriteSuccess) result = aBuffer;
- }
- }
- }
- }
- catch (Exception) { }
- });
- try { await task.WaitAsync(TimeSpan.FromMilliseconds(TimeoutMS), CT).ConfigureAwait(false); } catch (Exception) { }
-
- return result;
- }
-}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/TcpPlainClient.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/TcpPlainClient.cs
index 4f9969a..07bf5e4 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/TcpPlainClient.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/TcpPlainClient.cs
@@ -35,7 +35,7 @@ public async Task GetResponseAsync()
{
IPEndPoint ep = new(IPAddress.Parse(Reader.Host), Reader.Port);
- TcpClient tcpClient = new();
+ TcpClient tcpClient = new(ep.AddressFamily);
tcpClient.SendTimeout = TimeoutMS;
tcpClient.ReceiveTimeout = TimeoutMS;
tcpClient.Client.NoDelay = true;
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/TcpPlainDns.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/TcpPlainDns.cs
deleted file mode 100644
index b24b3ea..0000000
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/TcpPlainDns.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-using System.Net.Sockets;
-using System.Net;
-using MsmhToolsClass.ProxifiedClients;
-
-namespace MsmhToolsClass.MsmhAgnosticServer;
-
-public class TcpPlainDns
-{
- private byte[] QueryBuffer { get; set; } = Array.Empty();
- private DnsReader Reader { get; set; } = new();
- private int TimeoutMS { get; set; } = 5;
- private CancellationToken CT { get; set; }
- private string? ProxyScheme { get; set; }
- private string? ProxyUser { get; set; }
- private string? ProxyPass { get; set; }
-
- public TcpPlainDns(byte[] queryBuffer, DnsReader reader, int timeoutMS, CancellationToken cT, string? proxyScheme = null, string? proxyUser = null, string? proxyPass = null)
- {
- QueryBuffer = queryBuffer;
- Reader = reader;
- TimeoutMS = timeoutMS;
- CT = cT;
- ProxyScheme = proxyScheme;
- ProxyUser = proxyUser;
- ProxyPass = proxyPass;
- }
-
- public async Task GetResponseAsync()
- {
- byte[] result = Array.Empty();
-
- Task task = Task.Run(async () =>
- {
- try
- {
- IPEndPoint ep = new(IPAddress.Parse(Reader.Host), Reader.Port);
-
- TcpClient tcpClient = new();
- tcpClient.SendTimeout = TimeoutMS;
- tcpClient.ReceiveTimeout = TimeoutMS;
- tcpClient.Client.NoDelay = true;
-
- // Support Upstream Proxy
- ProxifiedTcpClient proxifiedTcpClient = new(ProxyScheme, ProxyUser, ProxyPass);
- var upstream = await proxifiedTcpClient.TryGetConnectedProxifiedTcpClient(ep);
- if (upstream.isSuccess && upstream.proxifiedTcpClient != null) tcpClient = upstream.proxifiedTcpClient;
-
- try
- {
- if (!upstream.isSuccess)
- await tcpClient.Client.ConnectAsync(ep, CT).ConfigureAwait(false);
-
- await tcpClient.Client.SendAsync(QueryBuffer, SocketFlags.None, CT).ConfigureAwait(false);
-
- byte[] buffer = new byte[MsmhAgnosticServer.MaxDataSize];
- int receivedLength = await tcpClient.Client.ReceiveAsync(buffer, SocketFlags.None, CT).ConfigureAwait(false);
-
- ByteArrayTool.TryConvertBytesToUInt16(buffer[0..2], out ushort answerLength);
-
- while (receivedLength < answerLength)
- {
- receivedLength += await tcpClient.Client.ReceiveAsync(buffer.AsMemory()[receivedLength..], SocketFlags.None, CT).ConfigureAwait(false);
- }
-
- if (receivedLength > 0) result = buffer[..receivedLength];
- }
- catch (Exception) { }
-
- tcpClient.Client.Shutdown(SocketShutdown.Both);
- tcpClient.Client.Close();
- tcpClient.Dispose();
- }
- catch (Exception) { }
- });
- try { await task.WaitAsync(TimeSpan.FromMilliseconds(TimeoutMS), CT).ConfigureAwait(false); } catch (Exception) { }
-
- return result;
- }
-}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/UdpPlainDns.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/UdpPlainDns.cs
deleted file mode 100644
index 16e8803..0000000
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsClient/UdpPlainDns.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System.Net.Sockets;
-using System.Net;
-using System.Diagnostics;
-using System.Formats.Asn1;
-
-namespace MsmhToolsClass.MsmhAgnosticServer;
-
-public class UdpPlainDns
-{
- private byte[] QueryBuffer { get; set; } = Array.Empty();
- private DnsReader Reader { get; set; } = new();
- private int TimeoutMS { get; set; } = 5;
- private CancellationToken CT { get; set; }
-
- public UdpPlainDns(byte[] queryBuffer, DnsReader reader, int timeoutMS, CancellationToken cT)
- {
- QueryBuffer = queryBuffer;
- Reader = reader;
- TimeoutMS = timeoutMS;
- CT = cT;
- }
-
- public async Task GetResponseAsync()
- {
- byte[] result = Array.Empty();
-
- Task task = Task.Run(async () =>
- {
- try
- {
- IPEndPoint ep = new(IPAddress.Parse(Reader.Host), Reader.Port);
-
- Socket socket = new(ep.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
- socket.SendTimeout = TimeoutMS;
- socket.ReceiveTimeout = TimeoutMS;
-
- try
- {
- await socket.ConnectAsync(ep, CT).ConfigureAwait(false);
- await socket.SendAsync(QueryBuffer, SocketFlags.None, CT).ConfigureAwait(false);
- byte[] buffer = new byte[MsmhAgnosticServer.MaxDataSize];
- int receivedLength = await socket.ReceiveAsync(buffer, SocketFlags.None, CT).ConfigureAwait(false);
-
- if (receivedLength > 0) result = buffer[..receivedLength];
- }
- catch (Exception) { }
-
- socket.Shutdown(SocketShutdown.Both);
- socket.Close();
- socket.Dispose();
- }
- catch (Exception) { }
- });
- try { await task.WaitAsync(TimeSpan.FromMilliseconds(TimeoutMS), CT).ConfigureAwait(false); } catch (Exception) { }
-
- return result;
- }
-}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsTool/DnsReader.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsTool/DnsReader.cs
index d3c4faa..a47dfa8 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsTool/DnsReader.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsTool/DnsReader.cs
@@ -159,7 +159,7 @@ public DnsReader(string dns, string? companyNameDataFileContent = null)
{
NetworkTool.GetUrlDetails(Dns, 53, out _, out string ipStr, out _, out _, out int port, out _, out _);
- if (NetworkTool.IsIp(ipStr, out _))
+ if (NetworkTool.IsIP(ipStr, out _))
{
// Plain DNS UDP
SetIpPortHostPath(Dns, 53);
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsTunnel.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsTunnel.cs
index 4ac62ca..821e0ea 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsTunnel.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/DnsServer/DnsTunnel.cs
@@ -5,7 +5,7 @@ namespace MsmhToolsClass.MsmhAgnosticServer;
public class DnsTunnel
{
- public static async Task Process(AgnosticResult aResult, AgnosticProgram.DnsRules dnsRulesProgram, AgnosticProgram.DnsLimit dnsLimitProgram, DnsCache dnsCaches, AgnosticSettings settings, EventHandler? onRequestReceived)
+ public static async Task Process(AgnosticResult aResult, AgnosticProgram.Rules rulesProgram, AgnosticProgram.DnsLimit dnsLimitProgram, DnsCache dnsCaches, AgnosticSettings settings, EventHandler? onRequestReceived)
{
DnsEnums.DnsProtocol dnsProtocol = aResult.Protocol switch
{
@@ -85,17 +85,17 @@ public static async Task Process(AgnosticResult aResult, AgnosticProgram.DnsRule
if (!usedCache)
{
// Apply DnsRules Program
- AgnosticProgram.DnsRules.DnsRulesResult drr = new();
- if (dnsRulesProgram.RulesMode != AgnosticProgram.DnsRules.Mode.Disable)
+ AgnosticProgram.Rules.RulesResult rr = new();
+ if (rulesProgram.RulesMode != AgnosticProgram.Rules.Mode.Disable)
{
- drr = await dnsRulesProgram.GetAsync(aResult.Local_EndPoint.Address.ToString(), addressQ, settings).ConfigureAwait(false);
+ rr = await rulesProgram.GetAsync(aResult.Local_EndPoint.Address.ToString(), addressQ, 0, settings).ConfigureAwait(false);
}
bool usedFakeOrCustom = false;
- if (drr.IsMatch)
+ if (rr.IsMatch)
{
// Black List
- if (drr.IsBlackList)
+ if (rr.IsBlackList)
{
await dnsRequest.SendFailedResponseAsync().ConfigureAwait(false);
usedFakeOrCustom = true;
@@ -106,7 +106,7 @@ public static async Task Process(AgnosticResult aResult, AgnosticProgram.DnsRule
}
// If Custom Dns Couldn't Get An IP
- if (string.IsNullOrEmpty(drr.Dns))
+ if (string.IsNullOrEmpty(rr.Dns))
{
await dnsRequest.SendFailedResponseAsync().ConfigureAwait(false);
usedFakeOrCustom = true;
@@ -117,11 +117,11 @@ public static async Task Process(AgnosticResult aResult, AgnosticProgram.DnsRule
}
// Fake DNS / Dns Domain / Custom Dns Or Smart DNS
- bool isDnsIp = NetworkTool.IsIp(drr.Dns, out IPAddress? dnsIp);
+ bool isDnsIp = NetworkTool.IsIP(rr.Dns, out IPAddress? dnsIp);
if (isDnsIp && dnsIp != null)
{
- bool isDnsIpv6 = NetworkTool.IsIPv6(dnsIp);
- if (isDnsIpv6)
+ bool isDnsIPv6 = NetworkTool.IsIPv6(dnsIp);
+ if (isDnsIPv6)
{
// IPv6
if (typeQ == DnsEnums.RRType.AAAA)
@@ -136,7 +136,7 @@ public static async Task Process(AgnosticResult aResult, AgnosticProgram.DnsRule
await dnsRequest.SendToAsync(aBuffer).ConfigureAwait(false);
usedFakeOrCustom = true;
bool cacheSuccess = dnsCaches.TryAdd(dmQ, dmR);
- Debug.WriteLine("ADDED TO CACHE 1: " + cacheSuccess);
+ Debug.WriteLine("Custom DNS IPv6 ADDED TO CACHE: " + cacheSuccess);
}
}
}
@@ -155,7 +155,7 @@ public static async Task Process(AgnosticResult aResult, AgnosticProgram.DnsRule
await dnsRequest.SendToAsync(aBuffer).ConfigureAwait(false);
usedFakeOrCustom = true;
bool cacheSuccess = dnsCaches.TryAdd(dmQ, dmR);
- Debug.WriteLine("ADDED TO CACHE 2: " + cacheSuccess);
+ Debug.WriteLine("Custom DNS IPv4 ADDED TO CACHE: " + cacheSuccess);
}
}
}
@@ -168,9 +168,63 @@ public static async Task Process(AgnosticResult aResult, AgnosticProgram.DnsRule
dmR = DnsMessage.Read(response, dnsRequest.Protocol);
if (dmR.IsSuccess)
{
- await dnsRequest.SendToAsync(response).ConfigureAwait(false);
- bool cacheSuccess = dnsCaches.TryAdd(dmQ, dmR);
- Debug.WriteLine("ADDED TO CACHE 3: " + cacheSuccess);
+ bool wasCfIP = false;
+ if (!string.IsNullOrWhiteSpace(settings.CloudflareCleanIP))
+ {
+ if (NetworkTool.IsIP(settings.CloudflareCleanIP, out IPAddress? cfIP) && cfIP != null)
+ {
+ if (IsCfIP(dmR))
+ {
+ // Return CF IP
+ bool isCfIPv6 = NetworkTool.IsIPv6(cfIP);
+ if (isCfIPv6)
+ {
+ // IPv6
+ if (typeQ == DnsEnums.RRType.AAAA)
+ {
+ dmR = DnsMessage.CreateResponse(dmQ, 1, 0, 0);
+ dmR.Answers.AnswerRecords.Clear();
+ dmR.Answers.AnswerRecords.Add(new AaaaRecord(addressQ, 60, cfIP));
+
+ bool isTryWriteSuccess = DnsMessage.TryWrite(dmR, out byte[] aBuffer);
+ if (isTryWriteSuccess)
+ {
+ await dnsRequest.SendToAsync(aBuffer).ConfigureAwait(false);
+ wasCfIP = true;
+ bool cacheSuccess = dnsCaches.TryAdd(dmQ, dmR);
+ Debug.WriteLine("CF IPv6 ADDED TO CACHE: " + cacheSuccess);
+ }
+ }
+ }
+ else
+ {
+ // IPv4
+ if (typeQ == DnsEnums.RRType.A)
+ {
+ dmR = DnsMessage.CreateResponse(dmQ, 1, 0, 0);
+ dmR.Answers.AnswerRecords.Clear();
+ dmR.Answers.AnswerRecords.Add(new ARecord(addressQ, 60, cfIP));
+
+ bool isTryWriteSuccess = DnsMessage.TryWrite(dmR, out byte[] aBuffer);
+ if (isTryWriteSuccess)
+ {
+ await dnsRequest.SendToAsync(aBuffer).ConfigureAwait(false);
+ wasCfIP = true;
+ bool cacheSuccess = dnsCaches.TryAdd(dmQ, dmR);
+ Debug.WriteLine("CF IPv4 ADDED TO CACHE: " + cacheSuccess);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (!wasCfIP)
+ {
+ await dnsRequest.SendToAsync(response).ConfigureAwait(false);
+ bool cacheSuccess = dnsCaches.TryAdd(dmQ, dmR);
+ Debug.WriteLine("ADDED TO CACHE: " + cacheSuccess);
+ }
}
else
{
@@ -212,4 +266,37 @@ public static async Task Process(AgnosticResult aResult, AgnosticProgram.DnsRule
//Debug.WriteLine(dmR.ToString());
}
}
+
+ private static bool IsCfIP(DnsMessage dmR)
+ {
+ bool result = false;
+
+ try
+ {
+ for (int n = 0; n < dmR.Answers.AnswerRecords.Count; n++)
+ {
+ IResourceRecord rr = dmR.Answers.AnswerRecords[n];
+ if (rr is ARecord aRecord)
+ {
+ if (CommonTools.IsCfIP(aRecord.IP))
+ {
+ result = true;
+ break;
+ }
+ }
+ else if (rr is AaaaRecord aaaaRecord)
+ {
+ if (CommonTools.IsCfIP(aaaaRecord.IP))
+ {
+ result = true;
+ break;
+ }
+ }
+ }
+ }
+ catch (Exception) { }
+
+ return result;
+ }
+
}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/MsmhAgnosticServer.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/MsmhAgnosticServer.cs
index 9c64f5d..adfee43 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/MsmhAgnosticServer.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/MsmhAgnosticServer.cs
@@ -18,18 +18,11 @@ public void EnableFragment(AgnosticProgram.Fragment fragmentProgram)
FragmentProgram = fragmentProgram;
}
- //======================================= DnsRules Support
- public AgnosticProgram.DnsRules DnsRulesProgram = new();
- public void EnableDnsRules(AgnosticProgram.DnsRules dnsRules)
+ //======================================= Rules Support
+ public AgnosticProgram.Rules RulesProgram = new();
+ public void EnableRules(AgnosticProgram.Rules rules)
{
- DnsRulesProgram = dnsRules;
- }
-
- //======================================= ProxyRules Support
- public AgnosticProgram.ProxyRules ProxyRulesProgram = new();
- public void EnableProxyRules(AgnosticProgram.ProxyRules proxyRules)
- {
- ProxyRulesProgram = proxyRules;
+ RulesProgram = rules;
}
//======================================= DnsLimit Support
@@ -168,7 +161,7 @@ private async void KillOnOverloadTimer_Elapsed(object? sender, System.Timers.Ela
try
{
if (OperatingSystem.IsWindows() && typeof(PerformanceCounter) != null)
- CpuUsage = await ProcessManager.GetCpuUsage(Environment.ProcessId, 1000);
+ CpuUsage = await ProcessManager.GetCpuUsageAsync(Environment.ProcessId, 1000);
if (CpuUsage >= Settings_.KillOnCpuUsage && Settings_.KillOnCpuUsage > 0)
{
@@ -505,7 +498,7 @@ private async void ClientConnected(AgnosticRequest aRequest)
aResult.Protocol == RequestProtocol.DoH)
{
// ===== Process DNS
- await DnsTunnel.Process(aResult, DnsRulesProgram, DnsLimitProgram, DnsCaches, Settings_, OnRequestReceived);
+ await DnsTunnel.Process(aResult, RulesProgram, DnsLimitProgram, DnsCaches, Settings_, OnRequestReceived);
aRequest.Disconnect();
}
else
@@ -538,8 +531,8 @@ private async void ClientConnected(AgnosticRequest aRequest)
}
// Create Tunnel
- ProxyTunnel proxyTunnel = new(connectionId, proxyClient, req, Settings_, SettingsSSL_);
- proxyTunnel.Open(ProxyRulesProgram);
+ ProxyTunnel proxyTunnel = new(connectionId, proxyClient, req, SettingsSSL_);
+ proxyTunnel.Open();
proxyTunnel.OnTunnelDisconnected += ProxyTunnel_OnTunnelDisconnected;
proxyTunnel.OnDataReceived += ProxyTunnel_OnDataReceived;
@@ -597,7 +590,7 @@ private void ProxyTunnel_OnDataReceived(object? sender, EventArgs e)
Stats.AddBytes(e.Buffer.Length, ByteType.Sent);
}
}
-
+
t.KillOnTimeout.Restart();
await t.Client.StartReceiveAsync().ConfigureAwait(false);
t.KillOnTimeout.Restart();
@@ -632,7 +625,7 @@ private void ProxyTunnel_OnDataReceived(object? sender, EventArgs e)
t.ClientSSL.OnClientDataReceived += (s, e) =>
{
t.KillOnTimeout.Restart();
-
+
if (e.Buffer.Length > 0)
{
// Can't be implement here. Ex: "The WriteAsync method cannot be called when another write operation is pending"
@@ -645,7 +638,7 @@ private void ProxyTunnel_OnDataReceived(object? sender, EventArgs e)
}
t.ClientSSL.OnClientDataReceived -= null;
};
-
+
t.ClientSSL.OnRemoteDataReceived += (s, e) =>
{
t.KillOnTimeout.Restart();
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/DnsRules.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/DnsRules.cs
deleted file mode 100644
index bca6bfe..0000000
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/DnsRules.cs
+++ /dev/null
@@ -1,180 +0,0 @@
-using System.Diagnostics;
-
-namespace MsmhToolsClass.MsmhAgnosticServer;
-
-public partial class AgnosticProgram
-{
- public partial class DnsRules
- {
- public enum Mode
- {
- File,
- Text,
- Disable
- }
-
- public Mode RulesMode { get; private set; } = Mode.Disable;
- public string PathOrText { get; private set; } = string.Empty;
- public string TextContent { get; private set; } = string.Empty;
-
- private List Rules_List { get; set; } = new();
- private List> Variables { get; set; } = new(); // x = domain.com;
- private string Default_DnsProxyScheme { get; set; } = string.Empty; // dnsproxy:;
- private string Default_DnsProxyUser { get; set; } = string.Empty; // &user:
- private string Default_DnsProxyPass { get; set; } = string.Empty; // &pass:
- private List MainRules_List { get; set; } = new();
-
- private class DnsMainRules
- {
- public string Client { get; set; } = string.Empty;
- public string Domain { get; set; } = string.Empty;
- public bool IsBlock { get; set; } = false;
- public string FakeDns { get; set; } = string.Empty;
- public List Dnss { get; set; } = new();
- public string DnsDomain { get; set; } = string.Empty;
- public string DnsProxyScheme { get; set; } = string.Empty;
- public string DnsProxyUser { get; set; } = string.Empty;
- public string DnsProxyPass { get; set; } = string.Empty;
- }
-
- public DnsRules() { }
-
- public async void Set(Mode mode, string filePathOrText)
- {
- try
- {
- Rules_List.Clear();
- Variables.Clear();
- Default_DnsProxyScheme = string.Empty;
- Default_DnsProxyUser = string.Empty;
- Default_DnsProxyPass = string.Empty;
- MainRules_List.Clear();
-
- RulesMode = mode;
- PathOrText = filePathOrText;
-
- if (RulesMode == Mode.Disable) return;
-
- if (RulesMode == Mode.File)
- {
- try
- {
- TextContent = await File.ReadAllTextAsync(Path.GetFullPath(PathOrText));
- }
- catch (Exception) { }
- }
- else if (RulesMode == Mode.Text) TextContent = PathOrText;
-
- if (string.IsNullOrEmpty(TextContent) || string.IsNullOrWhiteSpace(TextContent)) return;
-
- TextContent += Environment.NewLine;
- Rules_List = TextContent.SplitToLines();
-
- List list = Rules_List.ToList();
- for (int n = 0; n < list.Count; n++)
- {
- string line = list[n].Trim();
- if (line.StartsWith("//")) continue; // Support Comment //
- if (!line.EndsWith(';')) continue; // Must Have ; At The End
- if (string.IsNullOrEmpty(line) || string.IsNullOrWhiteSpace(line)) continue; // Line Cannot Be Empty
-
- // Get Variables
- if (line.Contains('=') && !line.Contains(',') && !line.Contains('&'))
- {
- line = line.TrimEnd(';');
- string[] split = line.Split('=');
- if (split.Length == 2)
- {
- string item1 = split[0].Trim();
- string item2 = split[1].Trim();
- if (!string.IsNullOrEmpty(item1) && !string.IsNullOrEmpty(item2))
- Variables.Add(new Tuple(item1, item2));
- }
- }
-
- // Get Defaults
- else if (line.StartsWith(Rules.KEYS.DnsProxy, StringComparison.InvariantCultureIgnoreCase))
- {
- Default_DnsProxyScheme = Rules.GetValue(line, Rules.KEYS.DnsProxy, Rules.SUB_KEYS.FirstKey, out _, out _, Variables);
- Default_DnsProxyUser = Rules.GetValue(line, Rules.KEYS.DnsProxy, Rules.SUB_KEYS.User, out _, out _, Variables);
- Default_DnsProxyPass = Rules.GetValue(line, Rules.KEYS.DnsProxy, Rules.SUB_KEYS.Pass, out _, out _, Variables);
- }
-
- // Get DnsMainRules (Client|Domain|DnsRules)
- else if (line.Contains('|'))
- {
- string[] split = line.Split('|');
- if (split.Length == 2) SetDomainRules(Rules.KEYS.AllClients, split[0].Trim(), split[1].Trim());
- if (split.Length == 3) SetDomainRules(split[0].Trim(), split[1].Trim(), split[2].Trim());
- }
- }
- }
- catch (Exception ex)
- {
- Debug.WriteLine("DnsRules Set: " + ex.Message);
- }
- }
-
- private void SetDomainRules(string client, string domain, string rules) // rules Ends With ;
- {
- try
- {
- DnsMainRules dmr = new()
- {
- Client = client, // Client
- Domain = domain // Domain
- };
-
- // Block
- if (rules.Equals("block;", StringComparison.InvariantCultureIgnoreCase)) dmr.IsBlock = true;
- if (rules.Equals("-;")) dmr.IsBlock = true;
-
- if (!dmr.IsBlock)
- {
- // Fake DNS
- string fakeDnsIpStr = Rules.GetValue(rules, Rules.KEYS.FirstKey, null, out _, out _, Variables);
- bool isIp = NetworkTool.IsIp(fakeDnsIpStr, out _);
- if (isIp) dmr.FakeDns = fakeDnsIpStr;
- }
-
- // Dnss
- string dnss = Rules.GetValue(rules, Rules.KEYS.Dns, null, out bool isList, out List list, Variables);
- if (!isList) // One Dns
- {
- if (!string.IsNullOrEmpty(dnss))
- dmr.Dnss.Add(dnss);
- }
- else // Multiple Dnss
- {
- for (int i = 0; i < list.Count; i++)
- {
- string dns = list[i];
- if (!string.IsNullOrEmpty(dns))
- dmr.Dnss.Add(dns);
- }
- }
-
- // DnsDomain
- dmr.DnsDomain = Rules.GetValue(rules, Rules.KEYS.DnsDomain, null, out _, out _, Variables);
-
- // DnsProxy e.g. socks5://127.0.0.1:6666&user:UserName&pass:PassWord
- dmr.DnsProxyScheme = Rules.GetValue(rules, Rules.KEYS.DnsProxy, Rules.SUB_KEYS.FirstKey, out _, out _, Variables);
- dmr.DnsProxyUser = Rules.GetValue(rules, Rules.KEYS.DnsProxy, Rules.SUB_KEYS.User, out _, out _, Variables);
- dmr.DnsProxyPass = Rules.GetValue(rules, Rules.KEYS.DnsProxy, Rules.SUB_KEYS.Pass, out _, out _, Variables);
- if (string.IsNullOrEmpty(dmr.DnsProxyScheme))
- {
- dmr.DnsProxyScheme = Default_DnsProxyScheme;
- dmr.DnsProxyUser = Default_DnsProxyUser;
- dmr.DnsProxyPass = Default_DnsProxyPass;
- }
-
- MainRules_List.Add(dmr);
- }
- catch (Exception ex)
- {
- Debug.WriteLine("DnsRules SetDomainRules: " + ex.Message);
- }
- }
-
- }
-}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/DnsRules_Get.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/DnsRules_Get.cs
deleted file mode 100644
index 3f0e3c4..0000000
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/DnsRules_Get.cs
+++ /dev/null
@@ -1,129 +0,0 @@
-using System.Diagnostics;
-using System.Net;
-
-namespace MsmhToolsClass.MsmhAgnosticServer;
-
-public partial class AgnosticProgram
-{
- public partial class DnsRules
- {
- public class DnsRulesResult
- {
- public bool IsMatch { get; set; } = false;
- public bool IsBlackList { get; set; } = false;
- public string DnsCustomDomain { get; set; } = string.Empty;
- public string Dns { get; set; } = string.Empty;
- public List Dnss { get; set; } = new();
- }
-
- public async Task GetAsync(string client, string host, AgnosticSettings settings)
- {
- DnsRulesResult drr = new();
- if (string.IsNullOrEmpty(host)) return drr;
-
- try
- {
- for (int n = 0; n < MainRules_List.Count; n++)
- {
- DnsMainRules dmr = MainRules_List[n];
-
- // Check If Match
- bool isClientMatch = !string.IsNullOrEmpty(dmr.Client) && (dmr.Client.Equals(Rules.KEYS.AllClients) || client.Equals(dmr.Client) || client.EndsWith(dmr.Client));
- bool isDomainMatch = Rules.IsDomainMatch(host, dmr.Domain, out bool isWildcard, out string hostNoWww, out string ruleHostNoWww);
- bool isMatch = isClientMatch && isDomainMatch;
- if (!isMatch) continue;
-
- // Set Match
- drr.IsMatch = isMatch;
-
- // Is Black List
- drr.IsBlackList = dmr.IsBlock;
- if (drr.IsBlackList) break;
-
- // DNS
- if (!string.IsNullOrEmpty(dmr.FakeDns))
- {
- // Fake DNS
- drr.Dns = dmr.FakeDns;
- }
- else
- {
- // Get Dns Servers And Upstream Proxy
- List dnss = dmr.Dnss.Any() ? dmr.Dnss : settings.DNSs;
- drr.Dnss = dnss;
- string? dnsProxyScheme = null, dnsProxyUser = null, dnsProxyPass = null;
- if (!string.IsNullOrEmpty(dmr.DnsProxyScheme))
- {
- dnsProxyScheme = dmr.DnsProxyScheme;
- dnsProxyUser = dmr.DnsProxyUser;
- dnsProxyPass = dmr.DnsProxyPass;
- }
- else
- {
- dnsProxyScheme = settings.UpstreamProxyScheme;
- dnsProxyUser = settings.UpstreamProxyUser;
- dnsProxyPass = settings.UpstreamProxyPass;
- }
-
- // Get IP By Custom DNS
- if (dnss.Any() && !NetworkTool.IsIp(host, out _))
- {
- // Get Custom DNS Domain
- drr.DnsCustomDomain = host;
- if (!string.IsNullOrEmpty(dmr.DnsDomain))
- {
- if (!dmr.DnsDomain.StartsWith("*."))
- {
- drr.DnsCustomDomain = dmr.DnsDomain;
- }
- else
- {
- // Support: xxxx.example.com -> xxxx.domain.com
- if (isWildcard) // ruleHostNoWww.StartsWith("*.")
- {
- if (hostNoWww.EndsWith(ruleHostNoWww[1..])) // Just In Case
- {
- drr.DnsCustomDomain = hostNoWww.Replace(ruleHostNoWww[1..], dmr.DnsDomain[1..]);
- }
- }
- }
- }
-
- IPAddress ipv4Addr = IPAddress.None;
- if (settings.IsIPv4SupportedByISP)
- {
- ipv4Addr = await GetIP.GetIpFromDnsAddressAsync(drr.DnsCustomDomain, dnss, settings.AllowInsecure, settings.DnsTimeoutSec, false, settings.BootstrapIpAddress, settings.BootstrapPort, dnsProxyScheme, dnsProxyUser, dnsProxyPass);
- if (ipv4Addr.Equals(IPAddress.None) && !settings.IsIPv6SupportedByISP) // Retry If IPv6 Is Not Supported
- ipv4Addr = await GetIP.GetIpFromDnsAddressAsync(drr.DnsCustomDomain, dnss, settings.AllowInsecure, settings.DnsTimeoutSec, false, settings.BootstrapIpAddress, settings.BootstrapPort, dnsProxyScheme, dnsProxyUser, dnsProxyPass);
- }
-
- if (ipv4Addr.Equals(IPAddress.None))
- {
- IPAddress ipv6Addr = await GetIP.GetIpFromDnsAddressAsync(drr.DnsCustomDomain, dnss, settings.AllowInsecure, settings.DnsTimeoutSec, true, settings.BootstrapIpAddress, settings.BootstrapPort, dnsProxyScheme, dnsProxyUser, dnsProxyPass);
- if (!ipv6Addr.Equals(IPAddress.IPv6None))
- drr.Dns = ipv6Addr.ToString();
- }
- else
- {
- if (string.IsNullOrEmpty(settings.CloudflareCleanIP))
- drr.Dns = ipv4Addr.ToString();
- else
- drr.Dns = CommonTools.IsCfIP(ipv4Addr) ? settings.CloudflareCleanIP : ipv4Addr.ToString();
- }
- }
- }
-
- // Break If Match
- break;
- }
- }
- catch (Exception ex)
- {
- Debug.WriteLine("DnsRules_GetAsync: " + ex.Message);
- }
-
- return drr;
- }
-
- }
-}
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/ProxyRules.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/ProxyRules.cs
deleted file mode 100644
index 50100a3..0000000
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/ProxyRules.cs
+++ /dev/null
@@ -1,301 +0,0 @@
-using System.Diagnostics;
-
-namespace MsmhToolsClass.MsmhAgnosticServer;
-
-public partial class AgnosticProgram
-{
- public partial class ProxyRules
- {
- public enum Mode
- {
- File,
- Text,
- Disable
- }
-
- public Mode RulesMode { get; private set; } = Mode.Disable;
- public string PathOrText { get; private set; } = string.Empty;
- public string TextContent { get; private set; } = string.Empty;
-
- private List Rules_List { get; set; } = new();
- private List> Variables { get; set; } = new(); // x = domain.com;
- private List Default_BlockPort { get; set; } = new(); // blockport:80,53;
- private List Default_Dnss { get; set; } = new(); // dns:
- private string Default_DnsDomain { get; set; } = string.Empty; // dnsdomain:;
- private string Default_DnsProxyScheme { get; set; } = string.Empty; // dnsproxy:;
- private string Default_DnsProxyUser { get; set; } = string.Empty; // &user:
- private string Default_DnsProxyPass { get; set; } = string.Empty; // &pass:
- private string Default_Sni { get; set; } = string.Empty; // sni:;
- private string Default_ProxyScheme { get; set; } = string.Empty; // proxy:;
- private bool Default_ProxyIfBlock { get; set; } = false; // &ifblock:1
- private string Default_ProxyUser { get; set; } = string.Empty; // &user:
- private string Default_ProxyPass { get; set; } = string.Empty; // &pass:
- private List MainRules_List { get; set; } = new();
-
- private class ProxyMainRules
- {
- public string Client { get; set; } = string.Empty;
- public string Domain { get; set; } = string.Empty;
- public bool IsBlock { get; set; } = false;
- public List BlockPort { get; set; } = new();
- public bool NoBypass { get; set; } = false;
- public string FakeDns { get; set; } = string.Empty;
- public List Dnss { get; set; } = new();
- public string DnsDomain { get; set; } = string.Empty;
- public string DnsProxyScheme { get; set; } = string.Empty;
- public string DnsProxyUser { get; set; } = string.Empty;
- public string DnsProxyPass { get; set; } = string.Empty;
- public string Sni { get; set; } = string.Empty;
- public string ProxyScheme { get; set; } = string.Empty;
- public bool ProxyIfBlock { get; set; } = false;
- public string ProxyUser { get; set; } = string.Empty;
- public string ProxyPass { get; set; } = string.Empty;
- }
-
- public ProxyRules() { }
-
- public void Set(Mode mode, string filePathOrText)
- {
- Rules_List.Clear();
- Variables.Clear();
- Default_BlockPort.Clear();
- Default_Dnss.Clear();
- Default_DnsDomain = string.Empty;
- Default_DnsProxyScheme = string.Empty;
- Default_DnsProxyUser = string.Empty;
- Default_DnsProxyPass = string.Empty;
- Default_Sni = string.Empty;
- Default_ProxyScheme = string.Empty;
- Default_ProxyIfBlock = false;
- Default_ProxyUser = string.Empty;
- Default_ProxyPass = string.Empty;
- MainRules_List.Clear();
-
- RulesMode = mode;
- PathOrText = filePathOrText;
-
- if (RulesMode == Mode.Disable) return;
-
- if (RulesMode == Mode.File)
- {
- try
- {
- TextContent = File.ReadAllText(Path.GetFullPath(filePathOrText));
- }
- catch (Exception) { }
- }
- else if (RulesMode == Mode.Text) TextContent = filePathOrText;
-
- if (string.IsNullOrEmpty(TextContent) || string.IsNullOrWhiteSpace(TextContent)) return;
-
- TextContent += Environment.NewLine;
- Rules_List = TextContent.SplitToLines();
-
- for (int n = 0; n < Rules_List.Count; n++)
- {
- string line = Rules_List[n].Trim();
- if (line.StartsWith("//")) continue; // Support Comment //
- if (!line.EndsWith(';')) continue; // Must Have ; At The End
- if (string.IsNullOrEmpty(line) || string.IsNullOrWhiteSpace(line)) continue; // Line Cannot Be Empty
-
- // Get Variables
- if (line.Contains('=') && !line.Contains(',') && !line.Contains('&'))
- {
- line = line.TrimEnd(';');
- string[] split = line.Split('=');
- if (split.Length == 2)
- {
- string item1 = split[0].Trim();
- string item2 = split[1].Trim();
- if (!string.IsNullOrEmpty(item1) && !string.IsNullOrEmpty(item2))
- Variables.Add(new Tuple(item1, item2));
- }
- }
-
- // Get Defaults
- else if (line.StartsWith(Rules.KEYS.BlockPort, StringComparison.InvariantCultureIgnoreCase))
- {
- string ports = Rules.GetValue(line, Rules.KEYS.BlockPort, null, out bool isList, out List list, Variables);
- if (!isList) // One Port
- {
- bool success = int.TryParse(ports, out int port);
- if (success) Default_BlockPort.Add(port);
- }
- else // Multiple Ports
- {
- for (int i = 0; i < list.Count; i++)
- {
- string portStr = list[i];
- bool success = int.TryParse(portStr, out int port);
- if (success) Default_BlockPort.Add(port);
- }
- }
- continue;
- }
- else if (line.StartsWith(Rules.KEYS.Dns, StringComparison.InvariantCultureIgnoreCase))
- {
- string dnss = Rules.GetValue(line, Rules.KEYS.Dns, null, out bool isList, out List list, Variables);
- if (!isList) // One Dns
- {
- if (!string.IsNullOrEmpty(dnss))
- Default_Dnss.Add(dnss);
- }
- else // Multiple Dnss
- {
- for (int i = 0; i < list.Count; i++)
- {
- string dns = list[i];
- if (!string.IsNullOrEmpty(dns))
- Default_Dnss.Add(dns);
- }
- }
- }
- else if (line.StartsWith(Rules.KEYS.DnsDomain, StringComparison.InvariantCultureIgnoreCase))
- {
- Default_DnsDomain = Rules.GetValue(line, Rules.KEYS.DnsDomain, null, out _, out _, Variables);
- }
- else if (line.StartsWith(Rules.KEYS.DnsProxy, StringComparison.InvariantCultureIgnoreCase))
- {
- Default_DnsProxyScheme = Rules.GetValue(line, Rules.KEYS.DnsProxy, Rules.SUB_KEYS.FirstKey, out _, out _, Variables);
- Default_DnsProxyUser = Rules.GetValue(line, Rules.KEYS.DnsProxy, Rules.SUB_KEYS.User, out _, out _, Variables);
- Default_DnsProxyPass = Rules.GetValue(line, Rules.KEYS.DnsProxy, Rules.SUB_KEYS.Pass, out _, out _, Variables);
- }
- else if (line.StartsWith(Rules.KEYS.Sni, StringComparison.InvariantCultureIgnoreCase))
- {
- Default_Sni = Rules.GetValue(line, Rules.KEYS.Sni, null, out _, out _, Variables);
- }
- else if (line.StartsWith(Rules.KEYS.Proxy, StringComparison.InvariantCultureIgnoreCase))
- {
- Default_ProxyScheme = Rules.GetValue(line, Rules.KEYS.Proxy, Rules.SUB_KEYS.FirstKey, out _, out _, Variables);
- string ifBlock = Rules.GetValue(line, Rules.KEYS.Proxy, Rules.SUB_KEYS.IfBlock, out _, out _, Variables).ToLower().Trim();
- if (!string.IsNullOrEmpty(ifBlock))
- Default_ProxyIfBlock = ifBlock.Equals("1") || ifBlock.Equals("true");
- Default_ProxyUser = Rules.GetValue(line, Rules.KEYS.Proxy, Rules.SUB_KEYS.User, out _, out _, Variables);
- Default_ProxyPass = Rules.GetValue(line, Rules.KEYS.Proxy, Rules.SUB_KEYS.Pass, out _, out _, Variables);
- }
-
- // Get ProxyMainRules (Client|Domain|ProxyRules)
- else if (line.Contains('|'))
- {
- string[] split = line.Split('|');
- if (split.Length == 2) SetDomainRules(Rules.KEYS.AllClients, split[0].Trim(), split[1].Trim());
- if (split.Length == 3) SetDomainRules(split[0].Trim(), split[1].Trim(), split[2].Trim());
- }
- }
- }
-
- private void SetDomainRules(string client, string domain, string rules) // rules Ends With ;
- {
- try
- {
- ProxyMainRules pmr = new()
- {
- Client = client, // Client
- Domain = domain // Domain
- };
-
- // Block
- if (rules.Equals("block;", StringComparison.InvariantCultureIgnoreCase)) pmr.IsBlock = true;
- if (rules.Equals("-;")) pmr.IsBlock = true;
-
- if (!pmr.IsBlock)
- {
- // No Bypass
- if (rules.Contains("nobypass;", StringComparison.InvariantCultureIgnoreCase)) pmr.NoBypass = true;
- if (rules.Contains("--;")) pmr.NoBypass = true;
-
- // Fake DNS
- string fakeDnsIpStr = Rules.GetValue(rules, Rules.KEYS.FirstKey, null, out _, out _, Variables);
- bool isIp = NetworkTool.IsIp(fakeDnsIpStr, out _);
- if (isIp) pmr.FakeDns = fakeDnsIpStr;
-
- // BlockPort
- string ports = Rules.GetValue(rules, Rules.KEYS.BlockPort, null, out bool isList, out List list, Variables);
- if (!isList) // One Port
- {
- bool success = int.TryParse(ports, out int port);
- if (success) pmr.BlockPort.Add(port);
- }
- else // Multiple Ports
- {
- for (int i = 0; i < list.Count; i++)
- {
- string portStr = list[i];
- bool success = int.TryParse(portStr, out int port);
- if (success) pmr.BlockPort.Add(port);
- }
- }
- if (Default_BlockPort.Any())
- {
- try
- {
- pmr.BlockPort = pmr.BlockPort.Concat(Default_BlockPort).ToList();
- pmr.BlockPort = pmr.BlockPort.Distinct().ToList();
- }
- catch (Exception) { }
- }
-
- // Dnss
- string dnss = Rules.GetValue(rules, Rules.KEYS.Dns, null, out isList, out list, Variables);
- if (!isList) // One Dns
- {
- if (!string.IsNullOrEmpty(dnss))
- pmr.Dnss.Add(dnss);
- }
- else // Multiple Dnss
- {
- for (int i = 0; i < list.Count; i++)
- {
- string dns = list[i];
- if (!string.IsNullOrEmpty(dns))
- pmr.Dnss.Add(dns);
- }
- }
-
- if (!pmr.Dnss.Any() && Default_Dnss.Any()) pmr.Dnss = Default_Dnss;
-
- // DnsDomain
- pmr.DnsDomain = Rules.GetValue(rules, Rules.KEYS.DnsDomain, null, out _, out _, Variables);
- if (string.IsNullOrEmpty(pmr.DnsDomain)) pmr.DnsDomain = Default_DnsDomain;
-
- // DnsProxy e.g. socks5://127.0.0.1:6666&user:UserName&pass:PassWord
- pmr.DnsProxyScheme = Rules.GetValue(rules, Rules.KEYS.DnsProxy, Rules.SUB_KEYS.FirstKey, out _, out _, Variables);
- pmr.DnsProxyUser = Rules.GetValue(rules, Rules.KEYS.DnsProxy, Rules.SUB_KEYS.User, out _, out _, Variables);
- pmr.DnsProxyPass = Rules.GetValue(rules, Rules.KEYS.DnsProxy, Rules.SUB_KEYS.Pass, out _, out _, Variables);
- if (string.IsNullOrEmpty(pmr.DnsProxyScheme))
- {
- pmr.DnsProxyScheme = Default_DnsProxyScheme;
- pmr.DnsProxyUser = Default_DnsProxyUser;
- pmr.DnsProxyPass = Default_DnsProxyPass;
- }
-
- // SNI
- pmr.Sni = Rules.GetValue(rules, Rules.KEYS.Sni, null, out _, out _, Variables);
- if (string.IsNullOrEmpty(pmr.Sni)) pmr.Sni = Default_Sni;
-
- // Proxy e.g. socks5://127.0.0.1:6666&ifblock:1&user:UserName&pass:PassWord
- pmr.ProxyScheme = Rules.GetValue(rules, Rules.KEYS.Proxy, Rules.SUB_KEYS.FirstKey, out _, out _, Variables);
- string ifBlock = Rules.GetValue(rules, Rules.KEYS.Proxy, Rules.SUB_KEYS.IfBlock, out _, out _, Variables).ToLower().Trim();
- if (!string.IsNullOrEmpty(ifBlock))
- pmr.ProxyIfBlock = ifBlock.Equals("1") || ifBlock.Equals("true");
- pmr.ProxyUser = Rules.GetValue(rules, Rules.KEYS.Proxy, Rules.SUB_KEYS.User, out _, out _, Variables);
- pmr.ProxyPass = Rules.GetValue(rules, Rules.KEYS.Proxy, Rules.SUB_KEYS.Pass, out _, out _, Variables);
- if (string.IsNullOrEmpty(pmr.ProxyScheme))
- {
- pmr.ProxyScheme = Default_ProxyScheme;
- pmr.ProxyIfBlock = Default_ProxyIfBlock;
- pmr.ProxyUser = Default_ProxyUser;
- pmr.ProxyPass = Default_ProxyPass;
- }
- }
-
- MainRules_List.Add(pmr);
- }
- catch (Exception ex)
- {
- Debug.WriteLine("Proxy Rules_SetDomainRules: " + ex.Message);
- }
- }
-
- }
-}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/ProxyRules_ConnectToUpStream.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/ProxyRules_ConnectToUpStream.cs
deleted file mode 100644
index f833f6d..0000000
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/ProxyRules_ConnectToUpStream.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using MsmhToolsClass.ProxifiedClients;
-using System.Net.Sockets;
-
-namespace MsmhToolsClass.MsmhAgnosticServer;
-
-public partial class AgnosticProgram
-{
- public partial class ProxyRules
- {
- public async Task ConnectToUpStream(ProxyRequest req)
- {
- ProxyRulesResult prr = req.RulesResult;
- string destHostname = req.Address;
- int destHostPort = req.Port;
-
- if (!prr.ApplyUpStreamProxy) return null;
- if (string.IsNullOrEmpty(prr.ProxyScheme)) return null;
-
- ProxifiedTcpClient proxifiedTcpClient = new(prr.ProxyScheme, prr.ProxyUser, prr.ProxyPass);
- var upstream = await proxifiedTcpClient.TryGetConnectedProxifiedTcpClient(destHostname, destHostPort);
- if (upstream.isSuccess && upstream.proxifiedTcpClient != null) return upstream.proxifiedTcpClient;
-
- return null;
- }
- }
-}
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/ProxyRules_Get.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/ProxyRules_Get.cs
deleted file mode 100644
index 9297a61..0000000
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/ProxyRules_Get.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-using System.Diagnostics;
-using System.Net;
-
-namespace MsmhToolsClass.MsmhAgnosticServer;
-
-public partial class AgnosticProgram
-{
- public partial class ProxyRules
- {
- public class ProxyRulesResult
- {
- public bool IsMatch { get; set; } = false;
- public bool IsBlackList { get; set; } = false;
- public bool IsPortBlock { get; set; } = false;
- public bool ApplyDpiBypass { get; set; } = true;
- public string DnsCustomDomain { get; set; } = string.Empty;
- public string Dns { get; set; } = string.Empty;
- public List Dnss { get; set; } = new();
- public string Sni { get; set; } = string.Empty;
- public bool ApplyUpStreamProxy { get; set; } = false;
- public string ProxyScheme { get; set; } = string.Empty;
- public bool ApplyUpStreamProxyToBlockedIPs { get; set; } = false;
- public string ProxyUser { get; set; } = string.Empty;
- public string ProxyPass { get; set; } = string.Empty;
- }
-
- public async Task GetAsync(string client, string host, int port, AgnosticSettings settings)
- {
- ProxyRulesResult prr = new();
- if (string.IsNullOrEmpty(host)) return prr;
-
- try
- {
- prr.Dns = host;
-
- for (int n = 0; n < MainRules_List.Count; n++)
- {
- ProxyMainRules pmr = MainRules_List[n];
-
- // Check If Match
- bool isClientMatch = !string.IsNullOrEmpty(pmr.Client) && (pmr.Client.Equals(Rules.KEYS.AllClients) || client.Equals(pmr.Client) || client.EndsWith(pmr.Client));
- bool isDomainMatch = Rules.IsDomainMatch(host, pmr.Domain, out bool isWildcard, out string hostNoWww, out string ruleHostNoWww);
- bool isMatch = isClientMatch && isDomainMatch;
- if (!isMatch) continue;
-
- // Set Match
- prr.IsMatch = isMatch;
-
- // Is Black List
- prr.IsBlackList = pmr.IsBlock;
- if (prr.IsBlackList) break;
-
- // Is Port Block
- List blockedPorts = pmr.BlockPort.ToList();
- for (int i = 0; i < blockedPorts.Count; i++)
- {
- int blockedPort = blockedPorts[i];
- if (port == blockedPort)
- {
- prr.IsPortBlock = true;
- break;
- }
- }
- if (prr.IsPortBlock) break;
-
- // Apply DPI Bypass (Fragment & Change SNI)
- prr.ApplyDpiBypass = !pmr.NoBypass;
-
- // DNS
- if (!string.IsNullOrEmpty(pmr.FakeDns))
- {
- // Fake DNS
- prr.Dns = pmr.FakeDns;
- }
- else
- {
- // Get Dns Servers And Upstream Proxy
- List dnss = pmr.Dnss.Any() ? pmr.Dnss : settings.DNSs;
- prr.Dnss = dnss;
- string? dnsProxyScheme = null, dnsProxyUser = null, dnsProxyPass = null;
- if (!string.IsNullOrEmpty(pmr.DnsProxyScheme))
- {
- dnsProxyScheme = pmr.DnsProxyScheme;
- dnsProxyUser = pmr.DnsProxyUser;
- dnsProxyPass = pmr.DnsProxyPass;
- }
- else
- {
- dnsProxyScheme = settings.UpstreamProxyScheme;
- dnsProxyUser = settings.UpstreamProxyUser;
- dnsProxyPass = settings.UpstreamProxyPass;
- }
-
- // Get IP By Custom DNS
- if (dnss.Any() && !NetworkTool.IsIp(host, out _))
- {
- // Get Custom DNS Domain
- prr.DnsCustomDomain = host;
- if (!string.IsNullOrEmpty(pmr.DnsDomain))
- {
- if (!pmr.DnsDomain.StartsWith("*."))
- {
- prr.DnsCustomDomain = pmr.DnsDomain;
- }
- else
- {
- // Support: xxxx.example.com -> xxxx.domain.com
- if (isWildcard) // ruleHostNoWww.StartsWith("*.")
- {
- if (hostNoWww.EndsWith(ruleHostNoWww[1..])) // Just In Case
- {
- prr.DnsCustomDomain = hostNoWww.Replace(ruleHostNoWww[1..], pmr.DnsDomain[1..]);
- }
- }
- }
- }
-
- IPAddress ipv4Addr = IPAddress.None;
- if (settings.IsIPv4SupportedByISP)
- {
- ipv4Addr = await GetIP.GetIpFromDnsAddressAsync(prr.DnsCustomDomain, dnss, settings.AllowInsecure, settings.DnsTimeoutSec, false, settings.BootstrapIpAddress, settings.BootstrapPort, dnsProxyScheme, dnsProxyUser, dnsProxyPass);
- if (ipv4Addr.Equals(IPAddress.None) && !settings.IsIPv6SupportedByISP) // Retry If IPv6 Is Not Supported
- ipv4Addr = await GetIP.GetIpFromDnsAddressAsync(prr.DnsCustomDomain, dnss, settings.AllowInsecure, settings.DnsTimeoutSec, false, settings.BootstrapIpAddress, settings.BootstrapPort, dnsProxyScheme, dnsProxyUser, dnsProxyPass);
- }
-
- if (ipv4Addr.Equals(IPAddress.None))
- {
- IPAddress ipv6Addr = await GetIP.GetIpFromDnsAddressAsync(prr.DnsCustomDomain, dnss, settings.AllowInsecure, settings.DnsTimeoutSec, true, settings.BootstrapIpAddress, settings.BootstrapPort, dnsProxyScheme, dnsProxyUser, dnsProxyPass);
- if (!ipv6Addr.Equals(IPAddress.IPv6None))
- prr.Dns = ipv6Addr.ToString();
- }
- else
- {
- if (string.IsNullOrEmpty(settings.CloudflareCleanIP))
- prr.Dns = ipv4Addr.ToString();
- else
- prr.Dns = CommonTools.IsCfIP(ipv4Addr) ? settings.CloudflareCleanIP : ipv4Addr.ToString();
- }
- }
- }
-
- // SNI
- prr.Sni = pmr.Sni;
- if (!string.IsNullOrEmpty(prr.Sni) && prr.Sni.StartsWith("*."))
- {
- // Support: xxxx.example.com -> xxxx.domain.com
- if (isWildcard) // ruleHostNoWww.StartsWith("*.")
- {
- if (hostNoWww.EndsWith(ruleHostNoWww[1..])) // Just In Case
- {
- prr.Sni = hostNoWww.Replace(ruleHostNoWww[1..], prr.Sni[1..]);
- }
- }
- }
- if (string.IsNullOrEmpty(prr.Sni)) prr.Sni = host; // Set SNI To Original Host If Not Defined
-
- // Upstream Proxy
- if (!string.IsNullOrEmpty(pmr.ProxyScheme))
- {
- pmr.ProxyScheme = pmr.ProxyScheme.ToLower().Trim();
- if (pmr.ProxyScheme.StartsWith("http://", StringComparison.OrdinalIgnoreCase) ||
- pmr.ProxyScheme.StartsWith("https://", StringComparison.OrdinalIgnoreCase) ||
- pmr.ProxyScheme.StartsWith("socks5://", StringComparison.OrdinalIgnoreCase))
- {
- prr.ApplyUpStreamProxy = true;
- prr.ProxyScheme = pmr.ProxyScheme;
- prr.ApplyUpStreamProxyToBlockedIPs = pmr.ProxyIfBlock;
- prr.ProxyUser = pmr.ProxyUser;
- prr.ProxyPass = pmr.ProxyPass;
- }
- }
-
- // Break If Match
- break;
- }
- }
- catch (Exception ex)
- {
- Debug.WriteLine("ProxyRules_GetAsync: " + ex.Message);
- }
-
- return prr;
- }
-
- }
-}
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/Rules.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/Rules.cs
index 5c015b5..c38fca2 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/Rules.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/Rules.cs
@@ -1,174 +1,743 @@
using System.Diagnostics;
+using static MsmhToolsClass.MsmhAgnosticServer.AgnosticProgram.Rules;
namespace MsmhToolsClass.MsmhAgnosticServer;
public partial class AgnosticProgram
{
- public static class Rules
+ public partial class Rules
{
- public readonly struct KEYS
+ public enum Mode
{
- public static readonly string FirstKey = "FirstKey";
- public static readonly string AllClients = "AllClients";
- public static readonly string BlockPort = "blockport:";
- public static readonly string Dns = "dns:";
- public static readonly string DnsDomain = "dnsdomain:";
- public static readonly string DnsProxy = "dnsproxy:";
- public static readonly string Sni = "sni:";
- public static readonly string Proxy = "proxy:";
+ File,
+ Text,
+ Disable
}
- public readonly struct SUB_KEYS
+ public enum AddressType
{
- public static readonly string FirstKey = "FirstKey";
- public static readonly string IfBlock = "&ifblock:";
- public static readonly string User = "&user:";
- public static readonly string Pass = "&pass:";
+ Domain,
+ IP,
+ CIDR,
+ None
}
- public static string GetValue(string line, string key, string? subKey, out bool isList, out List list, List> variables)
+ public Mode RulesMode { get; private set; } = Mode.Disable;
+ public string PathOrText { get; private set; } = string.Empty;
+ public string TextContent { get; private set; } = string.Empty;
+
+ private List Rules_List { get; set; } = new();
+ private List> Variables { get; set; } = new(); // x = domain.com;
+ private Defaults Default { get; set; } = new();
+ //private List Default_BlockPort { get; set; } = new(); // blockport:80,53;
+ //private List Default_Dnss { get; set; } = new(); // dns:;
+ //private string Default_DnsDomain { get; set; } = string.Empty; // dnsdomain:;
+ //private string Default_DnsProxyScheme { get; set; } = string.Empty; // dnsproxy:;
+ //private string Default_DnsProxyUser { get; set; } = string.Empty; // &user:
+ //private string Default_DnsProxyPass { get; set; } = string.Empty; // &pass:
+ //private string Default_Sni { get; set; } = string.Empty; // sni:;
+ //private string Default_ProxyScheme { get; set; } = string.Empty; // proxy:;
+ //private bool Default_ProxyIfBlock { get; set; } = false; // &ifblock:1
+ //private string Default_ProxyUser { get; set; } = string.Empty; // &user:
+ //private string Default_ProxyPass { get; set; } = string.Empty; // &pass:
+ private List MainRules_List { get; set; } = new();
+
+ public class Defaults
{
- string result = line.Trim();
- isList = false;
- list = new();
+ public List BlockPort { get; set; } = new(); // blockport:80,53;
+ public List Dnss { get; set; } = new(); // dns:;
+ public string DnsDomain { get; set; } = string.Empty; // dnsdomain:;
+ public string DnsProxyScheme { get; set; } = string.Empty; // dnsproxy:;
+ public string DnsProxyUser { get; set; } = string.Empty; // &user:
+ public string DnsProxyPass { get; set; } = string.Empty; // &pass:
+ public string Sni { get; set; } = string.Empty; // sni:;
+ public string ProxyScheme { get; set; } = string.Empty; // proxy:;
+ public bool ProxyIfBlock { get; set; } = false; // &ifblock:1
+ public string ProxyUser { get; set; } = string.Empty; // &user:
+ public string ProxyPass { get; set; } = string.Empty; // &pass:
+ }
+
+ public class MainRules
+ {
+ public string Client { get; set; } = string.Empty;
+ public AddressType AddressType { get; set; } = AddressType.None;
+ public string Address { get; set; } = string.Empty;
+ public bool IsBlock { get; set; } = false;
+ public List BlockPort { get; set; } = new();
+ public bool IsDirect { get; set; } = false;
+ public string FakeDns { get; set; } = string.Empty;
+ public List Dnss { get; set; } = new();
+ public string DnsDomain { get; set; } = string.Empty;
+ public string DnsProxyScheme { get; set; } = string.Empty;
+ public string DnsProxyUser { get; set; } = string.Empty;
+ public string DnsProxyPass { get; set; } = string.Empty;
+ public string Sni { get; set; } = string.Empty;
+ public string ProxyScheme { get; set; } = string.Empty;
+ public bool ProxyIfBlock { get; set; } = false;
+ public string ProxyUser { get; set; } = string.Empty;
+ public string ProxyPass { get; set; } = string.Empty;
+ }
+
+ public Rules() { }
+ public async Task SetAsync(Mode mode, string filePathOrText)
+ {
try
{
- if (result.Contains(key, StringComparison.InvariantCultureIgnoreCase) || key == KEYS.FirstKey)
+ Rules_List.Clear();
+ Variables.Clear();
+ MainRules_List.Clear();
+
+ RulesMode = mode;
+ PathOrText = filePathOrText;
+
+ if (RulesMode == Mode.Disable) return;
+
+ if (RulesMode == Mode.File)
{
try
{
- if (key == KEYS.FirstKey)
- {
- result = result.Remove(result.IndexOf(';'));
- result = result.Trim();
- }
- else
+ TextContent = File.ReadAllText(Path.GetFullPath(filePathOrText));
+ }
+ catch (Exception) { }
+ }
+ else if (RulesMode == Mode.Text) TextContent = filePathOrText;
+
+ if (string.IsNullOrEmpty(TextContent) || string.IsNullOrWhiteSpace(TextContent)) return;
+
+ TextContent += Environment.NewLine;
+ Rules_List = TextContent.SplitToLines();
+
+ for (int n = 0; n < Rules_List.Count; n++)
+ {
+ string line = Rules_List[n].Trim();
+ if (line.StartsWith("//")) continue; // Support Comment //
+ if (!line.EndsWith(';')) continue; // Must Have ; At The End
+ if (string.IsNullOrEmpty(line) || string.IsNullOrWhiteSpace(line)) continue; // Line Cannot Be Empty
+
+ // Get Variables
+ if (line.Contains('=') && !line.Contains(',') && !line.Contains('&') && !line.Contains('|'))
+ {
+ line = line.TrimEnd(';');
+ string[] split = line.Split('=');
+ if (split.Length == 2)
{
- result = result.Remove(0, result.IndexOf(key, StringComparison.InvariantCultureIgnoreCase) + key.Length);
- result = result.Remove(result.IndexOf(';'));
- result = result.Trim();
+ string item1 = split[0].Trim();
+ string item2 = split[1].Trim();
+ if (!string.IsNullOrEmpty(item1) && !string.IsNullOrEmpty(item2))
+ Variables.Add(new Tuple(item1, item2));
}
}
- catch (Exception) { }
- if (!string.IsNullOrEmpty(subKey))
+ // Get Defaults
+ else if (line.StartsWith(Rules_Init.KEYS.BlockPort, StringComparison.InvariantCultureIgnoreCase))
{
- if (subKey.Equals(SUB_KEYS.FirstKey, StringComparison.InvariantCultureIgnoreCase))
+ string ports = Rules_Init.GetValue(line, Rules_Init.KEYS.BlockPort, null, out bool isList, out List list, Variables);
+ if (!isList) // One Port
+ {
+ bool success = int.TryParse(ports, out int port);
+ if (success) Default.BlockPort.Add(port);
+ }
+ else // Multiple Ports
{
- if (result.Contains('&'))
+ for (int i = 0; i < list.Count; i++)
{
- try
- {
- result = result.Remove(result.IndexOf('&'));
- }
- catch (Exception) { }
+ string portStr = list[i];
+ bool success = int.TryParse(portStr, out int port);
+ if (success) Default.BlockPort.Add(port);
}
}
- else
+ continue;
+ }
+ else if (line.StartsWith(Rules_Init.KEYS.Dns, StringComparison.InvariantCultureIgnoreCase))
+ {
+ string dnss = Rules_Init.GetValue(line, Rules_Init.KEYS.Dns, null, out bool isList, out List list, Variables);
+ if (!isList) // One Dns
{
- if (result.Contains(subKey, StringComparison.InvariantCultureIgnoreCase))
+ if (!string.IsNullOrEmpty(dnss))
+ Default.Dnss.Add(dnss);
+ }
+ else // Multiple Dnss
+ {
+ for (int i = 0; i < list.Count; i++)
{
- try
- {
- result = result.Remove(0, result.IndexOf(subKey, StringComparison.InvariantCultureIgnoreCase) + subKey.Length);
- }
- catch (Exception) { }
-
- if (result.Contains('&') && result.Contains(':'))
- {
- try
- {
- result = result.Remove(result.IndexOf('&'));
- }
- catch (Exception) { }
- }
+ string dns = list[i];
+ if (!string.IsNullOrEmpty(dns))
+ Default.Dnss.Add(dns);
}
}
}
+ else if (line.StartsWith(Rules_Init.KEYS.DnsDomain, StringComparison.InvariantCultureIgnoreCase))
+ {
+ Default.DnsDomain = Rules_Init.GetValue(line, Rules_Init.KEYS.DnsDomain, null, out _, out _, Variables);
+ }
+ else if (line.StartsWith(Rules_Init.KEYS.DnsProxy, StringComparison.InvariantCultureIgnoreCase))
+ {
+ Default.DnsProxyScheme = Rules_Init.GetValue(line, Rules_Init.KEYS.DnsProxy, Rules_Init.SUB_KEYS.FirstKey, out _, out _, Variables);
+ Default.DnsProxyUser = Rules_Init.GetValue(line, Rules_Init.KEYS.DnsProxy, Rules_Init.SUB_KEYS.User, out _, out _, Variables);
+ Default.DnsProxyPass = Rules_Init.GetValue(line, Rules_Init.KEYS.DnsProxy, Rules_Init.SUB_KEYS.Pass, out _, out _, Variables);
+ }
+ else if (line.StartsWith(Rules_Init.KEYS.Sni, StringComparison.InvariantCultureIgnoreCase))
+ {
+ Default.Sni = Rules_Init.GetValue(line, Rules_Init.KEYS.Sni, null, out _, out _, Variables);
+ }
+ else if (line.StartsWith(Rules_Init.KEYS.Proxy, StringComparison.InvariantCultureIgnoreCase))
+ {
+ Default.ProxyScheme = Rules_Init.GetValue(line, Rules_Init.KEYS.Proxy, Rules_Init.SUB_KEYS.FirstKey, out _, out _, Variables);
+ string ifBlock = Rules_Init.GetValue(line, Rules_Init.KEYS.Proxy, Rules_Init.SUB_KEYS.IfBlock, out _, out _, Variables).ToLower().Trim();
+ if (!string.IsNullOrEmpty(ifBlock))
+ Default.ProxyIfBlock = ifBlock.Equals("1") || ifBlock.Equals("true", StringComparison.OrdinalIgnoreCase);
+ Default.ProxyUser = Rules_Init.GetValue(line, Rules_Init.KEYS.Proxy, Rules_Init.SUB_KEYS.User, out _, out _, Variables);
+ Default.ProxyPass = Rules_Init.GetValue(line, Rules_Init.KEYS.Proxy, Rules_Init.SUB_KEYS.Pass, out _, out _, Variables);
+ }
- if (!result.Contains(','))
+ // Get ProxyMainRules (Client|Address|ProxyRules)
+ // Address: Domain, Subdomain, IP, CIDR
+ else if (line.Contains('|'))
{
- // Not A List
- return ApplyVariables(result, variables);
+ string[] split = line.Split('|');
+ if (split.Length == 2) await Set_FullAddress_Rules_Async(Rules_Init.KEYS.AllClients, split[0].Trim(), split[1].Trim());
+ if (split.Length == 3) await Set_FullAddress_Rules_Async(split[0].Trim(), split[1].Trim(), split[2].Trim());
}
- else
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Rules SetAsync: " + ex.Message);
+ }
+ }
+
+ private async Task Set_FullAddress_Rules_Async(string client, string fullAddress, string rules) // rules Ends With ;
+ {
+ await Task.Run(async () =>
+ {
+ try
+ {
+ if (fullAddress.StartsWith('"')) fullAddress = fullAddress.TrimStart('"');
+ if (fullAddress.EndsWith('"')) fullAddress = fullAddress.TrimEnd('"');
+ if (fullAddress.StartsWith('/')) fullAddress = fullAddress.TrimStart('/');
+ if (fullAddress.EndsWith('/')) fullAddress = fullAddress.TrimEnd('/');
+
+ bool isPath = false;
+ try
{
- // It's A List
- isList = true;
- string[] split = result.Split(',');
- for (int n = 0; n < split.Length; n++)
+ string fullPath = Path.GetFullPath(fullAddress);
+ isPath = File.Exists(fullPath);
+ }
+ catch (Exception) { }
+
+ if (isPath)
+ {
+ // Is Path
+ List addressList = new();
+ await addressList.LoadFromFileAsync(fullAddress, true, true);
+ if (addressList.Count > 0)
{
- string value = split[n].Trim();
- list.Add(ApplyVariables(value, variables));
+ for (int n = 0; n < addressList.Count; n++)
+ {
+ string address = addressList[n];
+ if (!address.StartsWith("//"))
+ Set_DomainIP_Rules(client, address, rules);
+ }
}
- if (list.Any()) return list[0];
+ }
+ else
+ {
+ // Is Address (Domain, Subdomain, IP, CIDR)
+ string address = fullAddress;
+ if (!address.StartsWith("//"))
+ Set_DomainIP_Rules(client, address, rules);
}
}
- }
- catch (Exception) { }
-
- return string.Empty;
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Rules Set_DomainIpPath_Rules: " + ex.Message);
+ }
+ });
}
- private static string ApplyVariables(string vari, List> variables)
+ private void Set_DomainIP_Rules(string client, string address, string rules) // rules Ends With ;
{
- string result = vari;
try
{
- variables = variables.ToList();
- for (int n = 0; n < variables.Count; n++)
+ MainRules mr = new()
+ {
+ Client = client, // Client
+ AddressType = GetAddressType(address), // Address Type
+ Address = address // Domain Or IP
+ };
+
+ // Block
+ if (rules.Equals("block;", StringComparison.InvariantCultureIgnoreCase)) mr.IsBlock = true;
+ if (rules.Equals("-;")) mr.IsBlock = true;
+
+ if (!mr.IsBlock)
{
- Tuple tuple = variables[n];
- if (vari.Equals(tuple.Item1))
+ // Direct
+ if (rules.Contains("nobypass;", StringComparison.InvariantCultureIgnoreCase)) mr.IsDirect = true;
+ if (rules.Contains("direct;", StringComparison.InvariantCultureIgnoreCase)) mr.IsDirect = true;
+ if (rules.Contains("--;")) mr.IsDirect = true;
+
+ // Fake DNS
+ string fakeDnsIpStr = Rules_Init.GetValue(rules, Rules_Init.KEYS.FirstKey, null, out _, out _, Variables);
+ bool isIp = NetworkTool.IsIP(fakeDnsIpStr, out _);
+ if (isIp) mr.FakeDns = fakeDnsIpStr;
+
+ // BlockPort
+ string ports = Rules_Init.GetValue(rules, Rules_Init.KEYS.BlockPort, null, out bool isList, out List list, Variables);
+ if (!isList) // One Port
{
- result = tuple.Item2; break;
+ bool success = int.TryParse(ports, out int port);
+ if (success) mr.BlockPort.Add(port);
+ }
+ else // Multiple Ports
+ {
+ for (int i = 0; i < list.Count; i++)
+ {
+ string portStr = list[i];
+ bool success = int.TryParse(portStr, out int port);
+ if (success) mr.BlockPort.Add(port);
+ }
+ }
+ if (Default.BlockPort.Any())
+ {
+ try
+ {
+ mr.BlockPort.AddRange(Default.BlockPort);
+ mr.BlockPort = mr.BlockPort.Distinct().ToList();
+ }
+ catch (Exception) { }
+ }
+
+ if (mr.AddressType == AddressType.Domain) // DNSs, DnsDomain, DnsProxy & SNI
+ {
+ // Dnss
+ string dnss = Rules_Init.GetValue(rules, Rules_Init.KEYS.Dns, null, out isList, out list, Variables);
+ if (!isList) // One Dns
+ {
+ if (!string.IsNullOrEmpty(dnss))
+ mr.Dnss.Add(dnss);
+ }
+ else // Multiple Dnss
+ {
+ for (int i = 0; i < list.Count; i++)
+ {
+ string dns = list[i];
+ if (!string.IsNullOrEmpty(dns))
+ mr.Dnss.Add(dns);
+ }
+ }
+
+ if (!mr.Dnss.Any() && Default.Dnss.Any()) mr.Dnss = Default.Dnss;
+
+ // DnsDomain
+ mr.DnsDomain = Rules_Init.GetValue(rules, Rules_Init.KEYS.DnsDomain, null, out _, out _, Variables);
+ if (string.IsNullOrEmpty(mr.DnsDomain)) mr.DnsDomain = Default.DnsDomain;
+
+ // DnsProxy e.g. socks5://127.0.0.1:6666&user:UserName&pass:PassWord
+ mr.DnsProxyScheme = Rules_Init.GetValue(rules, Rules_Init.KEYS.DnsProxy, Rules_Init.SUB_KEYS.FirstKey, out _, out _, Variables);
+ mr.DnsProxyUser = Rules_Init.GetValue(rules, Rules_Init.KEYS.DnsProxy, Rules_Init.SUB_KEYS.User, out _, out _, Variables);
+ mr.DnsProxyPass = Rules_Init.GetValue(rules, Rules_Init.KEYS.DnsProxy, Rules_Init.SUB_KEYS.Pass, out _, out _, Variables);
+ if (string.IsNullOrEmpty(mr.DnsProxyScheme))
+ {
+ mr.DnsProxyScheme = Default.DnsProxyScheme;
+ mr.DnsProxyUser = Default.DnsProxyUser;
+ mr.DnsProxyPass = Default.DnsProxyPass;
+ }
+
+ // SNI
+ mr.Sni = Rules_Init.GetValue(rules, Rules_Init.KEYS.Sni, null, out _, out _, Variables);
+ if (string.IsNullOrEmpty(mr.Sni)) mr.Sni = Default.Sni;
+ }
+
+ // Proxy e.g. socks5://127.0.0.1:6666&ifblock:1&user:UserName&pass:PassWord
+ mr.ProxyScheme = Rules_Init.GetValue(rules, Rules_Init.KEYS.Proxy, Rules_Init.SUB_KEYS.FirstKey, out _, out _, Variables);
+ string ifBlock = Rules_Init.GetValue(rules, Rules_Init.KEYS.Proxy, Rules_Init.SUB_KEYS.IfBlock, out _, out _, Variables).ToLower().Trim();
+ if (!string.IsNullOrEmpty(ifBlock))
+ mr.ProxyIfBlock = ifBlock.Equals("1") || ifBlock.Equals("true");
+ mr.ProxyUser = Rules_Init.GetValue(rules, Rules_Init.KEYS.Proxy, Rules_Init.SUB_KEYS.User, out _, out _, Variables);
+ mr.ProxyPass = Rules_Init.GetValue(rules, Rules_Init.KEYS.Proxy, Rules_Init.SUB_KEYS.Pass, out _, out _, Variables);
+ if (string.IsNullOrEmpty(mr.ProxyScheme))
+ {
+ mr.ProxyScheme = Default.ProxyScheme;
+ mr.ProxyIfBlock = Default.ProxyIfBlock;
+ mr.ProxyUser = Default.ProxyUser;
+ mr.ProxyPass = Default.ProxyPass;
}
}
+
+ lock (MainRules_List) // Just In Case
+ {
+ MainRules_List.Add(mr);
+ }
}
catch (Exception ex)
{
- Debug.WriteLine("Rules_ApplyVariables: " + ex.Message);
+ Debug.WriteLine("Rules Set_DomainIP_Rules: " + ex.Message);
}
- return result;
}
- public static bool IsDomainMatch(string host, string ruleHost, out bool isWildcard, out string hostNoWWW, out string ruleHostNoWWW)
+ private static AddressType GetAddressType(string address)
{
- isWildcard = false;
- hostNoWWW = host.ToLower().Trim();
- ruleHostNoWWW = ruleHost.ToLower().Trim();
+ AddressType addressType = AddressType.None;
try
{
- if (hostNoWWW.StartsWith("www."))
- hostNoWWW = hostNoWWW.TrimStart("www.");
- if (hostNoWWW.EndsWith('/')) hostNoWWW = hostNoWWW[0..^1];
+ if (address.Contains('/'))
+ {
+ addressType = AddressType.CIDR;
+ }
+ else
+ {
+ bool isIP = NetworkTool.IsIP(address, out _);
+ if (isIP) addressType = AddressType.IP;
+ else addressType = AddressType.Domain;
+ }
+ }
+ catch (Exception) { }
- if (ruleHostNoWWW.StartsWith("www."))
- ruleHostNoWWW = ruleHostNoWWW.TrimStart("www.");
- if (ruleHostNoWWW.EndsWith('/')) ruleHostNoWWW = ruleHostNoWWW[0..^1];
+ return addressType;
+ }
- if (!string.IsNullOrEmpty(ruleHostNoWWW))
+ public static async Task<(List> Variables, Defaults Defaults, List MainRulesList)> MergeAsync(Mode mode1, string filePathOrText1, Mode mode2, string filePathOrText2)
+ {
+ // Create Merged Rules
+ List> variables = new();
+ Defaults defaults = new();
+ List mainRules = new();
+
+ await Task.Run(async () =>
+ {
+ try
{
- if (ruleHostNoWWW.Equals("*")) return true; // No Wildcard
+ // Read Rules1
+ Rules rules1 = new();
+ await rules1.SetAsync(mode1, filePathOrText1);
+ await Task.Delay(100);
+
+ // Read Rules2
+ Rules rules2 = new();
+ await rules2.SetAsync(mode2, filePathOrText2);
+ await Task.Delay(100);
- if (!ruleHostNoWWW.StartsWith("*."))
+ // Get Variables
+ variables.AddRange(rules1.Variables);
+ variables.AddRange(rules2.Variables);
+ variables = variables.DistinctBy(x => x.Item1).ToList();
+
+ // Get Default Rules
+ // blockport:80,53;
+ defaults.BlockPort.AddRange(rules1.Default.BlockPort);
+ defaults.BlockPort.AddRange(rules2.Default.BlockPort);
+ defaults.BlockPort = defaults.BlockPort.Distinct().ToList();
+ defaults.BlockPort.Sort();
+ // dns:;
+ defaults.Dnss.AddRange(rules1.Default.Dnss);
+ defaults.Dnss.AddRange(rules2.Default.Dnss);
+ defaults.Dnss = defaults.Dnss.Distinct().ToList();
+ // dnsdomain:;
+ string dnsDomain = !string.IsNullOrWhiteSpace(rules2.Default.DnsDomain) ? rules2.Default.DnsDomain : rules1.Default.DnsDomain;
+ defaults.DnsDomain = dnsDomain.ToLower().Trim();
+ // dnsproxy:;
+ string dnsProxy = rules1.Default.DnsProxyScheme;
+ string dnsProxyUser = rules1.Default.DnsProxyUser;
+ string dnsProxyPass = rules1.Default.DnsProxyPass;
+ if (!string.IsNullOrWhiteSpace(rules2.Default.DnsProxyScheme))
{
- // No Wildcard
- if (ruleHostNoWWW.Equals(hostNoWWW)) return true;
+ dnsProxy = rules2.Default.DnsProxyScheme;
+ dnsProxyUser = rules2.Default.DnsProxyUser;
+ dnsProxyPass = rules2.Default.DnsProxyPass;
}
- else
+ defaults.DnsProxyScheme = dnsProxy.ToLower().Trim();
+ defaults.DnsProxyUser = dnsProxyUser;
+ defaults.DnsProxyPass = dnsProxyPass;
+ // sni:;
+ string sni = !string.IsNullOrWhiteSpace(rules2.Default.Sni) ? rules2.Default.Sni : rules1.Default.Sni;
+ defaults.Sni = sni.Trim();
+ // proxy:;
+ string proxy = rules1.Default.ProxyScheme;
+ string proxyUser = rules1.Default.ProxyUser;
+ string proxyPass = rules1.Default.ProxyPass;
+ bool proxyIfBlock = rules2.Default.ProxyIfBlock ? rules2.Default.ProxyIfBlock : rules1.Default.ProxyIfBlock;
+ if (!string.IsNullOrWhiteSpace(rules2.Default.ProxyScheme))
+ {
+ proxy = rules2.Default.ProxyScheme;
+ proxyUser = rules2.Default.ProxyUser;
+ proxyPass = rules2.Default.ProxyPass;
+ }
+ defaults.ProxyScheme = proxy.ToLower().Trim();
+ defaults.ProxyUser = proxyUser;
+ defaults.ProxyPass = proxyPass;
+ defaults.ProxyIfBlock = proxyIfBlock;
+
+ // Update Rules1 With The Content Of Rules2
+ for (int n1 = 0; n1 < rules1.MainRules_List.Count; n1++)
+ {
+ MainRules mr1 = rules1.MainRules_List[n1];
+ for (int n2 = 0; n2 < rules2.MainRules_List.Count; ++n2)
+ {
+ MainRules mr2 = rules2.MainRules_List[n2];
+ if (mr1.Client.Equals(mr2.Client) && mr1.Address.Equals(mr2.Address))
+ {
+ if (mr2.IsBlock) mr1.IsBlock = true;
+ if (mr2.IsDirect) mr1.IsDirect = true;
+ if (!string.IsNullOrWhiteSpace(mr2.FakeDns)) mr1.FakeDns = mr2.FakeDns;
+ mr1.BlockPort.AddRange(mr2.BlockPort);
+ mr1.BlockPort = mr1.BlockPort.Distinct().ToList();
+ mr1.BlockPort.Sort();
+ mr1.Dnss.AddRange(mr2.Dnss);
+ mr1.Dnss = mr1.Dnss.Distinct().ToList();
+ if (!string.IsNullOrWhiteSpace(mr2.DnsDomain)) mr1.DnsDomain = mr2.DnsDomain;
+ if (!string.IsNullOrWhiteSpace(mr2.DnsProxyScheme))
+ {
+ mr1.DnsProxyScheme = mr2.DnsProxyScheme;
+ mr1.DnsProxyUser = mr2.DnsProxyUser;
+ mr1.DnsProxyPass = mr2.DnsProxyPass;
+ }
+ if (!string.IsNullOrWhiteSpace(mr2.Sni)) mr1.Sni = mr2.Sni;
+ if (!string.IsNullOrWhiteSpace(mr2.ProxyScheme))
+ {
+ mr1.ProxyScheme = mr2.ProxyScheme;
+ if (mr2.ProxyIfBlock) mr1.ProxyIfBlock = true;
+ mr1.ProxyUser = mr2.ProxyUser;
+ mr1.ProxyPass = mr2.ProxyPass;
+ }
+
+ // Set MR2 Address To string.empty
+ mr2.Address = string.Empty;
+ break;
+ }
+ }
+ }
+
+ // Add All Rules1
+ mainRules.AddRange(rules1.MainRules_List);
+
+ // Add Rules2 If Address Is Not Empty
+ for (int n2 = 0; n2 < rules2.MainRules_List.Count; ++n2)
{
- // Wildcard
- isWildcard = true;
- if (!hostNoWWW.Equals(ruleHostNoWWW[2..]) && hostNoWWW.EndsWith(ruleHostNoWWW[1..])) return true;
+ MainRules mr2 = rules2.MainRules_List[n2];
+ if (!string.IsNullOrEmpty(mr2.Address)) mainRules.Add(mr2);
}
}
- }
- catch (Exception) { }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("AgnosticProgram Rules MergeAsync: " + ex.Message);
+ }
+ });
- return false;
+ return (variables, defaults, mainRules);
}
+
+ public static async Task> ConvertToTextRulesAsync(List>? variables, Defaults? defaults, List mainRulesList)
+ {
+ List textRules = new();
+
+ await Task.Run(() =>
+ {
+ try
+ {
+ // Add Comment
+ textRules.Add("// Generated Automatically By SDC - Secure DNS Client");
+ textRules.Add("// Please Review And Modify If Needed.");
+ textRules.Add(string.Empty);
+
+ // Add Variables
+ if (variables != null && variables.Count > 0)
+ {
+ textRules.Add("// Variables");
+ for (int n = 0; n < variables.Count; n++)
+ {
+ Tuple variable = variables[n];
+ if (!string.IsNullOrWhiteSpace(variable.Item1) && !string.IsNullOrWhiteSpace(variable.Item2))
+ {
+ string text = $"{variable.Item1} = {variable.Item2};";
+ textRules.Add(text);
+ }
+ }
+ textRules.Add(string.Empty);
+ }
+
+ // Add Defaults
+ if (defaults != null)
+ {
+ bool addDefaults = defaults.BlockPort.Count > 0 || defaults.Dnss.Count > 0 ||
+ !string.IsNullOrWhiteSpace(defaults.DnsDomain) ||
+ !string.IsNullOrWhiteSpace(defaults.DnsProxyScheme) ||
+ !string.IsNullOrWhiteSpace(defaults.Sni) ||
+ !string.IsNullOrWhiteSpace(defaults.ProxyScheme);
+ if (addDefaults)
+ {
+ textRules.Add("// Defaults");
+
+ // blockport:80,53;
+ if (defaults.BlockPort.Count > 0)
+ {
+ string text = $"{Rules_Init.KEYS.BlockPort}{Rules_Init.GetReplacedValues(defaults.BlockPort.ToString(','), variables)};";
+ textRules.Add(text);
+ }
+ // dns:;
+ if (defaults.Dnss.Count > 0)
+ {
+ string text = $"{Rules_Init.KEYS.Dns}{Rules_Init.GetReplacedValues(defaults.Dnss.ToString(','), variables)};";
+ textRules.Add(text);
+ }
+ // dnsdomain:;
+ if (!string.IsNullOrEmpty(defaults.DnsDomain))
+ {
+ string text = $"{Rules_Init.KEYS.DnsDomain}{Rules_Init.GetReplacedValues(defaults.DnsDomain, variables)};";
+ textRules.Add(text);
+ }
+ // dnsproxy:;
+ if (!string.IsNullOrEmpty(defaults.DnsProxyScheme))
+ {
+ string text = $"{Rules_Init.KEYS.DnsProxy}{Rules_Init.GetReplacedValues(defaults.DnsProxyScheme, variables)}";
+ // &user:
+ if (!string.IsNullOrWhiteSpace(defaults.DnsProxyUser))
+ text += $"{Rules_Init.SUB_KEYS.User}{Rules_Init.GetReplacedValues(defaults.DnsProxyUser, variables)}";
+ // &pass:
+ if (!string.IsNullOrEmpty(defaults.DnsProxyPass))
+ text += $"{Rules_Init.SUB_KEYS.Pass}{Rules_Init.GetReplacedValues(defaults.DnsProxyPass, variables)}";
+ // Add ;
+ text += ";";
+ textRules.Add(text);
+ }
+ // sni:;
+ if (!string.IsNullOrWhiteSpace(defaults.Sni))
+ {
+ string text = $"{Rules_Init.KEYS.Sni}{Rules_Init.GetReplacedValues(defaults.Sni, variables)};";
+ textRules.Add(text);
+ }
+ // proxy:;
+ if (!string.IsNullOrEmpty(defaults.ProxyScheme))
+ {
+ string text = $"{Rules_Init.KEYS.Proxy}{Rules_Init.GetReplacedValues(defaults.ProxyScheme, variables)}";
+ // &user:
+ if (!string.IsNullOrWhiteSpace(defaults.ProxyUser))
+ text += $"{Rules_Init.SUB_KEYS.User}{Rules_Init.GetReplacedValues(defaults.ProxyUser, variables)}";
+ // &pass:
+ if (!string.IsNullOrEmpty(defaults.ProxyPass))
+ text += $"{Rules_Init.SUB_KEYS.Pass}{Rules_Init.GetReplacedValues(defaults.ProxyPass, variables)}";
+ // &ifblock:1
+ if (defaults.ProxyIfBlock)
+ text += $"{Rules_Init.SUB_KEYS.IfBlock}1";
+ // Add ;
+ text += ";";
+ textRules.Add(text);
+ }
+ textRules.Add(string.Empty);
+ }
+ }
+
+ // Add Main Rules
+ if (mainRulesList.Count > 0) textRules.Add("// Rules");
+ for (int n = 0; n < mainRulesList.Count; n++)
+ {
+ MainRules mr = mainRulesList[n];
+ if (string.IsNullOrWhiteSpace(mr.Address)) continue;
+ string text = string.Empty;
+ // Client
+ if (!string.IsNullOrWhiteSpace(mr.Client) && !mr.Client.Equals(Rules_Init.KEYS.AllClients))
+ text += $"{mr.Client}|";
+ // Address
+ text += $"{mr.Address}|";
+ // Is Block
+ if (mr.IsBlock)
+ {
+ text += "-;";
+ continue;
+ }
+ // Fake DNS
+ bool isIP = NetworkTool.IsIP(mr.FakeDns, out _);
+ if (isIP) text += $"{Rules_Init.GetReplacedValues(mr.FakeDns, variables)};";
+ // Is Direct
+ if (mr.IsDirect) text += "--;";
+ // Block Ports
+ if (defaults != null)
+ {
+ foreach (int blockPort in defaults.BlockPort)
+ {
+ if (mr.BlockPort.IsContain(blockPort))
+ mr.BlockPort.Remove(blockPort);
+ }
+ }
+ if (mr.BlockPort.Count > 0) text += $"{Rules_Init.KEYS.BlockPort}{Rules_Init.GetReplacedValues(mr.BlockPort.ToString(','), variables)};";
+ // DNSs
+ if (defaults != null)
+ {
+ foreach (string dns in defaults.Dnss)
+ {
+ if (mr.Dnss.IsContain(dns))
+ mr.Dnss.Remove(dns);
+ }
+ }
+ if (mr.Dnss.Count > 0) text += $"{Rules_Init.KEYS.Dns}{Rules_Init.GetReplacedValues(mr.Dnss.ToString(','), variables)};";
+ // DNS Domain
+ if (defaults != null)
+ {
+ if (defaults.DnsDomain.Equals(mr.DnsDomain))
+ mr.DnsDomain = string.Empty;
+ }
+ if (!string.IsNullOrWhiteSpace(mr.DnsDomain)) text += $"{Rules_Init.KEYS.DnsDomain}{Rules_Init.GetReplacedValues(mr.DnsDomain, variables)};";
+ // DNS Proxy
+ if (defaults != null)
+ {
+ if (defaults.DnsProxyScheme.Equals(mr.DnsProxyScheme))
+ mr.DnsProxyScheme = string.Empty;
+ }
+ if (!string.IsNullOrWhiteSpace(mr.DnsProxyScheme))
+ {
+ // Scheme
+ text += $"{Rules_Init.KEYS.DnsProxy}{Rules_Init.GetReplacedValues(mr.DnsProxyScheme, variables)}";
+ // &user:
+ if (!string.IsNullOrWhiteSpace(mr.DnsProxyUser))
+ text += $"{Rules_Init.SUB_KEYS.User}{Rules_Init.GetReplacedValues(mr.DnsProxyUser, variables)}";
+ // &pass:
+ if (!string.IsNullOrEmpty(mr.DnsProxyPass))
+ text += $"{Rules_Init.SUB_KEYS.Pass}{Rules_Init.GetReplacedValues(mr.DnsProxyPass, variables)}";
+ // Add ;
+ text += ";";
+ }
+ // SNI
+ if (defaults != null)
+ {
+ if (defaults.Sni.Equals(mr.Sni))
+ mr.Sni = string.Empty;
+ }
+ if (!string.IsNullOrWhiteSpace(mr.Sni)) text += $"{Rules_Init.KEYS.Sni}{Rules_Init.GetReplacedValues(mr.Sni, variables)};";
+ // Proxy
+ if (defaults != null)
+ {
+ if (defaults.ProxyScheme.Equals(mr.ProxyScheme))
+ mr.ProxyScheme = string.Empty;
+ }
+ if (!string.IsNullOrWhiteSpace(mr.ProxyScheme))
+ {
+ // Scheme
+ text += $"{Rules_Init.KEYS.Proxy}{Rules_Init.GetReplacedValues(mr.ProxyScheme, variables)}";
+ // &user:
+ if (!string.IsNullOrWhiteSpace(mr.ProxyUser))
+ text += $"{Rules_Init.SUB_KEYS.User}{Rules_Init.GetReplacedValues(mr.ProxyUser, variables)}";
+ // &pass:
+ if (!string.IsNullOrEmpty(mr.ProxyPass))
+ text += $"{Rules_Init.SUB_KEYS.Pass}{Rules_Init.GetReplacedValues(mr.ProxyPass, variables)}";
+ // &ifblock:1
+ if (mr.ProxyIfBlock) text += $"{Rules_Init.SUB_KEYS.IfBlock}1";
+ // Add ;
+ text += ";";
+ }
+
+ textRules.Add(text);
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("AgnosticProgram Rules ConvertToTextRulesAsync: " + ex.Message);
+ }
+ });
+
+ return textRules;
+ }
+
}
}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/Rules_Get.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/Rules_Get.cs
new file mode 100644
index 0000000..264210e
--- /dev/null
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/Rules_Get.cs
@@ -0,0 +1,228 @@
+using System.Diagnostics;
+using System.Net;
+
+namespace MsmhToolsClass.MsmhAgnosticServer;
+
+public partial class AgnosticProgram
+{
+ public partial class Rules
+ {
+ public class RulesResult
+ {
+ public bool IsMatch { get; set; } = false;
+ public bool IsBlackList { get; set; } = false;
+ public bool IsPortBlock { get; set; } = false;
+ public bool IsDirect { get; set; } = false; // No Fragment, No Fake SNI & No Upstream
+ public string DnsCustomDomain { get; set; } = string.Empty;
+ public string Dns { get; set; } = string.Empty;
+ public List Dnss { get; set; } = new();
+ public string Sni { get; set; } = string.Empty;
+ public bool ApplyUpStreamProxy { get; set; } = false;
+ public string ProxyScheme { get; set; } = string.Empty;
+ public bool ApplyUpStreamProxyToBlockedIPs { get; set; } = false;
+ public string ProxyUser { get; set; } = string.Empty;
+ public string ProxyPass { get; set; } = string.Empty;
+ }
+
+ public async Task GetAsync(string client, string host, int port, AgnosticSettings settings)
+ {
+ RulesResult rr = new();
+ if (string.IsNullOrEmpty(host)) return rr;
+
+ try
+ {
+ rr.Dns = host;
+
+ for (int n = 0; n < MainRules_List.Count; n++)
+ {
+ MainRules mr = MainRules_List[n];
+
+ // Check If Match
+ bool isClientMatch = !string.IsNullOrEmpty(mr.Client) && (mr.Client.Equals(Rules_Init.KEYS.AllClients) || client.Equals(mr.Client) || client.EndsWith(mr.Client));
+ if (!isClientMatch) continue;
+
+ bool isWildcard = false;
+ string hostNoWww = string.Empty, ruleHostNoWww = string.Empty;
+ if (mr.AddressType == AddressType.Domain)
+ {
+ bool isDomainMatch = Rules_Init.IsDomainMatch(host, mr.Address, out isWildcard, out hostNoWww, out ruleHostNoWww);
+ if (!isDomainMatch) continue;
+ }
+ else if (mr.AddressType == AddressType.IP)
+ {
+ bool isHostIP = NetworkTool.IsIP(host, out _);
+ if (!isHostIP) continue;
+ bool isIpMatch = host.Equals(mr.Address);
+ if (!isIpMatch) continue;
+ }
+ else if (mr.AddressType == AddressType.CIDR)
+ {
+ bool isHostIP = NetworkTool.IsIP(host, out _);
+ if (!isHostIP) continue;
+ bool isCidrMatch = NetworkTool.IsIpInRange(host, mr.Address);
+ if (!isCidrMatch) continue;
+ }
+ else continue;
+
+ // Set Match
+ rr.IsMatch = true;
+
+ // Is Black List
+ rr.IsBlackList = mr.IsBlock;
+ if (rr.IsBlackList) break;
+
+ // Is Port Block
+ List blockedPorts = mr.BlockPort.ToList();
+ for (int i = 0; i < blockedPorts.Count; i++)
+ {
+ int blockedPort = blockedPorts[i];
+ if (port == blockedPort)
+ {
+ rr.IsPortBlock = true;
+ break;
+ }
+ }
+ if (rr.IsPortBlock) break;
+
+ // Direct: Don't Apply DPI Bypass (Fragment & Change SNI) & Upstream
+ rr.IsDirect = mr.IsDirect;
+
+ // DNS
+ if (!string.IsNullOrEmpty(mr.FakeDns))
+ {
+ // Fake DNS (Domain => IP, IP => IP)
+ rr.Dns = mr.FakeDns;
+ }
+ else
+ {
+ if (mr.AddressType == AddressType.Domain)
+ {
+ // Get Dns Servers And Upstream Proxy
+ List dnss = mr.Dnss.Any() ? mr.Dnss : settings.DNSs;
+ rr.Dnss = dnss;
+ string? dnsProxyScheme = null, dnsProxyUser = null, dnsProxyPass = null;
+ if (!string.IsNullOrEmpty(mr.DnsProxyScheme))
+ {
+ dnsProxyScheme = mr.DnsProxyScheme;
+ dnsProxyUser = mr.DnsProxyUser;
+ dnsProxyPass = mr.DnsProxyPass;
+ }
+ else
+ {
+ dnsProxyScheme = settings.UpstreamProxyScheme;
+ dnsProxyUser = settings.UpstreamProxyUser;
+ dnsProxyPass = settings.UpstreamProxyPass;
+ }
+
+ // Get IP By Custom DNS
+ if (dnss.Any() && !NetworkTool.IsIP(host, out _))
+ {
+ // Get Custom DNS Domain
+ rr.DnsCustomDomain = host;
+ if (!string.IsNullOrEmpty(mr.DnsDomain))
+ {
+ if (!mr.DnsDomain.StartsWith("*."))
+ {
+ rr.DnsCustomDomain = mr.DnsDomain;
+ }
+ else
+ {
+ // Support: xxxx.example.com -> xxxx.domain.com
+ if (isWildcard) // ruleHostNoWww.StartsWith("*.")
+ {
+ if (hostNoWww.EndsWith(ruleHostNoWww[1..])) // Just In Case
+ {
+ rr.DnsCustomDomain = hostNoWww.Replace(ruleHostNoWww[1..], mr.DnsDomain[1..]);
+ }
+ }
+ }
+ }
+
+ IPAddress ipv4Addr = IPAddress.None;
+ if (settings.IsIPv4SupportedByISP)
+ {
+ ipv4Addr = await GetIP.GetIpFromDnsAddressAsync(rr.DnsCustomDomain, dnss, settings.AllowInsecure, settings.DnsTimeoutSec, false, settings.BootstrapIpAddress, settings.BootstrapPort, dnsProxyScheme, dnsProxyUser, dnsProxyPass);
+ }
+
+ if (ipv4Addr.Equals(IPAddress.None))
+ {
+ if (settings.IsIPv6SupportedByISP)
+ {
+ IPAddress ipv6Addr = await GetIP.GetIpFromDnsAddressAsync(rr.DnsCustomDomain, dnss, settings.AllowInsecure, settings.DnsTimeoutSec, true, settings.BootstrapIpAddress, settings.BootstrapPort, dnsProxyScheme, dnsProxyUser, dnsProxyPass);
+ if (!ipv6Addr.Equals(IPAddress.IPv6None))
+ rr.Dns = ipv6Addr.ToString();
+ }
+ }
+ else
+ {
+ rr.Dns = ipv4Addr.ToString();
+ }
+ }
+ }
+ }
+
+ // Check If Host Is An IP
+ bool isIp = NetworkTool.IsIP(rr.Dns, out _);
+
+ // If IP Is Cloudflare IP, Set The Clean IP
+ if (isIp && !string.IsNullOrEmpty(settings.CloudflareCleanIP) && CommonTools.IsCfIP(rr.Dns))
+ rr.Dns = settings.CloudflareCleanIP;
+
+ // SNI
+ if (mr.AddressType == AddressType.Domain)
+ {
+ if (rr.IsDirect)
+ {
+ rr.Sni = host; // Set SNI To Original Host
+ }
+ else
+ {
+ rr.Sni = mr.Sni;
+ if (!string.IsNullOrEmpty(rr.Sni) && rr.Sni.StartsWith("*."))
+ {
+ // Support: xxxx.example.com -> xxxx.domain.com
+ if (isWildcard) // ruleHostNoWww.StartsWith("*.")
+ {
+ if (hostNoWww.EndsWith(ruleHostNoWww[1..])) // Just In Case
+ {
+ rr.Sni = hostNoWww.Replace(ruleHostNoWww[1..], rr.Sni[1..]);
+ }
+ }
+ }
+ if (string.IsNullOrEmpty(rr.Sni)) rr.Sni = host; // Set SNI To Original Host If Not Defined
+ }
+ }
+
+ // Upstream Proxy
+ if (!string.IsNullOrEmpty(mr.ProxyScheme))
+ {
+ if (!rr.IsDirect) // If Not Direct
+ {
+ mr.ProxyScheme = mr.ProxyScheme.ToLower().Trim();
+ if (mr.ProxyScheme.StartsWith("http://", StringComparison.OrdinalIgnoreCase) ||
+ mr.ProxyScheme.StartsWith("https://", StringComparison.OrdinalIgnoreCase) ||
+ mr.ProxyScheme.StartsWith("socks5://", StringComparison.OrdinalIgnoreCase))
+ {
+ rr.ApplyUpStreamProxy = true;
+ rr.ProxyScheme = mr.ProxyScheme;
+ rr.ApplyUpStreamProxyToBlockedIPs = mr.ProxyIfBlock;
+ rr.ProxyUser = mr.ProxyUser;
+ rr.ProxyPass = mr.ProxyPass;
+ }
+ }
+ }
+
+ // Break If Match
+ break;
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("ProxyRules_GetAsync: " + ex.Message);
+ }
+
+ return rr;
+ }
+
+ }
+}
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/Rules_Init.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/Rules_Init.cs
new file mode 100644
index 0000000..a14927f
--- /dev/null
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/Programs/Rules_Init.cs
@@ -0,0 +1,228 @@
+using System.Diagnostics;
+
+namespace MsmhToolsClass.MsmhAgnosticServer;
+
+public partial class AgnosticProgram
+{
+ public static class Rules_Init
+ {
+ public readonly struct KEYS
+ {
+ public static readonly string FirstKey = "FirstKey";
+ public static readonly string AllClients = "AllClients";
+ public static readonly string BlockPort = "BlockPort:";
+ public static readonly string Dns = "Dns:";
+ public static readonly string DnsDomain = "DnsDomain:";
+ public static readonly string DnsProxy = "DnsProxy:";
+ public static readonly string Sni = "Sni:";
+ public static readonly string Proxy = "Proxy:";
+ }
+
+ public readonly struct SUB_KEYS
+ {
+ public static readonly string FirstKey = "FirstKey";
+ public static readonly string IfBlock = "&IfBlock:";
+ public static readonly string User = "&User:";
+ public static readonly string Pass = "&Pass:";
+ }
+
+ public static string GetValue(string line, string key, string? subKey, out bool isList, out List list, List> variables)
+ {
+ string result = line.Trim();
+ isList = false;
+ list = new();
+
+ try
+ {
+ if (result.Contains(key, StringComparison.InvariantCultureIgnoreCase) || key.Equals(KEYS.FirstKey, StringComparison.InvariantCultureIgnoreCase))
+ {
+ try
+ {
+ if (key.Equals(KEYS.FirstKey, StringComparison.InvariantCultureIgnoreCase))
+ {
+ result = result.Remove(result.IndexOf(';'));
+ result = result.Trim();
+ }
+ else
+ {
+ result = result.Remove(0, result.IndexOf(key, StringComparison.InvariantCultureIgnoreCase) + key.Length);
+ result = result.Remove(result.IndexOf(';'));
+ result = result.Trim();
+ }
+ }
+ catch (Exception) { }
+
+ if (!string.IsNullOrEmpty(subKey))
+ {
+ if (subKey.Equals(SUB_KEYS.FirstKey, StringComparison.InvariantCultureIgnoreCase))
+ {
+ if (result.Contains('&'))
+ {
+ try
+ {
+ result = result.Remove(result.IndexOf('&'));
+ }
+ catch (Exception) { }
+ }
+ }
+ else
+ {
+ if (result.Contains(subKey, StringComparison.InvariantCultureIgnoreCase))
+ {
+ try
+ {
+ result = result.Remove(0, result.IndexOf(subKey, StringComparison.InvariantCultureIgnoreCase) + subKey.Length);
+ }
+ catch (Exception) { }
+
+ if (result.Contains('&') && result.Contains(':'))
+ {
+ try
+ {
+ result = result.Remove(result.IndexOf('&'));
+ }
+ catch (Exception) { }
+ }
+ }
+ }
+ }
+
+ if (!result.Contains(','))
+ {
+ // Not A List
+ return ApplyVariables(result, variables);
+ }
+ else
+ {
+ // It's A List
+ isList = true;
+ string[] split = result.Split(',');
+ for (int n = 0; n < split.Length; n++)
+ {
+ string value = split[n].Trim();
+ list.Add(ApplyVariables(value, variables));
+ }
+ if (list.Any()) return list[0];
+ }
+ }
+ }
+ catch (Exception) { }
+
+ return string.Empty;
+ }
+
+ private static string ApplyVariables(string vari, List> variables)
+ {
+ string result = vari;
+ try
+ {
+ variables = variables.ToList();
+ for (int n = 0; n < variables.Count; n++)
+ {
+ Tuple tuple = variables[n];
+ if (vari.Equals(tuple.Item1) && !string.IsNullOrWhiteSpace(tuple.Item2))
+ {
+ result = tuple.Item2; break;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Rules ApplyVariables: " + ex.Message);
+ }
+ return result;
+ }
+
+ public static string GetReplacedValues(string values, List>? variables)
+ {
+ string result = values.Trim();
+
+ try
+ {
+ if (!result.Contains(','))
+ {
+ // Not A List
+ return ApplyVariablesReverse(result, variables);
+ }
+ else
+ {
+ // It's A List
+ List list = new();
+ string[] split = result.Split(',');
+ for (int n = 0; n < split.Length; n++)
+ {
+ string value = split[n].Trim();
+ list.Add(ApplyVariablesReverse(value, variables));
+ }
+ if (list.Any()) result = list.ToString(',');
+ }
+ }
+ catch (Exception) { }
+
+ return result;
+ }
+
+ private static string ApplyVariablesReverse(string vari, List>? variables)
+ {
+ string result = vari;
+ try
+ {
+ if (variables != null)
+ {
+ variables = variables.ToList();
+ for (int n = 0; n < variables.Count; n++)
+ {
+ Tuple tuple = variables[n];
+ if (vari.Equals(tuple.Item2) && !string.IsNullOrWhiteSpace(tuple.Item1))
+ {
+ result = tuple.Item1; break;
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Rules ApplyVariablesReverse: " + ex.Message);
+ }
+ return result;
+ }
+
+ public static bool IsDomainMatch(string host, string ruleHost, out bool isWildcard, out string hostNoWWW, out string ruleHostNoWWW)
+ {
+ isWildcard = false;
+ hostNoWWW = host.ToLower().Trim();
+ ruleHostNoWWW = ruleHost.ToLower().Trim();
+
+ try
+ {
+ if (hostNoWWW.StartsWith("www."))
+ hostNoWWW = hostNoWWW.TrimStart("www.");
+ if (hostNoWWW.EndsWith('/')) hostNoWWW = hostNoWWW[0..^1];
+
+ if (ruleHostNoWWW.StartsWith("www."))
+ ruleHostNoWWW = ruleHostNoWWW.TrimStart("www.");
+ if (ruleHostNoWWW.EndsWith('/')) ruleHostNoWWW = ruleHostNoWWW[0..^1];
+
+ if (!string.IsNullOrEmpty(ruleHostNoWWW))
+ {
+ if (ruleHostNoWWW.Equals("*")) return true; // No Wildcard
+
+ if (!ruleHostNoWWW.StartsWith("*."))
+ {
+ // No Wildcard
+ if (ruleHostNoWWW.Equals(hostNoWWW)) return true;
+ }
+ else
+ {
+ // Wildcard
+ isWildcard = true;
+ if (!hostNoWWW.Equals(ruleHostNoWWW[2..]) && hostNoWWW.EndsWith(ruleHostNoWWW[1..])) return true;
+ }
+ }
+ }
+ catch (Exception) { }
+
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ApplyPrograms.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ApplyPrograms.cs
index 5a142f2..507443c 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ApplyPrograms.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ApplyPrograms.cs
@@ -5,6 +5,77 @@ namespace MsmhToolsClass.MsmhAgnosticServer;
public partial class MsmhAgnosticServer
{
+ private ProxyRequest? ApplyRulesToRequest(ProxyRequest req, AgnosticProgram.Rules.RulesResult rr, ref string msgReqEvent, bool isCaptivePortal)
+ {
+ try
+ {
+ if (rr.IsMatch)
+ {
+ // Rules Program: Black List (-;)
+ if (rr.IsBlackList)
+ {
+ // Event
+ msgReqEvent += $"Black List: {req.Address}:{req.Port}, Request Denied.";
+ OnRequestReceived?.Invoke(msgReqEvent, EventArgs.Empty);
+ return null;
+ }
+
+ // Rules Program: Block Port
+ if (rr.IsPortBlock)
+ {
+ if (!isCaptivePortal)
+ {
+ // Event
+ msgReqEvent += $"Block Port {req.Port}: {req.Address}:{req.Port}, Request Denied.";
+ OnRequestReceived?.Invoke(msgReqEvent, EventArgs.Empty);
+ return null;
+ }
+ }
+
+ // Rules Program: Fake DNS Or Custom DNS
+ bool isDnsIp = NetworkTool.IsIP(rr.Dns, out _);
+ if (isDnsIp) req.Address = rr.Dns;
+
+ // Rules Program: Apply DPI Bypass If Is Match And Not Direct (NoBypass --;)
+ if (rr.IsDirect)
+ {
+ // No Bypass And Upstream For Direct
+ req.ApplyFragment = false;
+ req.ApplyChangeSNI = false;
+ req.AddressSNI = req.AddressOrig;
+ req.ApplyUpstreamProxy = false;
+ req.ApplyUpstreamProxyToBlockedIPs = false;
+ req.UpstreamProxyScheme = string.Empty;
+ req.UpstreamProxyUser = string.Empty;
+ req.UpstreamProxyPass = string.Empty;
+ }
+ else
+ {
+ req.ApplyFragment = IsFragmentActive;
+ req.ApplyChangeSNI = IsFakeSniActive;
+ if (!string.IsNullOrEmpty(rr.Sni) && !rr.Sni.Equals(req.AddressOrig))
+ req.AddressSNI = rr.Sni;
+ if (rr.ApplyUpStreamProxy && !string.IsNullOrWhiteSpace(rr.ProxyScheme) &&
+ !IsUpstreamEqualToServerAddress(rr.ProxyScheme))
+ {
+ req.ApplyUpstreamProxy = true;
+ req.ApplyUpstreamProxyToBlockedIPs = rr.ApplyUpStreamProxyToBlockedIPs;
+ req.UpstreamProxyScheme = rr.ProxyScheme;
+ req.UpstreamProxyUser = rr.ProxyUser;
+ req.UpstreamProxyPass = rr.ProxyPass;
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("AgnosticServer ApplyPrograms ApplyRulesToRequest: " + ex.Message);
+ return null;
+ }
+
+ return req;
+ }
+
public async Task ApplyPrograms(IPAddress clientIP, ProxyRequest? req)
{
try
@@ -14,7 +85,25 @@ public partial class MsmhAgnosticServer
if (string.IsNullOrEmpty(req.Address)) return null;
if (req.Address.Equals("0.0.0.0")) return null;
if (req.Address.StartsWith("10.")) return null;
+
+ // Apply Settings To Request
req.ClientIP = clientIP;
+ req.TimeoutSec = Settings_.ProxyTimeoutSec;
+ req.ApplyFragment = IsFragmentActive;
+ if (!string.IsNullOrWhiteSpace(SettingsSSL_.DefaultSni))
+ {
+ req.ApplyChangeSNI = IsFakeSniActive;
+ req.AddressSNI = SettingsSSL_.DefaultSni;
+ }
+ if (!string.IsNullOrWhiteSpace(Settings_.UpstreamProxyScheme) &&
+ !IsUpstreamEqualToServerAddress(Settings_.UpstreamProxyScheme))
+ {
+ req.ApplyUpstreamProxy = true;
+ req.ApplyUpstreamProxyToBlockedIPs = Settings_.ApplyUpstreamOnlyToBlockedIps;
+ req.UpstreamProxyScheme = Settings_.UpstreamProxyScheme;
+ req.UpstreamProxyUser = Settings_.UpstreamProxyUser;
+ req.UpstreamProxyPass = Settings_.UpstreamProxyPass;
+ }
// Event
string msgReqEvent = $"[{req.ClientIP}] [{req.ProxyName}] ";
@@ -41,10 +130,7 @@ public partial class MsmhAgnosticServer
}
}
- // Apply Programs
- req.TimeoutSec = Settings_.ProxyTimeoutSec;
-
- // Block Port 80
+ // Settings: Block Port 80
if (Settings_.BlockPort80 && req.Port == 80)
{
if (!isCaptivePortal)
@@ -56,55 +142,79 @@ public partial class MsmhAgnosticServer
}
}
- //// ProxyRules Program
- AgnosticProgram.ProxyRules.ProxyRulesResult rr = new();
- if (ProxyRulesProgram.RulesMode != AgnosticProgram.ProxyRules.Mode.Disable)
+ //// Rules Program: Domain
+ AgnosticProgram.Rules.RulesResult rr = new();
+ if (RulesProgram.RulesMode != AgnosticProgram.Rules.Mode.Disable)
{
- rr = await ProxyRulesProgram.GetAsync(req.ClientIP.ToString(), req.Address, req.Port, Settings_);
+ rr = await RulesProgram.GetAsync(req.ClientIP.ToString(), req.Address, req.Port, Settings_);
}
- if (rr.IsMatch)
+ // Apply Rules To Request
+ req = ApplyRulesToRequest(req, rr, ref msgReqEvent, isCaptivePortal);
+ if (req == null) return null;
+
+ // Check If Address Is An IP (Before Applying DNS)
+ bool isIp = NetworkTool.IsIP(req.Address, out _);
+
+ //// Apply DNS To Proxy Request
+ if (req.AddressOrig.Equals(req.Address) && !isIp)
{
- // Black List
- if (rr.IsBlackList)
+ string dnsServer = Settings_.ServerUdpDnsAddress;
+
+ IPAddress ipv4Addr = IPAddress.None;
+ if (Settings_.IsIPv4SupportedByISP)
{
- // Event
- msgReqEvent += $"Black List: {req.Address}:{req.Port}, Request Denied.";
- OnRequestReceived?.Invoke(msgReqEvent, EventArgs.Empty);
- return null;
+ ipv4Addr = await GetIP.GetIpFromDnsAddressAsync(req.Address, dnsServer, false, Settings_);
}
- // Block Port
- if (rr.IsPortBlock)
+ if (ipv4Addr.Equals(IPAddress.None))
{
- if (!isCaptivePortal)
+ if (Settings_.IsIPv6SupportedByISP)
{
- // Event
- msgReqEvent += $"Block Port {req.Port}: {req.Address}:{req.Port}, Request Denied.";
- OnRequestReceived?.Invoke(msgReqEvent, EventArgs.Empty);
- return null;
+ IPAddress ipv6Addr = await GetIP.GetIpFromDnsAddressAsync(req.Address, dnsServer, true, Settings_);
+
+ if (!ipv6Addr.Equals(IPAddress.IPv6None))
+ req.Address = ipv6Addr.ToString();
}
}
+ else
+ {
+ req.Address = ipv4Addr.ToString();
+ }
+ }
- // Apply DPI Bypass If Is Match
- req.ApplyFragment = rr.ApplyDpiBypass && IsFragmentActive;
- req.ApplyChangeSNI = rr.ApplyDpiBypass && IsFakeSniActive;
+ // Check If Address Is An IP (After DNS Applied)
+ isIp = NetworkTool.IsIP(req.Address, out IPAddress? ip);
- // Fake DNS Or Custom DNS
- bool isDnsIp = NetworkTool.IsIp(rr.Dns, out _);
- if (isDnsIp) req.Address = rr.Dns;
- }
- else
+ //// Rules Program: IP
+ if (!rr.IsMatch && isIp && !req.AddressIsIp)
{
- // Apply DPI Bypass If Is Not Match
- req.ApplyFragment = IsFragmentActive;
- req.ApplyChangeSNI = IsFakeSniActive;
+ if (RulesProgram.RulesMode != AgnosticProgram.Rules.Mode.Disable)
+ {
+ rr = await RulesProgram.GetAsync(req.ClientIP.ToString(), req.Address, req.Port, Settings_);
+ }
+
+ // Apply Rules To Request
+ req = ApplyRulesToRequest(req, rr, ref msgReqEvent, isCaptivePortal);
+ if (req == null) return null;
}
+ // If IP Is Cloudflare IP, Set The Clean IP
+ if (isIp && !string.IsNullOrEmpty(Settings_.CloudflareCleanIP) &&
+ !req.Address.Equals(Settings_.CloudflareCleanIP) && CommonTools.IsCfIP(req.Address))
+ req.Address = Settings_.CloudflareCleanIP;
+
// UDP Does Not Support Fragmentation
if (req.ProxyName == Proxy.Name.Socks5 && req.Command == Socks.Commands.UDP)
req.ApplyFragment = false;
+ // No Bypass For Captive Portal
+ if (isCaptivePortal)
+ {
+ req.ApplyChangeSNI = false;
+ req.ApplyFragment = false;
+ }
+
// Override For Test
if (req.ProxyName == Proxy.Name.Test && isTestRequestExist)
{
@@ -112,58 +222,11 @@ public partial class MsmhAgnosticServer
req.ApplyChangeSNI = testReq.applyFakeSNI;
}
- //// FakeSNI Program
- if (req.ApplyChangeSNI)
- {
- if (rr.IsMatch)
- if (!string.IsNullOrEmpty(rr.Sni) && !rr.Sni.Equals(req.AddressOrig))
- req.AddressSNI = rr.Sni;
-
- if (req.AddressSNI.Equals(req.AddressOrig))
- {
- string defaultSni = SettingsSSL_.DefaultSni;
- if (!string.IsNullOrWhiteSpace(defaultSni))
- {
- req.AddressSNI = defaultSni;
- }
- }
-
- if (string.IsNullOrWhiteSpace(req.AddressSNI) || req.AddressSNI.Equals(req.AddressOrig))
- req.ApplyChangeSNI = false;
- }
-
- // Check If Address Is An IP
- bool isIp = NetworkTool.IsIp(req.Address, out _);
-
- //// Apply DNS To Proxy Request
- if (req.AddressOrig.Equals(req.Address) && !isIp)
- {
- string dnsServer = Settings_.ServerUdpDnsAddress;
-
- IPAddress ipv4Addr = IPAddress.None;
- if (Settings_.IsIPv4SupportedByISP)
- {
- ipv4Addr = await GetIP.GetIpFromDnsAddressAsync(req.Address, dnsServer, false, Settings_);
- if (ipv4Addr.Equals(IPAddress.None) && !Settings_.IsIPv6SupportedByISP) // Retry If IPv6 Is Not Supported
- ipv4Addr = await GetIP.GetIpFromDnsAddressAsync(req.Address, dnsServer, false, Settings_);
- }
-
- if (ipv4Addr.Equals(IPAddress.None))
- {
- IPAddress ipv6Addr = await GetIP.GetIpFromDnsAddressAsync(req.Address, dnsServer, true, Settings_);
- if (!ipv6Addr.Equals(IPAddress.IPv6None))
- req.Address = ipv6Addr.ToString();
- }
- else
- {
- if (string.IsNullOrEmpty(Settings_.CloudflareCleanIP))
- req.Address = ipv4Addr.ToString();
- else
- req.Address = CommonTools.IsCfIP(ipv4Addr) ? Settings_.CloudflareCleanIP : ipv4Addr.ToString();
- }
- }
+ // Turn ApplyChangeSNI Off If No SNI Is Set
+ if (string.IsNullOrWhiteSpace(req.AddressSNI) || req.AddressSNI.Equals(req.AddressOrig))
+ req.ApplyChangeSNI = false;
- // Event
+ // Event: Address
if (req.AddressOrig.Equals(req.Address))
msgReqEvent += $"{req.AddressOrig}:{req.Port}";
else
@@ -174,13 +237,6 @@ public partial class MsmhAgnosticServer
msgReqEvent += $"{req.AddressOrig}:{req.Port} => {req.Address}";
}
- // No Bypass For Captive Portal
- if (isCaptivePortal)
- {
- req.ApplyChangeSNI = false;
- req.ApplyFragment = false;
- }
-
// Add Orig Values To Cache
ProxyRequestsCache.ProxyRequestsCacheResult prcr = new();
prcr.OrigValues.ApplyChangeSNI = req.ApplyChangeSNI;
@@ -191,121 +247,8 @@ public partial class MsmhAgnosticServer
string checkRequest = $"{req.ClientIP}_{req.ProxyName}_{req.AddressOrig}_{req.Port}";
var cachedReq = ProxyRequestsCaches.Get(checkRequest, req);
- // Check Fake SNI Is Compatible
- HttpStatusCode httpStatus = HttpStatusCode.RequestTimeout;
- string event_ApplyChangeSNI = string.Empty;
- if (cachedReq != null)
- {
- req.ApplyChangeSNI = cachedReq.ApplyChangeSNI.Apply;
- event_ApplyChangeSNI = cachedReq.ApplyChangeSNI.Event_ApplyChangeSNI;
- }
- else
- {
- if (req.ApplyChangeSNI)
- {
- if (req.ProxyName != Proxy.Name.Test)
- {
- TestRequests.AddOrUpdate(req.AddressOrig, (DateTime.UtcNow, req.ApplyChangeSNI, false));
-
- HttpStatusCode hsc = await NetworkTool.GetHttpStatusCodeAsync($"https://{req.AddressOrig}:{req.Port}", null, 4000, false, true, Settings_.ServerHttpProxyAddress).ConfigureAwait(false);
- if (hsc == HttpStatusCode.OK || hsc == HttpStatusCode.NotFound || hsc == HttpStatusCode.BadRequest || hsc == HttpStatusCode.Forbidden)
- {
- // Fake SNI Is Compatible
- event_ApplyChangeSNI += $" => {req.AddressSNI}";
- req.ApplyFragment = false; // No Need To Fragment
- TestRequests.AddOrUpdate(req.AddressOrig, (DateTime.UtcNow, req.ApplyChangeSNI, req.ApplyFragment));
- httpStatus = hsc;
- }
- else if (hsc != HttpStatusCode.RequestTimeout && (hsc == HttpStatusCode.MisdirectedRequest || hsc == HttpStatusCode.InternalServerError))
- {
- // Fake SNI Is Not Compatible
- req.ApplyChangeSNI = false;
- event_ApplyChangeSNI += $" => {req.AddressSNI} (Not Compatible => OFF)";
- TestRequests.AddOrUpdate(req.AddressOrig, (DateTime.UtcNow, req.ApplyChangeSNI, req.ApplyFragment));
- httpStatus = hsc;
- }
- else
- {
- HttpStatusCode hscDirect = await NetworkTool.GetHttpStatusCodeAsync($"https://{req.AddressOrig}:{req.Port}", req.Address, 4000, false, true).ConfigureAwait(false);
- if (hscDirect != HttpStatusCode.RequestTimeout)
- {
- // Not Blocked By SNI: No Need To Apply FakeSNI Or Fragment
- req.ApplyChangeSNI = false;
- req.ApplyFragment = false;
- TestRequests.AddOrUpdate(req.AddressOrig, (DateTime.UtcNow, req.ApplyChangeSNI, req.ApplyFragment));
- httpStatus = hscDirect;
- }
- else
- {
- // No Idea
- event_ApplyChangeSNI += $" => {req.AddressSNI} ({hsc})";
- httpStatus = hsc;
- }
- }
- }
- }
- }
- msgReqEvent += event_ApplyChangeSNI;
-
- // Check Fragment Is Compatible
- string event_ApplyFragment = string.Empty;
- if (cachedReq != null)
- {
- req.ApplyFragment = cachedReq.ApplyFragment.Apply;
- event_ApplyFragment = cachedReq.ApplyFragment.Event_ApplyFragment;
- }
- else
- {
- if (req.ApplyFragment)
- {
- if (req.ProxyName != Proxy.Name.Test)
- {
- TestRequests.AddOrUpdate(req.AddressOrig, (DateTime.UtcNow, false, req.ApplyFragment));
-
- HttpStatusCode hsc = await NetworkTool.GetHttpStatusCodeAsync($"https://{req.AddressOrig}:{req.Port}", null, 4000, false, true, Settings_.ServerHttpProxyAddress).ConfigureAwait(false);
- if (hsc == HttpStatusCode.OK || hsc == HttpStatusCode.NotFound || hsc == HttpStatusCode.BadRequest || hsc == HttpStatusCode.Forbidden)
- {
- event_ApplyFragment += " => Fragmented";
- req.ApplyChangeSNI = false; // No Need For Fake SNI
- TestRequests.AddOrUpdate(req.AddressOrig, (DateTime.UtcNow, req.ApplyChangeSNI, req.ApplyFragment));
- httpStatus = hsc;
- }
- else if (hsc != HttpStatusCode.RequestTimeout)
- {
- // Fragment Is Not Compatible
- req.ApplyFragment = false;
- event_ApplyFragment += " => Fragmented (Not Compatible => OFF)";
- TestRequests.AddOrUpdate(req.AddressOrig, (DateTime.UtcNow, req.ApplyChangeSNI, req.ApplyFragment));
- httpStatus = hsc;
- }
- else
- {
- HttpStatusCode hscDirect = await NetworkTool.GetHttpStatusCodeAsync($"https://{req.AddressOrig}:{req.Port}", req.Address, 4000, false, true).ConfigureAwait(false);
- if (hscDirect != HttpStatusCode.RequestTimeout)
- {
- // Not Blocked By SNI: No Need To Apply FakeSNI Or Fragment
- req.ApplyChangeSNI = false;
- req.ApplyFragment = false;
- TestRequests.AddOrUpdate(req.AddressOrig, (DateTime.UtcNow, req.ApplyChangeSNI, req.ApplyFragment));
- httpStatus = hscDirect;
- }
- else
- {
- // No Idea
- event_ApplyFragment += $" => Fragmented ({hsc})";
- httpStatus = hsc;
- }
- }
- }
- }
- }
- msgReqEvent += event_ApplyFragment;
-
- // If Both Are Active Use Fragment
- if (req.ApplyChangeSNI && req.ApplyFragment) req.ApplyChangeSNI = false;
-
// Check If IP Is Blocked
- isIp = NetworkTool.IsIp(req.Address, out IPAddress? ip);
+ HttpStatusCode hsc = HttpStatusCode.RequestTimeout;
bool isIpv6 = false;
if (isIp && ip != null)
{
@@ -314,18 +257,24 @@ public partial class MsmhAgnosticServer
{
if (req.ProxyName != Proxy.Name.Test)
{
- if (httpStatus == HttpStatusCode.RequestTimeout || httpStatus == HttpStatusCode.Forbidden)
+ if (req.ApplyUpstreamProxy && req.ApplyUpstreamProxyToBlockedIPs)
{
- if (rr.IsMatch && rr.ApplyUpStreamProxy && rr.ApplyUpStreamProxyToBlockedIPs)
+ if (cachedReq != null)
{
- if (cachedReq != null)
+ req.IsDestBlocked = cachedReq.IsDestBlocked.Apply;
+ }
+ else
+ {
+ if (req.AddressIsIp)
{
- req.IsDestBlocked = cachedReq.IsDestBlocked.Apply;
+ bool canPing = await NetworkTool.CanPing(req.AddressOrig, 3000);
+ req.IsDestBlocked = !canPing;
}
else
{
- httpStatus = await NetworkTool.GetHttpStatusCodeAsync($"https://{req.AddressOrig}:{req.Port}", null, 4000, false, true, Settings_.ServerHttpProxyAddress).ConfigureAwait(false);
- req.IsDestBlocked = httpStatus == HttpStatusCode.RequestTimeout || httpStatus == HttpStatusCode.Forbidden;
+ if (hsc == HttpStatusCode.RequestTimeout)
+ hsc = await NetworkTool.GetHttpStatusCodeAsync($"https://{req.AddressOrig}:{req.Port}", null, 4000, false, true, Settings_.ServerHttpProxyAddress).ConfigureAwait(false);
+ req.IsDestBlocked = hsc == HttpStatusCode.RequestTimeout || hsc == HttpStatusCode.Forbidden;
}
}
}
@@ -339,38 +288,65 @@ public partial class MsmhAgnosticServer
}
}
- // Apply Upstream?
- if ((rr.IsMatch && rr.ApplyUpStreamProxy && !rr.ApplyUpStreamProxyToBlockedIPs) ||
- (rr.IsMatch && rr.ApplyUpStreamProxy && rr.ApplyUpStreamProxyToBlockedIPs && req.IsDestBlocked))
+ // Apply Upstream
+ bool applyUpstream = (req.ApplyUpstreamProxy && !req.ApplyUpstreamProxyToBlockedIPs) ||
+ (req.ApplyUpstreamProxy && req.ApplyUpstreamProxyToBlockedIPs && req.IsDestBlocked);
+ req.ApplyUpstreamProxy = applyUpstream;
+ if (req.ApplyUpstreamProxy)
{
- if (!IsUpstreamEqualToServerAddress(rr.ProxyScheme))
- {
- req.ApplyUpStreamProxy = true;
- req.ApplyChangeSNI = false;
- req.ApplyFragment = false;
- msgReqEvent += $" (Using Upstream: {rr.ProxyScheme})";
- }
+ req.ApplyChangeSNI = false;
+ req.ApplyFragment = false;
+
+ // Event: Upstream
+ msgReqEvent += $" => Using Upstream: {req.UpstreamProxyScheme}";
}
- if (!req.ApplyUpStreamProxy && !string.IsNullOrWhiteSpace(Settings_.UpstreamProxyScheme))
+ // If Both Anti-DPI Methods Are Active Pick One
+ if (req.ApplyChangeSNI && req.ApplyFragment)
{
- if ((!Settings_.ApplyUpstreamOnlyToBlockedIps) ||
- (Settings_.ApplyUpstreamOnlyToBlockedIps && req.IsDestBlocked))
+ // Check Cached Request
+ if (cachedReq != null)
+ {
+ req.ApplyChangeSNI = cachedReq.ApplyChangeSNI.Apply;
+ req.ApplyFragment = cachedReq.ApplyFragment.Apply;
+ }
+ else
{
- if (!IsUpstreamEqualToServerAddress(Settings_.UpstreamProxyScheme))
+ if (req.ProxyName != Proxy.Name.Test)
{
- req.ApplyUpStreamProxy = true;
- req.ApplyChangeSNI = false;
- req.ApplyFragment = false;
- msgReqEvent += $" (Using Upstream: {Settings_.UpstreamProxyScheme.ToLower()})";
+ TestRequests.AddOrUpdate(req.AddressOrig, (DateTime.UtcNow, req.ApplyChangeSNI, false));
+
+ hsc = await NetworkTool.GetHttpStatusCodeAsync($"https://{req.AddressOrig}:{req.Port}", null, 4000, false, true, Settings_.ServerHttpProxyAddress).ConfigureAwait(false);
+ if (hsc == HttpStatusCode.OK || hsc == HttpStatusCode.NotFound || hsc == HttpStatusCode.BadRequest || hsc == HttpStatusCode.Forbidden)
+ {
+ // Fake SNI Is Compatible
+ req.ApplyFragment = false; // No Need To Fragment
+ TestRequests.AddOrUpdate(req.AddressOrig, (DateTime.UtcNow, req.ApplyChangeSNI, req.ApplyFragment));
+ }
+ else
+ {
+ // Fake SNI Is Not Compatible
+ req.ApplyChangeSNI = false; // Turn Off Fake SNI
+ TestRequests.AddOrUpdate(req.AddressOrig, (DateTime.UtcNow, req.ApplyChangeSNI, req.ApplyFragment));
+ }
}
}
}
+ // If Both Are Still Active Use Fragment
+ if (req.ApplyChangeSNI && req.ApplyFragment) req.ApplyChangeSNI = false;
+
+ // Event: Direct / DPI Bypass Method
+ bool isDirect = !req.ApplyFragment && !req.ApplyChangeSNI && !req.ApplyUpstreamProxy;
+ if (isDirect) msgReqEvent += " => Direct";
+ if (req.ApplyChangeSNI) msgReqEvent += $" => SNI: {req.AddressSNI}";
+ else if (req.ApplyFragment) msgReqEvent += " => Fragmented";
+
// Block Request Without DNS IP
- bool blockReq = !req.AddressIsIp && req.AddressOrig.Equals(req.Address) && !req.ApplyUpStreamProxy;
- if (blockReq) msgReqEvent += " Request Denied (Has No DNS IP)";
+ bool blockReq = !req.AddressIsIp && req.AddressOrig.Equals(req.Address) && !req.ApplyUpstreamProxy;
+ if (blockReq) msgReqEvent += " - Request Denied (Has No DNS IP)";
+ // Fire Event
//Debug.WriteLine(msgReqEvent);
if (req.ProxyName != Proxy.Name.Test)
OnRequestReceived?.Invoke(msgReqEvent, EventArgs.Empty);
@@ -395,11 +371,7 @@ public partial class MsmhAgnosticServer
if (req.ProxyName != Proxy.Name.Test && InternetState == NetworkTool.InternetState.Online)
{
prcr.ApplyChangeSNI.Apply = req.ApplyChangeSNI;
- prcr.ApplyChangeSNI.Event_ApplyChangeSNI = event_ApplyChangeSNI;
-
prcr.ApplyFragment.Apply = req.ApplyFragment;
- prcr.ApplyFragment.Event_ApplyFragment = event_ApplyFragment;
-
prcr.IsDestBlocked.Apply = req.IsDestBlocked;
ProxyRequestsCaches.Add(checkRequest, prcr);
@@ -425,7 +397,7 @@ private bool IsUpstreamEqualToServerAddress(string? proxyScheme)
NetworkTool.GetUrlDetails(proxyScheme, 443, out _, out string host, out _, out _, out int port, out _, out _);
if (Settings_.ListenerPort == port)
{
- bool isIP = NetworkTool.IsIp(host, out IPAddress? ip);
+ bool isIP = NetworkTool.IsIP(host, out IPAddress? ip);
if (isIP && ip != null)
{
if (IPAddress.IsLoopback(ip)) result = true;
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyClient.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyClient.cs
index 6c2c743..660825a 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyClient.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyClient.cs
@@ -62,7 +62,7 @@ public async Task ReceiveAsync(byte[] data, SocketFlags socketFlags = Socke
}
catch (Exception ex)
{
- Debug.WriteLine(ex.ToString());
+ Debug.WriteLine("ProxyClient ReceiveAsync: " + ex.ToString());
Disconnect();
return -1;
}
@@ -91,7 +91,7 @@ public async Task SendAsync(byte[] buffer)
}
catch (Exception ex)
{
- Debug.WriteLine(ex.Message);
+ Debug.WriteLine("ProxyClient SendAsync: " + ex.ToString());
Disconnect();
return false;
}
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyClientSSL.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyClientSSL.cs
index 25440ba..d0a4796 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyClientSSL.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyClientSSL.cs
@@ -306,30 +306,17 @@ private async Task DecryptHttpsTrafficAsync(Stream clientStream, Stream re
// Update Client Stream
ClientStream = sslStreamClient;
-
+
//===== Client Authentication
- SslClientAuthenticationOptions optionsClient = new();
-
- // Apply DontBypass Program
- if (!req.ApplyChangeSNI)
- optionsClient.TargetHost = req.AddressOrig;
- else
+ SslClientAuthenticationOptions optionsClient = new()
{
- if (SettingsSSL_.ChangeSni)
- {
- // Use Fake DNS/SNI List (Change SNI) To Bypass DPI
- optionsClient.TargetHost = req.AddressSNI;
- }
- else
- {
- optionsClient.TargetHost = req.AddressOrig;
- }
- }
-
- optionsClient.EnabledSslProtocols = MsmhAgnosticServer.SSL_Protocols;
- optionsClient.CertificateRevocationCheckMode = X509RevocationMode.NoCheck;
- optionsClient.RemoteCertificateValidationCallback = MsmhAgnosticServer.Callback;
-
+ // Apply DontBypass Program: Use Fake DNS/SNI List (Change SNI) To Bypass DPI
+ TargetHost = req.ApplyChangeSNI ? req.AddressSNI : req.AddressOrig,
+ EnabledSslProtocols = MsmhAgnosticServer.SSL_Protocols,
+ CertificateRevocationCheckMode = X509RevocationMode.NoCheck,
+ RemoteCertificateValidationCallback = MsmhAgnosticServer.Callback
+ };
+
SslStream sslStreamRemote = new(remoteStream, false, MsmhAgnosticServer.Callback, null);
await sslStreamRemote.AuthenticateAsClientAsync(optionsClient, CancellationToken.None).ConfigureAwait(false);
@@ -342,7 +329,7 @@ private async Task DecryptHttpsTrafficAsync(Stream clientStream, Stream re
}
catch (Exception ex)
{
- Debug.WriteLine("======= DecryptHttpsTrafficAsync:\n" + ex.Message);
+ Debug.WriteLine($"======= DecryptHttpsTrafficAsync ({req.AddressOrig} => {req.AddressSNI}):\n" + ex.Message);
return false;
}
}
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyRequest.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyRequest.cs
index ba00c31..321b04a 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyRequest.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyRequest.cs
@@ -350,7 +350,7 @@ public ProxyRequest(Proxy.Name proxyName, Socks.Version version, Socks.Commands
public string Address { get; set; }
public string AddressOrig { get; set; }
public string AddressSNI { get; set; }
- public bool AddressIsIp => NetworkTool.IsIp(AddressOrig, out _);
+ public bool AddressIsIp => NetworkTool.IsIP(AddressOrig, out _);
public int Port { get; set; }
public string UserId { get; set; }
public string Password { get; set; }
@@ -383,8 +383,12 @@ public ProxyRequest(Proxy.Name proxyName, Socks.Version version, Socks.Commands
public bool IsDestBlocked { get; set; } = false;
- public bool ApplyUpStreamProxy { get; set; } = false;
- public AgnosticProgram.ProxyRules.ProxyRulesResult RulesResult { get; set; } = new();
+ public bool ApplyUpstreamProxy { get; set; } = false;
+ public bool ApplyUpstreamProxyToBlockedIPs { get; set; } = false;
+ public string? UpstreamProxyScheme { get; set; }
+ public string? UpstreamProxyUser { get; set; }
+ public string? UpstreamProxyPass { get; set; }
+ //public AgnosticProgram.ProxyRules.ProxyRulesResult RulesResult { get; set; } = new();
///
/// Only for Socks5
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyRequestsCache.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyRequestsCache.cs
index 6d8ac84..67a949b 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyRequestsCache.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyRequestsCache.cs
@@ -15,19 +15,19 @@ public class OrigValues
public class ApplyChangeSNI
{
public bool Apply { get; set; }
- public string Event_ApplyChangeSNI { get; set; } = string.Empty;
+ public string Comment { get; set; } = string.Empty;
}
public class ApplyFragment
{
public bool Apply { get; set; }
- public string Event_ApplyFragment { get; set; } = string.Empty;
+ public string Comment { get; set; } = string.Empty;
}
public class IsDestBlocked
{
public bool Apply { get; set; }
- public string Event_IsDestBlocked { get; set; } = string.Empty;
+ public string Comment { get; set; } = string.Empty;
}
public class ProxyRequestsCacheResult
@@ -49,7 +49,7 @@ public class ProxyRequestsCacheResult
{
DateTime now = DateTime.UtcNow;
TimeSpan ts = now - cachedReq.dt;
- if (ts >= TimeSpan.FromMinutes(30))
+ if (ts >= TimeSpan.FromHours(1)) // Cache Time
{
Caches.TryRemove(key, out _);
}
diff --git a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyTunnel.cs b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyTunnel.cs
index 9543fcb..80826cb 100644
--- a/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyTunnel.cs
+++ b/MsmhToolsClass/MsmhToolsClass/MsmhAgnosticServer/ProxyServer/ProxyTunnel.cs
@@ -13,7 +13,6 @@ internal class ProxyTunnel
public ProxyClient RemoteClient;
public ProxyRequest Req;
- private readonly AgnosticSettings Settings_;
private TcpClient? ProxifiedTcpClient_;
// Handle SSL
@@ -26,12 +25,11 @@ internal class ProxyTunnel
public readonly Stopwatch KillOnTimeout = new();
public bool ManualDisconnect { get; set; } = false;
- public ProxyTunnel(int connectionId, ProxyClient sc, ProxyRequest req, AgnosticSettings settings, AgnosticSettingsSSL settingsSSL)
+ public ProxyTunnel(int connectionId, ProxyClient sc, ProxyRequest req, AgnosticSettingsSSL settingsSSL)
{
ConnectionId = connectionId;
Client = sc;
Req = req;
- Settings_ = settings;
SettingsSSL_ = settingsSSL;
try
@@ -105,8 +103,8 @@ await Task.Run(async () =>
while(true)
{
await Task.Delay(2000);
- if (Settings_.ProxyTimeoutSec > 0 &&
- KillOnTimeout.ElapsedMilliseconds > TimeSpan.FromSeconds(Settings_.ProxyTimeoutSec).TotalMilliseconds)
+ if (Req.TimeoutSec > 0 &&
+ KillOnTimeout.ElapsedMilliseconds > TimeSpan.FromSeconds(Req.TimeoutSec).TotalMilliseconds)
{
//string msg = $"Killed Request On Timeout({Req.TimeoutSec} Sec): {Req.AddressOrig}:{Req.Port}";
//Debug.WriteLine(msg);
@@ -127,7 +125,7 @@ await Task.Run(async () =>
});
}
- public async void Open(AgnosticProgram.ProxyRules rulesProgram)
+ public async void Open()
{
try
{
@@ -159,28 +157,24 @@ public async void Open(AgnosticProgram.ProxyRules rulesProgram)
(Req.ProxyName == Proxy.Name.Socks5 && Req.Command == Socks.Commands.Connect))
{
// Only Connect Can Support Upstream
- bool applyUpStreamProxy = false;
- if (Req.ApplyUpStreamProxy)
+ bool upStreamProxyApplied = false;
+
+ if (Req.ApplyUpstreamProxy && !string.IsNullOrWhiteSpace(Req.UpstreamProxyScheme))
{
- if (!string.IsNullOrEmpty(Req.RulesResult.ProxyScheme))
- ProxifiedTcpClient_ = await rulesProgram.ConnectToUpStream(Req).ConfigureAwait(false);
- else
- {
- ProxifiedTcpClient proxifiedTcpClient = new(Settings_.UpstreamProxyScheme, Settings_.UpstreamProxyUser, Settings_.UpstreamProxyPass);
- var upstream = await proxifiedTcpClient.TryGetConnectedProxifiedTcpClient(Req.Address, Req.Port).ConfigureAwait(false);
- if (upstream.isSuccess && upstream.proxifiedTcpClient != null)
- ProxifiedTcpClient_ = upstream.proxifiedTcpClient;
- }
+ ProxifiedTcpClient proxifiedTcpClient = new(Req.UpstreamProxyScheme, Req.UpstreamProxyUser, Req.UpstreamProxyPass);
+ var upstream = await proxifiedTcpClient.TryGetConnectedProxifiedTcpClient(Req.Address, Req.Port).ConfigureAwait(false);
+ if (upstream.isSuccess && upstream.proxifiedTcpClient != null)
+ ProxifiedTcpClient_ = upstream.proxifiedTcpClient;
if (ProxifiedTcpClient_ != null)
{
- applyUpStreamProxy = true;
+ upStreamProxyApplied = true;
RemoteClient.Socket_ = ProxifiedTcpClient_.Client;
ConnectHandler();
}
}
- if (!applyUpStreamProxy)
+ if (!upStreamProxyApplied)
{
await RemoteClient.Socket_.ConnectAsync(Req.Address, Req.Port).ConfigureAwait(false);
ConnectHandler();
@@ -248,7 +242,8 @@ private async void ConnectHandler()
}
// Receive Data From Both EndPoints
- if (SettingsSSL_.EnableSSL && Req.ApplyChangeSNI && !Req.AddressIsIp) // Cert Can't Be Valid When There's An IP Without A Domain. Like SOCKS4
+ bool ssl = Req.ApplyChangeSNI && !string.IsNullOrWhiteSpace(Req.AddressSNI) && !Req.AddressSNI.Equals(Req.AddressOrig) && !Req.AddressIsIp; // Cert Can't Be Valid When There's An IP Without A Domain. Like SOCKS4
+ if (ssl)
{
ClientSSL = new(this);
OnDataReceived?.Invoke(this, EventArgs.Empty);
@@ -257,6 +252,7 @@ private async void ConnectHandler()
else
{
OnDataReceived?.Invoke(this, EventArgs.Empty);
+
Task ct = Client.StartReceiveAsync();
Task rt = RemoteClient.StartReceiveAsync();
await Task.WhenAll(ct, rt).ConfigureAwait(false); // Both Must Receive At The Same Time
@@ -273,20 +269,11 @@ private async void ConnectHandler()
private async Task HttpHandler()
{
// Support Upstream Proxy For HTTP Get Method
- if (Req.ApplyUpStreamProxy)
+ if (Req.ApplyUpstreamProxy && !string.IsNullOrWhiteSpace(Req.UpstreamProxyScheme))
{
- if (!string.IsNullOrEmpty(Req.RulesResult.ProxyScheme))
- {
- Req.HttpRequest.ProxyScheme = Req.RulesResult.ProxyScheme;
- Req.HttpRequest.ProxyUser = Req.RulesResult.ProxyUser;
- Req.HttpRequest.ProxyPass = Req.RulesResult.ProxyPass;
- }
- else
- {
- Req.HttpRequest.ProxyScheme = Settings_.UpstreamProxyScheme;
- Req.HttpRequest.ProxyUser = Settings_.UpstreamProxyUser;
- Req.HttpRequest.ProxyPass = Settings_.UpstreamProxyPass;
- }
+ Req.HttpRequest.ProxyScheme = Req.UpstreamProxyScheme;
+ Req.HttpRequest.ProxyUser = Req.UpstreamProxyUser;
+ Req.HttpRequest.ProxyPass = Req.UpstreamProxyPass;
}
HttpRequestResponse hrr = await HttpRequest.SendAsync(Req.HttpRequest).ConfigureAwait(false);
diff --git a/MsmhToolsClass/MsmhToolsClass/NetworkTool.cs b/MsmhToolsClass/MsmhToolsClass/NetworkTool.cs
index eeb3b3c..1429ed1 100644
--- a/MsmhToolsClass/MsmhToolsClass/NetworkTool.cs
+++ b/MsmhToolsClass/MsmhToolsClass/NetworkTool.cs
@@ -7,6 +7,7 @@
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
+using System.Numerics;
using System.Runtime.InteropServices;
namespace MsmhToolsClass;
@@ -249,7 +250,7 @@ public static void GetHostDetails(string hostIpPort, int defaultPort, out string
host = host0;
// Get Base Host
- if (!IsIp(host, out _) && host.Contains('.'))
+ if (!IsIP(host, out _) && host.Contains('.'))
{
baseHost = host;
string[] dotSplit = host.Split('.');
@@ -293,15 +294,60 @@ public static void GetHostDetails(string hostIpPort, int defaultPort, out string
}
}
- public static bool IsLocalIP(string ipv4)
+ ///
+ /// IsLocalIP
+ ///
+ /// IPv4 Or IPv6
+ public static bool IsLocalIP(string ipStr)
{
- if (string.IsNullOrEmpty(ipv4)) return false;
- string ip = ipv4.Trim();
- return ip.ToLower().Equals("localhost") || ip.Equals("0.0.0.0") || ip.StartsWith("10.") || ip.StartsWith("127.") || ip.StartsWith("192.168.") ||
- ip.StartsWith("172.16.") || ip.StartsWith("172.17.") || ip.StartsWith("172.18.") || ip.StartsWith("172.19.") ||
- ip.StartsWith("172.20.") || ip.StartsWith("172.21.") || ip.StartsWith("172.22.") || ip.StartsWith("172.23.") ||
- ip.StartsWith("172.24.") || ip.StartsWith("172.25.") || ip.StartsWith("172.26.") || ip.StartsWith("172.27.") ||
- ip.StartsWith("172.28.") || ip.StartsWith("172.29.") || ip.StartsWith("172.30.") || ip.StartsWith("172.31.");
+ try
+ {
+ if (string.IsNullOrWhiteSpace(ipStr)) return false;
+ bool isIp = IsIP(ipStr, out IPAddress? ip);
+ if (!isIp) return false;
+
+ if (isIp && ip != null)
+ {
+ if (IPAddress.IsLoopback(ip)) return true;
+ if (ip.IsIPv6LinkLocal) return true;
+ if (ip.IsIPv6SiteLocal) return true;
+ if (ip.IsIPv6UniqueLocal) return true;
+ }
+
+ List localCIDRs = new()
+ {
+ "0.0.0.0/8",
+ "10.0.0.0/8",
+ "100.64.0.0/10",
+ "127.0.0.0/8",
+ "169.254.0.0/16",
+ "172.16.0.0/12",
+ "192.0.0.0/24",
+ "192.0.2.0/24",
+ "192.88.99.0/24",
+ "192.168.0.0/16",
+ "198.18.0.0/15",
+ "198.51.100.0/24",
+ "203.0.113.0/24",
+ "224.0.0.0/3",
+ "::/127",
+ "fc00::/7",
+ "fe80::/10",
+ "ff00::/8"
+ };
+
+ for (int n = 0; n < localCIDRs.Count; n++)
+ {
+ string cidr = localCIDRs[n].Trim();
+ bool isInRange = IsIpInRange(ipStr, cidr);
+ if (isInRange) return true;
+ }
+ return false;
+ }
+ catch (Exception)
+ {
+ return false;
+ }
}
///
@@ -456,7 +502,7 @@ public static bool IsDomainNameValid(string domain)
return Uri.CheckHostName(domain) != UriHostNameType.Unknown;
}
- public static bool IsIp(string ipStr, out IPAddress? ip)
+ public static bool IsIP(string ipStr, out IPAddress? ip)
{
ip = null;
if (!string.IsNullOrEmpty(ipStr))
@@ -514,6 +560,76 @@ public static bool IsIPv6(IPAddress iPAddress)
return iPAddress.AddressFamily == AddressFamily.InterNetworkV6;
}
+ ///
+ /// Is Ip In Range
+ ///
+ /// IPv4 Or IPv6
+ /// IPv4 CIDR Or IPv6 CIDR
+ /// True Or False
+ public static bool IsIpInRange(string ipStr, string cidr)
+ {
+ bool isInRange = false;
+
+ try
+ {
+ // Split CIDR Into Base IP And Prefix Length
+ if (!string.IsNullOrWhiteSpace(ipStr) && cidr.Contains('/'))
+ {
+ string[] split = cidr.Split('/', StringSplitOptions.TrimEntries);
+ if (split.Length == 2)
+ {
+ string cidrBase = split[0];
+ string prefix = split[1];
+ bool isInt = int.TryParse(prefix, out int prefixLength);
+ if (isInt)
+ {
+ // Convert Input IP And CIDR Base To Byte Array
+ bool isInputIP = IPAddress.TryParse(ipStr, out IPAddress? ip);
+ if (isInputIP && ip != null)
+ {
+ bool isCidrBaseIP = IPAddress.TryParse(cidrBase, out IPAddress? cidrIP);
+ if (isCidrBaseIP && cidrIP != null)
+ {
+ byte[] ipBytes = ip.GetAddressBytes();
+ byte[] cidrBytes = cidrIP.GetAddressBytes();
+
+ // If IP Address Families Match
+ if (ipBytes.Length == cidrBytes.Length)
+ {
+ // Calculate The Mask From The Prefix Length
+ int maskBits = prefixLength;
+ byte[] maskBytes = new byte[ipBytes.Length];
+
+ for (int n = 0; n < maskBytes.Length; n++)
+ {
+ int remainingBits = Math.Min(maskBits, 8);
+ maskBytes[n] = (byte)(255 << (8 - remainingBits));
+ maskBits -= remainingBits;
+ }
+
+ // Apply The Mask And Compare
+ for (int n = 0; n < ipBytes.Length; n++)
+ {
+ if ((ipBytes[n] & maskBytes[n]) != (cidrBytes[n] & maskBytes[n])) return false;
+ }
+
+ // If All Matches It's In Range
+ isInRange = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("NetworkTool IsIpInRange: " + ex.Message);
+ }
+
+ return isInRange;
+ }
+
///
/// Is IP Protocol Supported By ISP (Windows Only)
///
@@ -1045,7 +1161,7 @@ public static async Task UnsetDnsIPv4(string nicName, string dns1, string? dns2)
}
///
- /// Unset IPv4 DNS to DHCP (Windows Only)
+ /// Unset IPv6 DNS to DHCP (Windows Only)
///
/// Network Interface Name
public static async Task UnsetDnsIPv6(string nicName)
@@ -1070,7 +1186,7 @@ public static async Task UnsetDnsIPv6(string nicName)
}
///
- /// Unset IPv4 DNS to DHCP (Windows Only)
+ /// Unset IPv6 DNS to DHCP (Windows Only)
///
/// Network Interface
public static async Task UnsetDnsIPv6(NetworkInterface nic)
@@ -1078,10 +1194,36 @@ public static async Task UnsetDnsIPv6(NetworkInterface nic)
if (!OperatingSystem.IsWindows()) return;
// Requires Elevation - Can't Unset DNS when there is no Internet connectivity but netsh can :)
if (nic == null) return;
-
+
await UnsetDnsIPv6(nic.Name);
}
+ ///
+ /// Unset IPv6 DNS by seting DNS to Static
+ ///
+ /// Network Interface
+ /// Primary
+ /// Secondary
+ public static async Task UnsetDnsIPv6(NetworkInterface nic, string dns1, string? dns2)
+ {
+ string dnsServers = dns1;
+ if (!string.IsNullOrEmpty(dns2)) dnsServers += $",{dns2}";
+ await SetDnsIPv6(nic, dnsServers);
+ }
+
+ ///
+ /// Unset IPv6 DNS by seting DNS to Static
+ ///
+ /// Network Interface Name
+ /// Primary
+ /// Secondary
+ public static async Task UnsetDnsIPv6(string nicName, string dns1, string? dns2)
+ {
+ string dnsServers = dns1;
+ if (!string.IsNullOrEmpty(dns2)) dnsServers += $",{dns2}";
+ await SetDnsIPv6(nicName, dnsServers);
+ }
+
///
/// Is DNS Set to 127.0.0.1 - Using Nslookup (Windows Only)
///
@@ -1403,7 +1545,8 @@ public static async Task GetHeadersAsync(string urlOrDomain, string? ip,
firstTrySuccess = true;
}
- result = resultList.ToString(Environment.NewLine);
+ if (resultList.Count > 0)
+ result = resultList.ToString(Environment.NewLine);
}
catch (Exception) { }
@@ -1715,7 +1858,7 @@ public static async Task CanPing(string host, int timeoutMS)
{
Ping ping = new();
PingReply? reply;
- bool isIp = IsIp(host, out IPAddress? ip);
+ bool isIp = IsIP(host, out IPAddress? ip);
if (isIp && ip != null)
reply = ping.Send(ip, timeoutMS);
else
diff --git a/MsmhToolsClass/MsmhToolsClass/ProcessConsole.cs b/MsmhToolsClass/MsmhToolsClass/ProcessConsole.cs
index da8bd93..dfa8876 100644
--- a/MsmhToolsClass/MsmhToolsClass/ProcessConsole.cs
+++ b/MsmhToolsClass/MsmhToolsClass/ProcessConsole.cs
@@ -137,11 +137,14 @@ private void Process__OutputDataReceived(object sender, DataReceivedEventArgs e)
string? msg = e.Data;
if (msg != null)
{
- Stdout = msg;
- StandardDataReceived?.Invoke(this, e);
-
// Add To Bag
- StdoutBag.Add(msg);
+ if (!string.IsNullOrWhiteSpace(msg))
+ {
+ Stdout = msg;
+ StdoutBag.Add(msg);
+ }
+
+ StandardDataReceived?.Invoke(this, e);
}
}
@@ -150,11 +153,14 @@ private void Process__ErrorDataReceived(object sender, DataReceivedEventArgs e)
string? msg = e.Data;
if (msg != null)
{
- Stderr = msg;
- ErrorDataReceived?.Invoke(this, e);
-
// Add To Bag
- StderrBag.Add(msg);
+ if (!string.IsNullOrWhiteSpace(msg))
+ {
+ Stderr = msg;
+ StderrBag.Add(msg);
+ }
+
+ ErrorDataReceived?.Invoke(this, e);
}
}
@@ -163,7 +169,7 @@ private void Process__ErrorDataReceived(object sender, DataReceivedEventArgs e)
///
/// Command
/// Returns True if success
- public async Task SendCommandAsync(string command, int delayMS = 200, int timeoutSec = 15)
+ public async Task SendCommandAsync(string command, int delayMS = 50, int timeoutSec = 15, string confirmMsg = "")
{
bool isSent = false;
@@ -171,7 +177,8 @@ public async Task SendCommandAsync(string command, int delayMS = 200, int
{
if (Process_ != null && ProcessManager.FindProcessByPID(GetPid))
{
- Task wait = Task.Run(async () =>
+ // Delay
+ Task wait1 = Task.Run(async () =>
{
while (true)
{
@@ -181,15 +188,37 @@ public async Task SendCommandAsync(string command, int delayMS = 200, int
if (n1 == n2) break;
}
});
- try { await wait.WaitAsync(CancellationToken.None); } catch (Exception) { }
-
+ try { await wait1.WaitAsync(CancellationToken.None); } catch (Exception) { }
+ // Send Command
Task timeout = Task.Run(async () =>
{
await Process_.StandardInput.WriteLineAsync(command);
isSent = true;
});
try { await timeout.WaitAsync(TimeSpan.FromSeconds(timeoutSec)); } catch (Exception) { }
+
+ // Get Confirm
+ if (!string.IsNullOrWhiteSpace(confirmMsg))
+ {
+ Task confirm = Task.Run(async () =>
+ {
+ while (true)
+ {
+ if (GetStdout.Equals(confirmMsg))
+ {
+ isSent = true;
+ break;
+ }
+ else
+ {
+ isSent = false;
+ await Task.Delay(delayMS);
+ }
+ }
+ });
+ try { await confirm.WaitAsync(TimeSpan.FromSeconds(timeoutSec)); } catch (Exception) { }
+ }
}
}
catch (Exception ex)
diff --git a/MsmhToolsClass/MsmhToolsClass/ProcessManager.cs b/MsmhToolsClass/MsmhToolsClass/ProcessManager.cs
index 135cf29..e481eb4 100644
--- a/MsmhToolsClass/MsmhToolsClass/ProcessManager.cs
+++ b/MsmhToolsClass/MsmhToolsClass/ProcessManager.cs
@@ -15,10 +15,10 @@ public static class ProcessManager
/// Process
/// Delay to calculate usage (ms)
/// Returns -1 if fail
- public static async Task GetCpuUsage(Process process, int delay)
+ public static async Task GetCpuUsageAsync(Process process, int delay)
{
string processName = process.ProcessName;
- return await GetCpuUsage(processName, delay);
+ return await GetCpuUsageAsync(processName, delay);
}
///
@@ -27,12 +27,12 @@ public static async Task GetCpuUsage(Process process, int delay)
/// PID
/// Delay to calculate usage (ms)
/// Returns -1 if fail
- public static async Task GetCpuUsage(int pid, int delay)
+ public static async Task GetCpuUsageAsync(int pid, int delay)
{
if (pid < 0) return -1;
string processName = GetProcessNameByPID(pid);
if (!string.IsNullOrEmpty(processName))
- return await GetCpuUsage(processName, delay);
+ return await GetCpuUsageAsync(processName, delay);
return -1;
}
@@ -42,7 +42,7 @@ public static async Task GetCpuUsage(int pid, int delay)
/// Process Name
/// Delay to calculate usage (ms)
/// Returns -1 if fail
- public static async Task GetCpuUsage(string processName, int delay)
+ public static async Task GetCpuUsageAsync(string processName, int delay)
{
// To Get CPU Total Usage:
// new PerformanceCounter("Processor", "% Processor Time", "_Total");
@@ -66,7 +66,7 @@ await Task.Run(async () =>
}
catch (Exception ex)
{
- Debug.WriteLine($"Get CPU Usage: {ex.Message}");
+ Debug.WriteLine($"Get CPU Usage Async: {ex.Message}");
}
});
@@ -159,8 +159,12 @@ public static async Task ExecuteAsync(string processName, Dictionary kvp in environmentVariables)
- process0.StartInfo.EnvironmentVariables[kvp.Key] = kvp.Value;
+ try
+ {
+ foreach (KeyValuePair kvp in environmentVariables)
+ process0.StartInfo.EnvironmentVariables[kvp.Key] = kvp.Value;
+ }
+ catch (Exception) { }
}
if (args != null)
@@ -618,14 +622,23 @@ private static List GetAllChildProcesses(int parentPID)
public static string GetArguments(this Process process)
{
string result = string.Empty;
- if (!OperatingSystem.IsWindows()) return result;
- if (typeof(ManagementObjectSearcher) == null) return result;
- if (typeof(ManagementObjectCollection) == null) return result;
- if (typeof(ManagementBaseObject) == null) return result;
- using ManagementObjectSearcher searcher = new("SELECT CommandLine FROM Win32_Process WHERE ProcessId = " + process.Id);
- using ManagementObjectCollection objects = searcher.Get();
- result = objects.Cast().SingleOrDefault()?["CommandLine"]?.ToString() ?? string.Empty;
+ try
+ {
+ if (!OperatingSystem.IsWindows()) return result;
+ if (typeof(ManagementObjectSearcher) == null) return result;
+ if (typeof(ManagementObjectCollection) == null) return result;
+ if (typeof(ManagementBaseObject) == null) return result;
+
+ using ManagementObjectSearcher searcher = new("SELECT CommandLine FROM Win32_Process WHERE ProcessId = " + process.Id);
+ using ManagementObjectCollection objects = searcher.Get();
+ result = objects.Cast().SingleOrDefault()?["CommandLine"]?.ToString() ?? string.Empty;
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("ProcessManager GetArguments: " + ex.Message);
+ }
+
return result;
}
//-----------------------------------------------------------------------------------
diff --git a/MsmhToolsClass/MsmhToolsClass/ProcessMonitor.cs b/MsmhToolsClass/MsmhToolsClass/ProcessMonitor.cs
index 4e4ad78..32982b2 100644
--- a/MsmhToolsClass/MsmhToolsClass/ProcessMonitor.cs
+++ b/MsmhToolsClass/MsmhToolsClass/ProcessMonitor.cs
@@ -1,5 +1,6 @@
using Microsoft.Diagnostics.Tracing.Parsers;
using Microsoft.Diagnostics.Tracing.Session;
+using System.Diagnostics;
namespace MsmhToolsClass;
@@ -121,8 +122,9 @@ public void Start(bool bypassLocal)
EtwSession.StopOnDispose = false;
EtwSession.Source.Process();
}
- catch (Exception)
+ catch (Exception ex)
{
+ Debug.WriteLine("ProcessMonitor Start: " + ex.Message);
ResetNetCounters();
}
});
@@ -307,9 +309,16 @@ public void ResetNetCounters()
public void Dispose()
{
- if (ClearTimer.Enabled) ClearTimer.Stop();
- Stop = true;
- EtwSession?.Source.StopProcessing();
- EtwSession?.Dispose();
+ try
+ {
+ if (ClearTimer.Enabled) ClearTimer.Stop();
+ Stop = true;
+ EtwSession?.Source.StopProcessing();
+ EtwSession?.Dispose();
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("ProcessMonitor Dispose: " + ex.Message);
+ }
}
}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/StringTool.cs b/MsmhToolsClass/MsmhToolsClass/StringTool.cs
deleted file mode 100644
index a1a3afa..0000000
--- a/MsmhToolsClass/MsmhToolsClass/StringTool.cs
+++ /dev/null
@@ -1,564 +0,0 @@
-using System;
-using System.Globalization;
-using System.Text;
-using System.Text.RegularExpressions;
-
-namespace MsmhToolsClass;
-
-public static class StringTool
-{
-
- public static bool StartsWith(this string s, char c)
- {
- return s.Length > 0 && s[0] == c;
- }
-
- public static bool StartsWith(this StringBuilder sb, char c)
- {
- return sb.Length > 0 && sb[0] == c;
- }
-
- public static bool EndsWith(this string s, char c)
- {
- return s.Length > 0 && s[^1] == c;
- }
-
- public static bool EndsWith(this StringBuilder sb, char c)
- {
- return sb.Length > 0 && sb[^1] == c;
- }
-
- public static bool Contains(this string source, char value)
- {
- return source.Contains(value);
- }
-
- public static bool Contains(this string source, char[] value)
- {
- return source.IndexOfAny(value) >= 0;
- }
-
- public static bool Contains(this string source, string value, StringComparison comparisonType)
- {
- return source.Contains(value, comparisonType);
- }
-
- //============================================================================================
- private static char[] UnicodeControlChars { get; } = { '\u200E', '\u200F', '\u202A', '\u202B', '\u202C', '\u202D', '\u202E' };
-
- private static char[] PersianChars { get; } = { '\u06CC' };
- //public static char[] PersianChars { get; } = { 'ی' };
-
- public static bool ContainsUnicodeControlChars(this string s)
- {
- return s.Contains(UnicodeControlChars);
- }
-
- public static bool ContainsPersianChars(this string s)
- {
- return s.IndexOfAny(PersianChars) >= 0;
- }
- //============================================================================================
- public static bool IsEmpty(this string text)
- {
- text = text.RemoveHtmlTags();
- if (string.IsNullOrWhiteSpace(text) || text == string.Empty)
- return true;
-
- int countControlChar = 0;
- for (int a = 0; a < text.ToCharArray().Length; a++)
- {
- char ch = text.ToCharArray()[a];
- if (char.IsControl(ch))
- countControlChar++;
- }
-
- if (countControlChar == text.ToCharArray().Length)
- return true;
-
- bool isMatch = Regex.IsMatch(text, @"^[\r\n\s\t\v]+$");
- if (isMatch) return true;
-
- bool ucc = Regex.IsMatch(text, @"^[\u200E\u200F\u202A\u202B\u202C\u202D\u202E']+$");
- if (ucc) return true;
-
- return false;
- }
- //============================================================================================
- public static string RemoveUnicodeControlChars(this string s)
- {
- int max = s.Length;
- var newStr = new char[max];
- int newIdx = 0;
- for (int index = 0; index < max; index++)
- {
- char ch = s[index];
- if (!UnicodeControlChars.Contains(ch))
- {
- newStr[newIdx++] = ch;
- }
- }
-
- return new string(newStr, 0, newIdx);
- }
- //============================================================================================
- public static string RemoveControlChars(this string s)
- {
- int max = s.Length;
- var newStr = new char[max];
- int newIdx = 0;
- for (int index = 0; index < max; index++)
- {
- char ch = s[index];
- if (!char.IsControl(ch))
- {
- newStr[newIdx++] = ch;
- }
- }
-
- return new string(newStr, 0, newIdx);
- }
- //============================================================================================
- public static string RemoveHtmlTags(this string text)
- {
- string? output = HtmlTool.RemoveHtmlTags(text);
- if (output != null)
- return output;
- else
- return string.Empty;
- }
-
- //============================================================================================
-
- public static bool LineStartsWithHtmlTag(this string text, bool threeLengthTag, bool includeFont = false)
- {
- if (text == null || !threeLengthTag && !includeFont)
- {
- return false;
- }
-
- return StartsWithHtmlTag(text, threeLengthTag, includeFont);
- }
-
- public static bool LineEndsWithHtmlTag(this string text, bool threeLengthTag, bool includeFont = false)
- {
- if (text == null)
- {
- return false;
- }
-
- var len = text.Length;
- if (len < 6 || text[len - 1] != '>')
- {
- return false;
- }
-
- //
- if (threeLengthTag && len > 3 && text[len - 4] == '<' && text[len - 3] == '/')
- {
- return true;
- }
-
- if (includeFont && len > 8 && text[len - 7] == '<' && text[len - 6] == '/')
- {
- return true;
- }
-
- return false;
- }
-
- public static bool LineBreakStartsWithHtmlTag(this string text, bool threeLengthTag, bool includeFont = false)
- {
- if (text == null || (!threeLengthTag && !includeFont))
- {
- return false;
- }
-
- var newLineIdx = text.IndexOf(Environment.NewLine, StringComparison.Ordinal);
- if (newLineIdx < 0 || text.Length < newLineIdx + 5)
- {
- return false;
- }
-
- text = text[(newLineIdx + 2)..];
- return StartsWithHtmlTag(text, threeLengthTag, includeFont);
- }
-
- private static bool StartsWithHtmlTag(string text, bool threeLengthTag, bool includeFont)
- {
- if (threeLengthTag && text.Length >= 3 && text[0] == '<' && text[2] == '>' && (text[1] == 'i' || text[1] == 'I' || text[1] == 'u' || text[1] == 'U' || text[1] == 'b' || text[1] == 'B'))
- {
- return true;
- }
-
- if (includeFont && text.Length > 5 && text.StartsWith("', 5) >= 5; // or
- }
-
- return false;
- }
-
- public static int CountWords(this string source)
- {
- int count = 0;
- string? htmlNoTags = HtmlTool.RemoveHtmlTags(source);
- if (!string.IsNullOrEmpty(htmlNoTags))
- count = htmlNoTags.Split(new[] { ' ', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries).Length;
- return count;
- }
-
- // http://www.codeproject.com/Articles/43726/Optimizing-string-operations-in-C
- public static int FastIndexOf(this string source, string pattern)
- {
- if (string.IsNullOrEmpty(pattern))
- {
- return -1;
- }
-
- char c0 = pattern[0];
- if (pattern.Length == 1)
- {
- return source.IndexOf(c0);
- }
-
- int limit = source.Length - pattern.Length + 1;
- if (limit < 1)
- {
- return -1;
- }
-
- char c1 = pattern[1];
-
- // Find the first occurrence of the first character
- int first = source.IndexOf(c0, 0, limit);
- while (first != -1)
- {
- // Check if the following character is the same like
- // the 2nd character of "pattern"
- if (source[first + 1] != c1)
- {
- first = source.IndexOf(c0, ++first, limit - first);
- continue;
- }
-
- // Check the rest of "pattern" (starting with the 3rd character)
- var found = true;
- for (int j = 2; j < pattern.Length; j++)
- {
- if (source[first + j] != pattern[j])
- {
- found = false;
- break;
- }
- }
-
- // If the whole word was found, return its index, otherwise try again
- if (found)
- {
- return first;
- }
-
- first = source.IndexOf(c0, ++first, limit - first);
- }
-
- return -1;
- }
-
- public static int IndexOfAny(this string s, string[] words, StringComparison comparisonType)
- {
- if (words == null || string.IsNullOrEmpty(s))
- {
- return -1;
- }
-
- for (int i = 0; i < words.Length; i++)
- {
- var idx = s.IndexOf(words[i], comparisonType);
- if (idx >= 0)
- {
- return idx;
- }
- }
-
- return -1;
- }
-
- public static string FixExtraSpaces(this string s)
- {
- if (string.IsNullOrEmpty(s))
- {
- return s;
- }
-
- const char whiteSpace = ' ';
- int k = -1;
- for (int i = s.Length - 1; i >= 0; i--)
- {
- char ch = s[i];
- if (k < 2)
- {
- if (ch == whiteSpace)
- {
- k = i + 1;
- }
- }
- else if (ch != whiteSpace)
- {
- // only keep white space if it doesn't succeed/precede CRLF
- int skipCount = (ch == '\n' || ch == '\r') || (k < s.Length && (s[k] == '\n' || s[k] == '\r')) ? 1 : 2;
-
- // extra space found
- if (k - (i + skipCount) >= 1)
- {
- s = s.Remove(i + 1, k - (i + skipCount));
- }
-
- // Reset remove length.
- k = -1;
- }
- }
-
- return s;
- }
-
- public static bool ContainsLetter(this string s)
- {
- if (s != null)
- {
- foreach (var index in StringInfo.ParseCombiningCharacters(s))
- {
- var uc = CharUnicodeInfo.GetUnicodeCategory(s, index);
- if (uc == UnicodeCategory.LowercaseLetter || uc == UnicodeCategory.UppercaseLetter || uc == UnicodeCategory.TitlecaseLetter || uc == UnicodeCategory.ModifierLetter || uc == UnicodeCategory.OtherLetter)
- {
- return true;
- }
- }
- }
-
- return false;
- }
-
- public static bool ContainsNumber(this string s)
- {
- if (s == null)
- {
- return false;
- }
-
- int max = s.Length;
- for (int index = 0; index < max; index++)
- {
- var ch = s[index];
- if (char.IsNumber(ch))
- {
- return true;
- }
- }
-
- return false;
- }
-
- public static bool IsOnlyControlCharsOrWhiteSpace(this string s)
- {
- if (string.IsNullOrEmpty(s))
- {
- return true;
- }
-
- int max = s.Length;
- for (int index = 0; index < max; index++)
- {
- char ch = s[index];
- if (!char.IsControl(ch) && !char.IsWhiteSpace(ch) && !UnicodeControlChars.Contains(ch))
- {
- return false;
- }
- }
-
- return true;
- }
-
-
- public static string RemoveControlCharsButWhiteSpace(this string s)
- {
- int max = s.Length;
- var newStr = new char[max];
- int newIdx = 0;
- for (int index = 0; index < max; index++)
- {
- var ch = s[index];
- if (!char.IsControl(ch) || ch == '\u000d' || ch == '\u000a' || ch == '\u0009')
- {
- newStr[newIdx++] = ch;
- }
- }
-
- return new string(newStr, 0, newIdx);
- }
-
- public static string CapitalizeFirstLetter(this string s, CultureInfo? ci = null)
- {
- var si = new StringInfo(s);
- ci ??= CultureInfo.CurrentCulture;
-
- if (si.LengthInTextElements > 0)
- {
- s = si.SubstringByTextElements(0, 1).ToUpper(ci);
- }
-
- if (si.LengthInTextElements > 1)
- {
- s += si.SubstringByTextElements(1);
- }
-
- return s;
- }
-
- public static string RemoveChar(this string value, char charToRemove)
- {
- char[] array = new char[value.Length];
- int arrayIndex = 0;
- for (int i = 0; i < value.Length; i++)
- {
- char ch = value[i];
- if (ch != charToRemove)
- {
- array[arrayIndex++] = ch;
- }
- }
-
- return new string(array, 0, arrayIndex);
- }
-
- public static string RemoveChar(this string value, char charToRemove, char charToRemove2)
- {
- char[] array = new char[value.Length];
- int arrayIndex = 0;
- for (int i = 0; i < value.Length; i++)
- {
- char ch = value[i];
- if (ch != charToRemove && ch != charToRemove2)
- {
- array[arrayIndex++] = ch;
- }
- }
-
- return new string(array, 0, arrayIndex);
- }
-
- public static string RemoveChar(this string value, params char[] charsToRemove)
- {
- var h = new HashSet(charsToRemove);
- char[] array = new char[value.Length];
- int arrayIndex = 0;
- for (int i = 0; i < value.Length; i++)
- {
- char ch = value[i];
- if (!h.Contains(ch))
- {
- array[arrayIndex++] = ch;
- }
- }
-
- return new string(array, 0, arrayIndex);
- }
-
- ///
- /// Count characters excl. white spaces, ssa-tags, html-tags, control-characters, normal spaces and
- /// Arabic diacritics depending on parameter.
- ///
- public static int CountCharacters(this string value, bool removeNormalSpace, bool ignoreArabicDiacritics)
- {
- int length = 0;
- const char zeroWidthSpace = '\u200B';
- const char zeroWidthNoBreakSpace = '\uFEFF';
- char normalSpace = removeNormalSpace ? ' ' : zeroWidthSpace;
- bool ssaTagOn = false;
- bool htmlTagOn = false;
- var max = value.Length;
- for (int i = 0; i < max; i++)
- {
- char ch = value[i];
- if (ssaTagOn)
- {
- if (ch == '}')
- {
- ssaTagOn = false;
- }
- }
- else if (htmlTagOn)
- {
- if (ch == '>')
- {
- htmlTagOn = false;
- }
- }
- else if (ch == '{' && i < value.Length - 1 && value[i + 1] == '\\')
- {
- ssaTagOn = true;
- }
- else if (ch == '<' && i < value.Length - 1 && (value[i + 1] == '/' || char.IsLetter(value[i + 1])) &&
- value.IndexOf('>', i) > 0 && IsKnownHtmlTag(value, i))
- {
- htmlTagOn = true;
- }
- else if (!char.IsControl(ch) &&
- ch != zeroWidthSpace &&
- ch != zeroWidthNoBreakSpace &&
- ch != normalSpace &&
- ch != '\u200E' &&
- ch != '\u200F' &&
- ch != '\u202A' &&
- ch != '\u202B' &&
- ch != '\u202C' &&
- ch != '\u202D' &&
- ch != '\u202E' &&
- !(ignoreArabicDiacritics && ch >= '\u064B' && ch <= '\u0653'))
- {
- length++;
- }
- }
-
- return length;
- }
-
- private static bool IsKnownHtmlTag(string input, int idx)
- {
- var s = input.Remove(0, idx + 1).ToLowerInvariant();
- return s.StartsWith('/') ||
- s.StartsWith("i>", StringComparison.Ordinal) ||
- s.StartsWith("b>", StringComparison.Ordinal) ||
- s.StartsWith("u>", StringComparison.Ordinal) ||
- s.StartsWith("font ", StringComparison.Ordinal) ||
- s.StartsWith("ruby", StringComparison.Ordinal) ||
- s.StartsWith("span>", StringComparison.Ordinal) ||
- s.StartsWith("p>", StringComparison.Ordinal) ||
- s.StartsWith("br>", StringComparison.Ordinal) ||
- s.StartsWith("div>", StringComparison.Ordinal) ||
- s.StartsWith("div ", StringComparison.Ordinal);
- }
-
- public static bool HasSentenceEnding(this string value)
- {
- return value.HasSentenceEnding(string.Empty);
- }
-
- public static bool HasSentenceEnding(this string value, string twoLetterLanguageCode)
- {
- if (string.IsNullOrEmpty(value))
- {
- return false;
- }
-
- string? s = HtmlTool.RemoveHtmlTags(value)?.TrimEnd('"').TrimEnd('”');
- if (string.IsNullOrEmpty(s)) return false;
-
- var last = s[^1];
- return last == '.' || last == '!' || last == '?' || last == ']' || last == ')' || last == '…' || last == '♪' || last == '؟' ||
- twoLetterLanguageCode == "el" && last == ';' || twoLetterLanguageCode == "el" && last == '\u037E' ||
- last == '-' && s.Length > 3 && s.EndsWith("--", StringComparison.Ordinal) && char.IsLetter(s[^3]) ||
- last == '—' && s.Length > 2 && char.IsLetter(s[^2]);
- }
-
-}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/Texts.cs b/MsmhToolsClass/MsmhToolsClass/Texts.cs
deleted file mode 100644
index cef7db0..0000000
--- a/MsmhToolsClass/MsmhToolsClass/Texts.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System;
-using System.Text.RegularExpressions;
-
-namespace MsmhToolsClass;
-
-public class Texts
-{
- //-----------------------------------------------------------------------------------
- public static string? GetTextByLineNumber(string text, int lineNo)
- {
- string[] lines = text.Replace("\r", "").Split('\n');
- return lines.Length >= lineNo ? lines[lineNo - 1] : null;
- }
- //-----------------------------------------------------------------------------------
- public static bool IsValidRegex(string pattern)
- {
- if (string.IsNullOrWhiteSpace(pattern)) return false;
-
- try
- {
- Regex.Match("", pattern);
- }
- catch (ArgumentException)
- {
- return false;
- }
-
- return true;
- }
-}
\ No newline at end of file
diff --git a/MsmhToolsClass/MsmhToolsClass/WebAPI.cs b/MsmhToolsClass/MsmhToolsClass/WebAPI.cs
index 741399a..6031ee5 100644
--- a/MsmhToolsClass/MsmhToolsClass/WebAPI.cs
+++ b/MsmhToolsClass/MsmhToolsClass/WebAPI.cs
@@ -1,10 +1,162 @@
using System.Diagnostics;
+using System.Text;
namespace MsmhToolsClass;
public class WebAPI
{
- public static async Task CheckMaliciousUrl_IpQualityScore(string url, string apiKey, int timeoutMs = 30000)
+ public static async Task DownloadFileAsync(string url, int timeoutMs = 5000)
+ {
+ byte[] bytes = Array.Empty();
+
+ try
+ {
+ Uri uri = new(url);
+ HttpRequest hr = new()
+ {
+ Method = HttpMethod.Get,
+ AllowInsecure = true,
+ TimeoutMS = timeoutMs,
+ URI = uri
+ };
+ HttpRequestResponse hrr = await HttpRequest.SendAsync(hr).ConfigureAwait(false);
+ bytes = hrr.Data;
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("WebAPI DownloadFileAsync: " + ex.Message);
+ }
+
+ return bytes;
+ }
+
+ ///
+ /// Github Latest Release
+ ///
+ /// Returns Download Links
+ public static async Task> Github_Latest_Release_Async(string owner, string repo, int timeoutMs = 5000)
+ {
+ List relaeseURLs = new();
+
+ try
+ {
+ Uri apiMain = new($"https://api.github.com/repos/{owner}/{repo}/releases/latest");
+ HttpRequest hr = new()
+ {
+ Method = HttpMethod.Get,
+ AllowInsecure = true,
+ TimeoutMS = timeoutMs,
+ URI = apiMain,
+ Headers =
+ {
+ { "accept", "application/json" }
+ }
+ };
+ HttpRequestResponse hrr = await HttpRequest.SendAsync(hr).ConfigureAwait(false);
+ string json = Encoding.UTF8.GetString(hrr.Data);
+
+ List path = new()
+ {
+ new JsonTool.JsonPath() {Key = "assets", Count = 1, Conditions = new()},
+ new JsonTool.JsonPath() {Key = "browser_download_url", Conditions = new()}
+ };
+
+ relaeseURLs = JsonTool.GetValues(json, path);
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("WebAPI Github_Latest_Release_Async: " + ex.Message);
+ }
+
+ return relaeseURLs;
+ }
+
+ ///
+ /// Github Latest PreRelease
+ ///
+ /// Returns Download Links
+ public static async Task> Github_Latest_PreRelease_Async(string owner, string repo, int timeoutMs = 5000)
+ {
+ List relaeseURLs = new();
+
+ try
+ {
+ Uri apiMain = new($"https://api.github.com/repos/{owner}/{repo}/releases");
+ HttpRequest hr = new()
+ {
+ Method = HttpMethod.Get,
+ AllowInsecure = true,
+ TimeoutMS = timeoutMs,
+ URI = apiMain,
+ Headers =
+ {
+ { "accept", "application/json" }
+ }
+ };
+ HttpRequestResponse hrr = await HttpRequest.SendAsync(hr).ConfigureAwait(false);
+ string json = Encoding.UTF8.GetString(hrr.Data);
+
+ List path = new()
+ {
+ new JsonTool.JsonPath() {Key = "assets", Count = 1, Conditions = new List { new() { Key = "prerelease", Value = "true" } }},
+ new JsonTool.JsonPath() {Key = "browser_download_url", Conditions = new()}
+ };
+
+ relaeseURLs = JsonTool.GetValues(json, path);
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("WebAPI Github_Latest_PreRelease_Async: " + ex.Message);
+ }
+
+ return relaeseURLs;
+ }
+
+ public static async Task> Cloudflare_CDN_CIDRs_Async(int timeoutMs = 30000)
+ {
+ List result = new();
+
+ try
+ {
+ Uri apiMain = new("https://api.cloudflare.com/client/v4/ips");
+ HttpRequest hr = new()
+ {
+ Method = HttpMethod.Get,
+ AllowInsecure = true,
+ TimeoutMS = timeoutMs,
+ URI = apiMain,
+ Headers =
+ {
+ { "accept", "application/json" }
+ }
+ };
+ HttpRequestResponse hrr = await HttpRequest.SendAsync(hr).ConfigureAwait(false);
+ string json = Encoding.UTF8.GetString(hrr.Data);
+
+ List pathIPv4 = new()
+ {
+ new JsonTool.JsonPath() {Key = "result", Count = 1, Conditions = new()},
+ new JsonTool.JsonPath() {Key = "ipv4_cidrs", Conditions = new()}
+ };
+
+ List pathIPv6 = new()
+ {
+ new JsonTool.JsonPath() {Key = "result", Count = 1, Conditions = new()},
+ new JsonTool.JsonPath() {Key = "ipv6_cidrs", Conditions = new()}
+ };
+
+ result.AddRange(JsonTool.GetValues(json, pathIPv4));
+ result.AddRange(JsonTool.GetValues(json, pathIPv6));
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("WebAPI Cloudflare_CDN_CIDRs_Async: " + ex.Message);
+ }
+
+ return result;
+ }
+
+ public static async Task CheckMaliciousUrl_IpQualityScore_Async(string url, string apiKey, int timeoutMs = 30000)
{
int result = -1;
@@ -17,9 +169,9 @@ public static async Task CheckMaliciousUrl_IpQualityScore(string url, strin
Method = HttpMethod.Get,
RequestUri = new Uri($"https://ipqualityscore.com/api/json/url?key={apiKey}&url={url}"),
Headers =
- {
- { "accept", "application/json" }
- }
+ {
+ { "accept", "application/json" }
+ }
};
using HttpResponseMessage response = await httpClient.SendAsync(request);
Debug.WriteLine("CheckMaliciousUrl_IpQualityScore: " + response.StatusCode);
@@ -28,7 +180,12 @@ public static async Task CheckMaliciousUrl_IpQualityScore(string url, strin
string jsonString = await response.Content.ReadAsStringAsync();
Debug.WriteLine(jsonString);
- List strings = JsonTool.GetValues(jsonString, new List() { "risk_score" });
+ List path = new()
+ {
+ new JsonTool.JsonPath() {Key = "risk_score", Conditions = new()}
+ };
+
+ List strings = JsonTool.GetValues(jsonString, path);
if (strings.Any())
{
string riskScoreStr = strings[0].Trim();
@@ -40,7 +197,7 @@ public static async Task CheckMaliciousUrl_IpQualityScore(string url, strin
}
catch (Exception ex)
{
- Debug.WriteLine("CheckMaliciousUrl_IpQualityScore: " + ex.Message);
+ Debug.WriteLine("WebAPI CheckMaliciousUrl_IpQualityScore: " + ex.Message);
}
return result;
diff --git a/MsmhToolsWinFormsClass/MsmhToolsWinFormsClass/Controllers.cs b/MsmhToolsWinFormsClass/MsmhToolsWinFormsClass/Controllers.cs
index e134e9d..b0c94fc 100644
--- a/MsmhToolsWinFormsClass/MsmhToolsWinFormsClass/Controllers.cs
+++ b/MsmhToolsWinFormsClass/MsmhToolsWinFormsClass/Controllers.cs
@@ -14,16 +14,49 @@ public static List GetAllControls(Control control)
void getAllSubControlsByType(Control control)
{
- listC.Add(control);
+ try
+ {
+ listC.Add(control);
+
+ if (control.HasChildren)
+ {
+ for (int n = 0; n < control.Controls.Count; n++)
+ {
+ Control c = control.Controls[n];
+ getAllSubControlsByType(c);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Controllers GetAllControls: " + ex.Message);
+ }
+ }
+ return listC;
+ }
+ //-----------------------------------------------------------------------------------
+ public static List GetChildControls(Control control)
+ {
+ List listC = new();
+ getSubControlsByType(control);
- if (control.HasChildren)
+ void getSubControlsByType(Control control)
+ {
+ try
{
- for (int n = 0; n < control.Controls.Count; n++)
+ if (control.HasChildren)
{
- Control c = control.Controls[n];
- getAllSubControlsByType(c);
+ for (int n = 0; n < control.Controls.Count; n++)
+ {
+ Control c = control.Controls[n];
+ listC.Add(c);
+ }
}
}
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Controllers GetChildControls: " + ex.Message);
+ }
}
return listC;
}
@@ -35,15 +68,22 @@ public static List GetAllChildControls(Control control)
void getAllSubControlsByType(Control control)
{
- if (control.HasChildren)
+ try
{
- for (int n = 0; n < control.Controls.Count; n++)
+ if (control.HasChildren)
{
- Control c = control.Controls[n];
- listC.Add(c);
- getAllSubControlsByType(c);
+ for (int n = 0; n < control.Controls.Count; n++)
+ {
+ Control c = control.Controls[n];
+ listC.Add(c);
+ getAllSubControlsByType(c);
+ }
}
}
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Controllers GetAllChildControls: " + ex.Message);
+ }
}
return listC;
}
@@ -51,21 +91,30 @@ void getAllSubControlsByType(Control control)
public static List GetAllControlsByType(Control control)
{
List listT = new();
- var type = control.GetType();
- var fields = type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
- for (int n = 0; n < fields.Length; n++)
- {
- FieldInfo field = fields[n];
- object? value = field.GetValue(control);
- if (value != null &&
- (value.GetType().IsSubclassOf(typeof(T)) || value.GetType() == typeof(T)))
+ try
+ {
+ var type = control.GetType();
+ var fields = type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
+ for (int n = 0; n < fields.Length; n++)
{
- var t = (T)value;
- if (t != null)
- listT.Add(t);
+ FieldInfo field = fields[n];
+ object? value = field.GetValue(control);
+
+ if (value != null &&
+ (value.GetType().IsSubclassOf(typeof(T)) || value.GetType() == typeof(T)))
+ {
+ var t = (T)value;
+ if (t != null)
+ listT.Add(t);
+ }
}
}
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Controllers GetAllControlsByType: " + ex.Message);
+ }
+
return listT;
} // Usage: var toolStripButtons = GetSubControls(form);
//-----------------------------------------------------------------------------------
@@ -115,13 +164,22 @@ public static List GetAllControlsByType(Control control)
public static Control GetTopParent(Control control)
{
Control parent = control;
- if (control.Parent != null)
+
+ try
{
- parent = control.Parent;
- if (parent.Parent != null)
- while (parent.Parent != null)
- parent = parent.Parent;
+ if (control.Parent != null)
+ {
+ parent = control.Parent;
+ if (parent.Parent != null)
+ while (parent.Parent != null)
+ parent = parent.Parent;
+ }
}
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Controllers GetTopParent: " + ex.Message);
+ }
+
return parent;
}
//-----------------------------------------------------------------------------------
@@ -139,7 +197,7 @@ public static void SetDarkControl(Form form)
}
catch (Exception ex)
{
- Debug.WriteLine("Controllers_SetDarkControl: " + ex.Message);
+ Debug.WriteLine("Controllers SetDarkControl: " + ex.Message);
}
});
}
@@ -168,7 +226,7 @@ public static void InvalidateAll(Form form)
}
catch (Exception ex)
{
- Debug.WriteLine("Controllers_InvalidateAll: " + ex.Message);
+ Debug.WriteLine("Controllers InvalidateAll: " + ex.Message);
}
});
}
@@ -183,7 +241,7 @@ public static void InvalidateAll(Control control)
}
catch (Exception ex)
{
- Debug.WriteLine("Controllers_InvalidateAll: " + ex.Message);
+ Debug.WriteLine("Controllers InvalidateAll: " + ex.Message);
}
});
}
diff --git a/SDCAgnosticServer/ConsoleTools.cs b/SDCAgnosticServer/ConsoleTools.cs
index 8588c39..ebe85bb 100644
--- a/SDCAgnosticServer/ConsoleTools.cs
+++ b/SDCAgnosticServer/ConsoleTools.cs
@@ -1,5 +1,4 @@
using System.Diagnostics;
-using System.Reflection;
using System.Runtime.InteropServices;
namespace SDCAgnosticServer;
diff --git a/SDCAgnosticServer/ExecuteCommands.cs b/SDCAgnosticServer/ExecuteCommands.cs
index 6de115e..c3a26cd 100644
--- a/SDCAgnosticServer/ExecuteCommands.cs
+++ b/SDCAgnosticServer/ExecuteCommands.cs
@@ -66,8 +66,7 @@ await Task.Run(async () =>
{
string prefix = "help program";
if (input.ToLower().Equals($"{prefix} {Key.Programs.Fragment.Name.ToLower()}")) await Help.GetHelpFragmentAsync();
- else if (input.ToLower().Equals($"{prefix} {Key.Programs.DnsRules.Name.ToLower()}")) await Help.GetHelpDnsRulesAsync();
- else if (input.ToLower().Equals($"{prefix} {Key.Programs.ProxyRules.Name.ToLower()}")) await Help.GetHelpProxyRulesAsync();
+ else if (input.ToLower().Equals($"{prefix} {Key.Programs.Rules.Name.ToLower()}")) await Help.GetHelpRulesAsync();
else if (input.ToLower().Equals($"{prefix} {Key.Programs.DnsLimit.Name.ToLower()}")) await Help.GetHelpDnsLimitAsync();
else await Help.GetHelpProgramsAsync();
}
@@ -316,14 +315,14 @@ await Task.Run(async () =>
while (true)
{
string cfCleanIp = string.Empty;
- object value = await ConsoleTools.ReadValueAsync("Enter Cloudflare Clean IPv4 (Default: Empty)", cfCleanIp, typeof(string));
+ object value = await ConsoleTools.ReadValueAsync("Enter Cloudflare Clean IPv4 Or IPv6 (Default: Empty)", cfCleanIp, typeof(string));
cfCleanIp = value.ToString() ?? string.Empty;
cfCleanIp = cfCleanIp.Trim();
if (!string.IsNullOrEmpty(cfCleanIp))
{
- bool isIpv4Valid = NetworkTool.IsIPv4Valid(cfCleanIp, out _);
- if (isIpv4Valid) cloudflareCleanIP = cfCleanIp;
+ bool isIp = NetworkTool.IsIP(cfCleanIp, out _);
+ if (isIp) cloudflareCleanIP = cfCleanIp;
}
if (!string.IsNullOrEmpty(cloudflareCleanIP))
@@ -333,7 +332,7 @@ await Task.Run(async () =>
break;
}
- // Bootstrap Ip
+ // Bootstrap IP
while (true)
{
string getBootstrapIp = string.Empty;
@@ -744,8 +743,7 @@ await Task.Run(async () =>
{
string msg = "Available Programs:\n\n";
msg += $"{Key.Programs.Fragment.Name}\n";
- msg += $"{Key.Programs.DnsRules.Name}\n";
- msg += $"{Key.Programs.ProxyRules.Name}\n";
+ msg += $"{Key.Programs.Rules.Name}\n";
msg += $"{Key.Programs.DnsLimit.Name}\n";
// Interactive Mode
@@ -907,29 +905,29 @@ await Task.Run(async () =>
await ShowFragmentMsgAsync(FragmentStaticProgram);
}
- // Dns Rules
- else if (programName.ToLower().Equals(Key.Programs.DnsRules.Name.ToLower()))
+ // Rules
+ else if (programName.ToLower().Equals(Key.Programs.Rules.Name.ToLower()))
{
- string msgAm = $"Available {Key.Programs.DnsRules.Name} Modes:\n\n";
- msgAm += $"{Key.Programs.DnsRules.Mode.File}\n";
- msgAm += $"{Key.Programs.DnsRules.Mode.Text}\n";
- msgAm += $"{Key.Programs.DnsRules.Mode.Disable}\n";
+ string msgAm = $"Available {Key.Programs.Rules.Name} Modes:\n\n";
+ msgAm += $"{Key.Programs.Rules.Mode.File}\n";
+ msgAm += $"{Key.Programs.Rules.Mode.Text}\n";
+ msgAm += $"{Key.Programs.Rules.Mode.Disable}\n";
await WriteToStdoutAsync(msgAm, ConsoleColor.Cyan);
- string modeStr = Key.Programs.DnsRules.Mode.Disable;
- AgnosticProgram.DnsRules.Mode mode = AgnosticProgram.DnsRules.Mode.Disable;
+ string modeStr = Key.Programs.Rules.Mode.Disable;
+ AgnosticProgram.Rules.Mode mode = AgnosticProgram.Rules.Mode.Disable;
string msgRV = $"Enter One Of Modes (Default: {mode}):";
while (true)
{
object value = await ConsoleTools.ReadValueAsync(msgRV, modeStr, typeof(string));
modeStr = value.ToString() ?? string.Empty;
- if (modeStr.ToLower().Equals(Key.Programs.DnsRules.Mode.File.ToLower()))
- mode = AgnosticProgram.DnsRules.Mode.File;
- else if (modeStr.ToLower().Equals(Key.Programs.DnsRules.Mode.Text.ToLower()))
- mode = AgnosticProgram.DnsRules.Mode.Text;
- else if (modeStr.ToLower().Equals(Key.Programs.DnsRules.Mode.Disable.ToLower()))
- mode = AgnosticProgram.DnsRules.Mode.Disable;
+ if (modeStr.ToLower().Equals(Key.Programs.Rules.Mode.File.ToLower()))
+ mode = AgnosticProgram.Rules.Mode.File;
+ else if (modeStr.ToLower().Equals(Key.Programs.Rules.Mode.Text.ToLower()))
+ mode = AgnosticProgram.Rules.Mode.Text;
+ else if (modeStr.ToLower().Equals(Key.Programs.Rules.Mode.Disable.ToLower()))
+ mode = AgnosticProgram.Rules.Mode.Disable;
else
{
await WriteToStdoutAsync("Wrong Mode.", ConsoleColor.Red);
@@ -940,7 +938,7 @@ await Task.Run(async () =>
string filePathOrText = string.Empty;
- if (mode == AgnosticProgram.DnsRules.Mode.File)
+ if (mode == AgnosticProgram.Rules.Mode.File)
{
while (true)
{
@@ -949,7 +947,7 @@ await Task.Run(async () =>
filePathOrText = valuePath.ToString() ?? string.Empty;
if (string.IsNullOrEmpty(filePathOrText))
{
- mode = AgnosticProgram.DnsRules.Mode.Disable;
+ mode = AgnosticProgram.Rules.Mode.Disable;
break;
}
else
@@ -966,15 +964,15 @@ await Task.Run(async () =>
}
}
- if (mode == AgnosticProgram.DnsRules.Mode.Text)
+ if (mode == AgnosticProgram.Rules.Mode.Text)
{
- msgRV = $"Enter {Key.Programs.DnsRules.Name} As Text (Default: Cancel):";
+ msgRV = $"Enter {Key.Programs.Rules.Name} As Text (Default: Cancel):";
msgRV += "\n e.g. Google.com|8.8.8.8;\\nCloudflare.com|dns:tcp://8.8.8.8;";
object valueText = await ConsoleTools.ReadValueAsync(msgRV, string.Empty, typeof(string));
filePathOrText = valueText.ToString() ?? string.Empty;
if (string.IsNullOrEmpty(filePathOrText))
{
- mode = AgnosticProgram.DnsRules.Mode.Disable;
+ mode = AgnosticProgram.Rules.Mode.Disable;
}
else
{
@@ -982,91 +980,10 @@ await Task.Run(async () =>
}
}
- AgnosticProgram.DnsRules dnsRulesProgram = new();
- dnsRulesProgram.Set(mode, filePathOrText);
+ AgnosticProgram.Rules RulesProgram = new();
+ await RulesProgram.SetAsync(mode, filePathOrText);
- await ShowDnsRulesMsgAsync(dnsRulesProgram);
- }
-
- // ProxyRules
- else if (programName.ToLower().Equals(Key.Programs.ProxyRules.Name.ToLower()))
- {
- string msgAm = $"Available {Key.Programs.ProxyRules.Name} Modes:\n\n";
- msgAm += $"{Key.Programs.ProxyRules.Mode.File}\n";
- msgAm += $"{Key.Programs.ProxyRules.Mode.Text}\n";
- msgAm += $"{Key.Programs.ProxyRules.Mode.Disable}\n";
-
- await WriteToStdoutAsync(msgAm, ConsoleColor.Cyan);
-
- string modeStr = Key.Programs.ProxyRules.Mode.Disable;
- AgnosticProgram.ProxyRules.Mode mode = AgnosticProgram.ProxyRules.Mode.Disable;
- string msgRV = $"Enter One Of Modes (Default: {mode}):";
- while (true)
- {
- object value = await ConsoleTools.ReadValueAsync(msgRV, modeStr, typeof(string));
- modeStr = value.ToString() ?? string.Empty;
- if (modeStr.ToLower().Equals(Key.Programs.ProxyRules.Mode.File.ToLower()))
- mode = AgnosticProgram.ProxyRules.Mode.File;
- else if (modeStr.ToLower().Equals(Key.Programs.ProxyRules.Mode.Text.ToLower()))
- mode = AgnosticProgram.ProxyRules.Mode.Text;
- else if (modeStr.ToLower().Equals(Key.Programs.ProxyRules.Mode.Disable.ToLower()))
- mode = AgnosticProgram.ProxyRules.Mode.Disable;
- else
- {
- await WriteToStdoutAsync("Wrong Mode.", ConsoleColor.Red);
- continue;
- }
- break;
- }
-
- string filePathOrText = string.Empty;
-
- if (mode == AgnosticProgram.ProxyRules.Mode.File)
- {
- while (true)
- {
- msgRV = $"Enter The Path Of {mode} (Default: Cancel):";
- object valuePath = await ConsoleTools.ReadValueAsync(msgRV, string.Empty, typeof(string));
- filePathOrText = valuePath.ToString() ?? string.Empty;
- if (string.IsNullOrEmpty(filePathOrText))
- {
- mode = AgnosticProgram.ProxyRules.Mode.Disable;
- break;
- }
- else
- {
- filePathOrText = Path.GetFullPath(filePathOrText);
- if (!File.Exists(filePathOrText))
- {
- string msgNotExist = $"{filePathOrText}\nFile Not Exist.";
- await WriteToStdoutAsync(msgNotExist, ConsoleColor.Red);
- continue;
- }
- else break;
- }
- }
- }
-
- if (mode == AgnosticProgram.ProxyRules.Mode.Text)
- {
- msgRV = $"Enter {Key.Programs.ProxyRules.Name} As Text (Default: Cancel):";
- msgRV += "\n e.g. Google.com|8.8.8.8;\\nCloudflare.com|dns:tcp://8.8.8.8;";
- object valueText = await ConsoleTools.ReadValueAsync(msgRV, string.Empty, typeof(string));
- filePathOrText = valueText.ToString() ?? string.Empty;
- if (string.IsNullOrEmpty(filePathOrText))
- {
- mode = AgnosticProgram.ProxyRules.Mode.Disable;
- }
- else
- {
- filePathOrText = filePathOrText.ToLower().Replace(@"\n", Environment.NewLine);
- }
- }
-
- AgnosticProgram.ProxyRules proxyRulesProgram = new();
- proxyRulesProgram.Set(mode, filePathOrText);
-
- await ShowProxyRulesMsgAsync(proxyRulesProgram);
+ await ShowRulesMsgAsync(RulesProgram);
}
// Dns Limit
@@ -1273,102 +1190,39 @@ await Task.Run(async () =>
await ShowFragmentMsgAsync(fragmentStaticProgram);
}
- // DnsRules
- if (input.ToLower().StartsWith($"{Key.Programs.Name.ToLower()} {Key.Programs.DnsRules.Name.ToLower()}"))
- {
- // Programs DnsRules -Mode=m -PathOrText="m"
-
- // Get ModeStr
- string modeStr = Key.Programs.DnsRules.Mode.Disable;
- string key = Key.Programs.DnsRules.Mode.Name;
- isValueOk = ConsoleTools.TryGetValueByKey(input, key, true, false, out string value);
- if (!isValueOk) return;
-
- KeyValues modes = new();
- modes.Add(Key.Programs.DnsRules.Mode.File, true, false, typeof(string));
- modes.Add(Key.Programs.DnsRules.Mode.Text, true, false, typeof(string));
- modes.Add(Key.Programs.DnsRules.Mode.Disable, true, false, typeof(string));
-
- isValueOk = ConsoleTools.TryGetString(key, value, true, modes, out value);
- if (!isValueOk) return;
- modeStr = value;
-
- // Get -Mode
- AgnosticProgram.DnsRules.Mode mode = AgnosticProgram.DnsRules.Mode.Disable;
- if (modeStr.ToLower().Equals(Key.Programs.DnsRules.Mode.File.ToLower()))
- mode = AgnosticProgram.DnsRules.Mode.File;
- else if (modeStr.ToLower().Equals(Key.Programs.DnsRules.Mode.Text.ToLower()))
- mode = AgnosticProgram.DnsRules.Mode.Text;
- else if (modeStr.ToLower().Equals(Key.Programs.DnsRules.Mode.Disable.ToLower()))
- mode = AgnosticProgram.DnsRules.Mode.Disable;
-
- // Get -PathOrText
- string pathOrText = string.Empty;
- key = Key.Programs.DnsRules.PathOrText;
- if (mode != AgnosticProgram.DnsRules.Mode.Disable)
- {
- isValueOk = ConsoleTools.TryGetValueByKey(input, key, true, true, out value);
- if (!isValueOk) return;
- isValueOk = ConsoleTools.TryGetString(key, value, true, out value);
- if (!isValueOk) return;
- pathOrText = value;
- }
-
- if (mode == AgnosticProgram.DnsRules.Mode.File)
- {
- pathOrText = Path.GetFullPath(pathOrText);
- if (!File.Exists(pathOrText))
- {
- string msgNotExist = $"{pathOrText}\nFile Not Exist.";
- await WriteToStdoutAsync(msgNotExist, ConsoleColor.Red);
- return;
- }
- }
-
- if (mode == AgnosticProgram.DnsRules.Mode.Text)
- {
- pathOrText = pathOrText.ToLower().Replace(@"\n", Environment.NewLine);
- }
-
- AgnosticProgram.DnsRules dnsRulesProgram = new();
- dnsRulesProgram.Set(mode, pathOrText);
-
- await ShowDnsRulesMsgAsync(dnsRulesProgram);
- }
-
- // ProxyRules
- if (input.ToLower().StartsWith($"{Key.Programs.Name.ToLower()} {Key.Programs.ProxyRules.Name.ToLower()}"))
+ // Rules
+ if (input.ToLower().StartsWith($"{Key.Programs.Name.ToLower()} {Key.Programs.Rules.Name.ToLower()}"))
{
- // Programs ProxyRules -Mode=m -PathOrText="m"
+ // Programs Rules -Mode=m -PathOrText="m"
// Get ModeStr
- string modeStr = Key.Programs.ProxyRules.Mode.Disable;
- string key = Key.Programs.ProxyRules.Mode.Name;
+ string modeStr = Key.Programs.Rules.Mode.Disable;
+ string key = Key.Programs.Rules.Mode.Name;
isValueOk = ConsoleTools.TryGetValueByKey(input, key, true, false, out string value);
if (!isValueOk) return;
KeyValues modes = new();
- modes.Add(Key.Programs.ProxyRules.Mode.File, true, false, typeof(string));
- modes.Add(Key.Programs.ProxyRules.Mode.Text, true, false, typeof(string));
- modes.Add(Key.Programs.ProxyRules.Mode.Disable, true, false, typeof(string));
+ modes.Add(Key.Programs.Rules.Mode.File, true, false, typeof(string));
+ modes.Add(Key.Programs.Rules.Mode.Text, true, false, typeof(string));
+ modes.Add(Key.Programs.Rules.Mode.Disable, true, false, typeof(string));
isValueOk = ConsoleTools.TryGetString(key, value, true, modes, out value);
if (!isValueOk) return;
modeStr = value;
// Get -Mode
- AgnosticProgram.ProxyRules.Mode mode = AgnosticProgram.ProxyRules.Mode.Disable;
- if (modeStr.ToLower().Equals(Key.Programs.ProxyRules.Mode.File.ToLower()))
- mode = AgnosticProgram.ProxyRules.Mode.File;
- else if (modeStr.ToLower().Equals(Key.Programs.ProxyRules.Mode.Text.ToLower()))
- mode = AgnosticProgram.ProxyRules.Mode.Text;
- else if (modeStr.ToLower().Equals(Key.Programs.ProxyRules.Mode.Disable.ToLower()))
- mode = AgnosticProgram.ProxyRules.Mode.Disable;
+ AgnosticProgram.Rules.Mode mode = AgnosticProgram.Rules.Mode.Disable;
+ if (modeStr.ToLower().Equals(Key.Programs.Rules.Mode.File.ToLower()))
+ mode = AgnosticProgram.Rules.Mode.File;
+ else if (modeStr.ToLower().Equals(Key.Programs.Rules.Mode.Text.ToLower()))
+ mode = AgnosticProgram.Rules.Mode.Text;
+ else if (modeStr.ToLower().Equals(Key.Programs.Rules.Mode.Disable.ToLower()))
+ mode = AgnosticProgram.Rules.Mode.Disable;
// Get -PathOrText
string pathOrText = string.Empty;
- key = Key.Programs.ProxyRules.PathOrText;
- if (mode != AgnosticProgram.ProxyRules.Mode.Disable)
+ key = Key.Programs.Rules.PathOrText;
+ if (mode != AgnosticProgram.Rules.Mode.Disable)
{
isValueOk = ConsoleTools.TryGetValueByKey(input, key, true, true, out value);
if (!isValueOk) return;
@@ -1377,7 +1231,7 @@ await Task.Run(async () =>
pathOrText = value;
}
- if (mode == AgnosticProgram.ProxyRules.Mode.File)
+ if (mode == AgnosticProgram.Rules.Mode.File)
{
pathOrText = Path.GetFullPath(pathOrText);
if (!File.Exists(pathOrText))
@@ -1388,15 +1242,15 @@ await Task.Run(async () =>
}
}
- if (mode == AgnosticProgram.ProxyRules.Mode.Text)
+ if (mode == AgnosticProgram.Rules.Mode.Text)
{
pathOrText = pathOrText.ToLower().Replace(@"\n", Environment.NewLine);
}
- AgnosticProgram.ProxyRules proxyRulesProgram = new();
- proxyRulesProgram.Set(mode, pathOrText);
+ AgnosticProgram.Rules RulesProgram = new();
+ await RulesProgram.SetAsync(mode, pathOrText);
- await ShowProxyRulesMsgAsync(proxyRulesProgram);
+ await ShowRulesMsgAsync(RulesProgram);
}
// Dns Limit
@@ -1515,7 +1369,7 @@ await Task.Run(async () =>
{
// WriteRequests True
WriteRequestsToLog = true;
- await WriteToStdoutAsync($"WriteRequestsToLog: True", ConsoleColor.Green);
+ await WriteToStdoutAsync($"WriteRequestsToLog: True", ConsoleColor.Green, true, $"{Key.Common.Requests} {WriteRequestsToLog.ToString().CapitalizeFirstLetter()}");
// Save Command To List
string baseCmd = Key.Common.Requests;
@@ -1528,7 +1382,7 @@ await Task.Run(async () =>
{
// WriteRequests False
WriteRequestsToLog = false;
- await WriteToStdoutAsync($"WriteRequestsToLog: False", ConsoleColor.Green);
+ await WriteToStdoutAsync($"WriteRequestsToLog: False", ConsoleColor.Green, true, $"{Key.Common.Requests} {WriteRequestsToLog.ToString().CapitalizeFirstLetter()}");
// Save Command To List
string baseCmd = Key.Common.Requests;
@@ -1541,7 +1395,7 @@ await Task.Run(async () =>
{
// ChunkDetails True
WriteFragmentDetailsToLog = true;
- await WriteToStdoutAsync($"WriteFragmentDetailsToLog: True", ConsoleColor.Green);
+ await WriteToStdoutAsync($"WriteFragmentDetailsToLog: True", ConsoleColor.Green, true, $"{Key.Common.FragmentDetails} {WriteFragmentDetailsToLog.ToString().CapitalizeFirstLetter()}");
// Save Command To List
string baseCmd = Key.Common.FragmentDetails;
@@ -1554,7 +1408,7 @@ await Task.Run(async () =>
{
// ChunkDetails False
WriteFragmentDetailsToLog = false;
- await WriteToStdoutAsync($"WriteFragmentDetailsToLog: False", ConsoleColor.Green);
+ await WriteToStdoutAsync($"WriteFragmentDetailsToLog: False", ConsoleColor.Green, true, $"{Key.Common.FragmentDetails} {WriteFragmentDetailsToLog.ToString().CapitalizeFirstLetter()}");
// Save Command To List
string baseCmd = Key.Common.FragmentDetails;
@@ -1617,8 +1471,7 @@ await Task.Run(async () =>
if (sf.SettingsSSL != null) await sf.AgnosticServer.EnableSSL(sf.SettingsSSL);
if (sf.Fragment != null) sf.AgnosticServer.EnableFragment(sf.Fragment);
- if (sf.DnsRules != null) sf.AgnosticServer.EnableDnsRules(sf.DnsRules);
- if (sf.ProxyRules != null) sf.AgnosticServer.EnableProxyRules(sf.ProxyRules);
+ if (sf.Rules != null) sf.AgnosticServer.EnableRules(sf.Rules);
if (sf.DnsLimit != null) sf.AgnosticServer.EnableDnsLimit(sf.DnsLimit);
sf.AgnosticServer.Start(sf.Settings);
await Task.Delay(50);
@@ -1637,7 +1490,6 @@ await Task.Run(async () =>
}
else
{
- CountRequests = 0;
sf.AgnosticServer.OnRequestReceived -= ProxyServer_OnRequestReceived;
if (sf.Fragment != null)
sf.Fragment.OnChunkDetailsReceived -= FragmentStaticProgram_OnChunkDetailsReceived;
@@ -1658,7 +1510,7 @@ await Task.Run(async () =>
if (confirmed)
{
- await WriteToStdoutAsync("Confirmed", ConsoleColor.Green);
+ await WriteToStdoutAsync("Confirmed", ConsoleColor.Green, true, Key.Common.Start);
}
}
@@ -1666,7 +1518,6 @@ await Task.Run(async () =>
else if (input.ToLower().Equals(Key.Common.Stop.ToLower()))
{
// Stop
- CountRequests = 0;
foreach (ServerProfile sf in ServerProfiles)
{
if (sf.AgnosticServer != null && sf.Settings != null && !string.IsNullOrEmpty(sf.Name))
@@ -1704,8 +1555,7 @@ await Task.Run(async () =>
await WriteToStdoutAsync($"Updating {sf.Name}...", ConsoleColor.Cyan);
if (sf.Fragment != null) sf.AgnosticServer.EnableFragment(sf.Fragment);
- if (sf.DnsRules != null) sf.AgnosticServer.EnableDnsRules(sf.DnsRules);
- if (sf.ProxyRules != null) sf.AgnosticServer.EnableProxyRules(sf.ProxyRules);
+ if (sf.Rules != null) sf.AgnosticServer.EnableRules(sf.Rules);
if (sf.DnsLimit != null) sf.AgnosticServer.EnableDnsLimit(sf.DnsLimit);
await WriteToStdoutAsync($"{sf.Name} Updated", ConsoleColor.Green);
diff --git a/SDCAgnosticServer/Help.cs b/SDCAgnosticServer/Help.cs
index 38436b1..1ba1b99 100644
--- a/SDCAgnosticServer/Help.cs
+++ b/SDCAgnosticServer/Help.cs
@@ -156,12 +156,12 @@ public static async Task GetHelpAsync()
help = $" -{Key.Setting.CfCleanIP}=";
await WriteToStdoutAsync(help, ConsoleColor.Cyan);
- help = $" Cloudflare CDN Clean IP To Redirect All Cloudflare IPs To This One.";
+ help = $" Cloudflare CDN Clean IPv4 Or IPv6 To Redirect All Cloudflare IPs To This One.";
await WriteToStdoutAsync(help);
help = $" -{Key.Setting.BootstrapIp}=";
await WriteToStdoutAsync(help, ConsoleColor.Cyan);
- help = $" Bootstrap IPv4 (A Plain DNS).";
+ help = $" Bootstrap (A Plain DNS).";
await WriteToStdoutAsync(help);
help = $" -{Key.Setting.BootstrapPort}=";
@@ -267,14 +267,9 @@ public static async Task GetHelpAsync()
help = $" Activate Fragment To Circumvent Censorship (Requires Dns To Be Set To A DoH).";
await WriteToStdoutAsync(help);
- help = $" {Key.Programs.DnsRules.Name}";
+ help = $" {Key.Programs.Rules.Name}";
await WriteToStdoutAsync(help, ConsoleColor.Cyan);
- help = $" Set Per Domain DNS Rules. e.g. Block, FakeDNS, DNS, DnsDomain.";
- await WriteToStdoutAsync(help);
-
- help = $" {Key.Programs.ProxyRules.Name}";
- await WriteToStdoutAsync(help, ConsoleColor.Cyan);
- help = $" Set Per Domain Proxy Rules. e.g. Block, NoBypass, FakeDNS, DNS, FakeSNI, ETC.";
+ help = $" Set Per Domain/IP/CIDR Rules. e.g. Block, DNS, FakeDNS, Direct, FakeSNI, ETC.";
await WriteToStdoutAsync(help);
help = $" {Key.Programs.DnsLimit.Name}";
@@ -345,8 +340,7 @@ public static async Task GetHelpProgramsAsync()
msg = " ";
await WriteToStdoutAsync(msg, ConsoleColor.Blue);
msg = $" {Key.Programs.Fragment.Name}\n";
- msg += $" {Key.Programs.DnsRules.Name}\n";
- msg += $" {Key.Programs.ProxyRules.Name}\n";
+ msg += $" {Key.Programs.Rules.Name}\n";
msg += $" {Key.Programs.DnsLimit.Name}\n";
await WriteToStdoutAsync(msg, ConsoleColor.Cyan);
}
@@ -426,95 +420,37 @@ public static async Task GetHelpFragmentAsync()
await WriteToStdoutAsync(help);
}
- public static async Task GetHelpDnsRulesAsync()
- {
- // Help Program DnsRules
- // Programs DnsRules -Mode=m -PathOrText="m"
- string help;
- help = $"\nPrograms {Key.Programs.DnsRules.Name}";
- await WriteToStdoutAsync(help, ConsoleColor.Blue);
- help = $" Set Per Domain DnsRules. e.g. Block, FakeDNS, DNS, DnsDomain.";
- await WriteToStdoutAsync(help);
-
- // -Mode=
- help = "\n -Mode=";
- await WriteToStdoutAsync(help, ConsoleColor.Blue);
-
- help = $" {Key.Programs.DnsRules.Mode.File}";
- await WriteToStdoutAsync(help, ConsoleColor.Cyan);
- help = $" Dns Rules As File.";
- await WriteToStdoutAsync(help);
-
- help = $" {Key.Programs.DnsRules.Mode.Text}";
- await WriteToStdoutAsync(help, ConsoleColor.Cyan);
- help = $" Dns Rules As Text.";
- await WriteToStdoutAsync(help);
-
- help = $" {Key.Programs.DnsRules.Mode.Disable}";
- await WriteToStdoutAsync(help, ConsoleColor.Cyan);
- help = $" To Disable {Key.Programs.DnsRules.Name}.";
- await WriteToStdoutAsync(help);
-
- // -PathOrText=
- help = $"\n -{Key.Programs.DnsRules.PathOrText}=";
- await WriteToStdoutAsync(help, ConsoleColor.Blue);
- help = $" The File Path Or Text Depends On The Mode (Require Double Quotes).";
- help += $"\n File Mode: The Path Of File. (Each Line One Rule).";
- help += $"\n Text Mode: e.g. \"Google.com|8.8.8.8;\\nCloudflare.com|dns:tcp://8.8.8.8;\"";
- await WriteToStdoutAsync(help);
-
- // Examples
- help = $"\nExamples:";
- help += $"\n Programs {Key.Programs.DnsRules.Name} -Mode=Disable";
- help += $"\n Programs {Key.Programs.DnsRules.Name} -Mode=File -PathOrText=\"C:\\list.txt\"";
- help += $"\n Programs {Key.Programs.DnsRules.Name} -Mode=Text -PathOrText=\"Google.com|8.8.8.8\\nCloudflare.com|1.1.1.1\"";
- await WriteToStdoutAsync(help);
-
- // DnsRules Syntax Example
- help = $"\n{Key.Programs.DnsRules.Name} Syntax Example:";
- help += $"\n instagram.com|163.70.128.174;";
- help += $"\n youtube.com|dnsdomain:google.com;";
- help += $"\n ytimg.com|dnsdomain:google.com;";
- help += $"\n *.ytimg.com|dnsdomain:google.com;";
- help += $"\n ggpht.com|dnsdomain:google.com;";
- help += $"\n *.ggpht.com|dns:8.8.8.8:53;dnsdomain:*.googleusercontent.com;";
- help += $"\n *.googleapis|dns:8.8.8.8:53;dnsdomain:google.com;";
- help += $"\n *.googlevideo.com|dns:8.8.8.8:53;dnsdomain:*.c.docs.google.com;";
- help += $"\n\n More Help: https://github.com/msasanmh/SecureDNSClient/tree/main/Help";
- await WriteToStdoutAsync(help);
- }
-
- public static async Task GetHelpProxyRulesAsync()
+ public static async Task GetHelpRulesAsync()
{
- // Help Program ProxyRules
- // Programs ProxyRules -Mode=m -PathOrText="m"
+ // Help Program Rules
+ // Programs Rules -Mode=m -PathOrText="m"
string help;
- help = $"\nPrograms {Key.Programs.ProxyRules.Name}";
+ help = $"\nPrograms {Key.Programs.Rules.Name}";
await WriteToStdoutAsync(help, ConsoleColor.Blue);
- help = $" Set Per Domain ProxyRules. e.g. Block, NoBypass, FakeDNS, DNS, FakeSNI, ETC.";
+ help = $" Set Per Domain Rules. e.g. Block, NoBypass, FakeDNS, DNS, FakeSNI, ETC.";
await WriteToStdoutAsync(help);
// -Mode=
help = "\n -Mode=";
await WriteToStdoutAsync(help, ConsoleColor.Blue);
- help = $" {Key.Programs.ProxyRules.Mode.File}";
+ help = $" {Key.Programs.Rules.Mode.File}";
await WriteToStdoutAsync(help, ConsoleColor.Cyan);
- help = $" ProxyRules As File.";
+ help = $" Rules As File.";
await WriteToStdoutAsync(help);
- help = $" {Key.Programs.ProxyRules.Mode.Text}";
+ help = $" {Key.Programs.Rules.Mode.Text}";
await WriteToStdoutAsync(help, ConsoleColor.Cyan);
- help = $" ProxyRules As Text.";
+ help = $" Rules As Text.";
await WriteToStdoutAsync(help);
- help = $" {Key.Programs.ProxyRules.Mode.Disable}";
+ help = $" {Key.Programs.Rules.Mode.Disable}";
await WriteToStdoutAsync(help, ConsoleColor.Cyan);
- help = $" To Disable {Key.Programs.ProxyRules.Name}.";
+ help = $" To Disable {Key.Programs.Rules.Name}.";
await WriteToStdoutAsync(help);
// -PathOrText=
- help = $"\n -{Key.Programs.ProxyRules.PathOrText}=";
+ help = $"\n -{Key.Programs.Rules.PathOrText}=";
await WriteToStdoutAsync(help, ConsoleColor.Blue);
help = $" The File Path Or Text Depends On The Mode (Require Double Quotes).";
help += $"\n File Mode: The Path Of File. (Each Line One Rule).";
@@ -523,13 +459,13 @@ public static async Task GetHelpProxyRulesAsync()
// Examples
help = $"\nExamples:";
- help += $"\n Programs {Key.Programs.ProxyRules.Name} -Mode=Disable";
- help += $"\n Programs {Key.Programs.ProxyRules.Name} -Mode=File -PathOrText=\"C:\\list.txt\"";
- help += $"\n Programs {Key.Programs.ProxyRules.Name} -Mode=Text -PathOrText=\"Google.com|8.8.8.8\\nCloudflare.com|1.1.1.1\"";
+ help += $"\n Programs {Key.Programs.Rules.Name} -Mode=Disable";
+ help += $"\n Programs {Key.Programs.Rules.Name} -Mode=File -PathOrText=\"C:\\list.txt\"";
+ help += $"\n Programs {Key.Programs.Rules.Name} -Mode=Text -PathOrText=\"Google.com|8.8.8.8\\nCloudflare.com|1.1.1.1\"";
await WriteToStdoutAsync(help);
- // ProxyRules Syntax Example
- help = $"\n{Key.Programs.ProxyRules.Name} Syntax Example:";
+ // Rules Syntax Example
+ help = $"\n{Key.Programs.Rules.Name} Syntax Example:";
help += $"\n dns:8.8.8.8:53;";
help += $"\n instagram.com|163.70.128.174;sni:speedtest.com;";
help += $"\n youtube.com|dns:8.8.8.8:53;dnsdomain:google.com;sni:google.com;";
@@ -539,7 +475,7 @@ public static async Task GetHelpProxyRulesAsync()
help += $"\n *.ggpht.com|dns:8.8.8.8:53;dnsdomain:*.googleusercontent.com;";
help += $"\n *.googleapis|dns:8.8.8.8:53;dnsdomain:google.com;";
help += $"\n *.googlevideo.com|dns:8.8.8.8:53;dnsdomain:*.c.docs.google.com;sni:google.com;";
- help += $"\n\n More Help: https://github.com/msasanmh/SecureDNSClient/tree/main/Help";
+ help += $"\n\n More Help: https://github.com/msasanmh/SecureDNSClient";
await WriteToStdoutAsync(help);
}
diff --git a/SDCAgnosticServer/Profiles.cs b/SDCAgnosticServer/Profiles.cs
index bfcbc91..33cb3b9 100644
--- a/SDCAgnosticServer/Profiles.cs
+++ b/SDCAgnosticServer/Profiles.cs
@@ -10,8 +10,7 @@ public class ServerProfile
public AgnosticSettings? Settings { get; set; }
public AgnosticSettingsSSL? SettingsSSL { get; set; }
public AgnosticProgram.Fragment? Fragment { get; set; }
- public AgnosticProgram.DnsRules? DnsRules { get; set; }
- public AgnosticProgram.ProxyRules? ProxyRules { get; set; }
+ public AgnosticProgram.Rules? Rules { get; set; }
public AgnosticProgram.DnsLimit? DnsLimit { get; set; }
}
@@ -42,15 +41,10 @@ private static async void AddProfile(ServerProfile serverProfile)
existServerProfile.Fragment = serverProfile.Fragment;
existServerProfile.AgnosticServer.EnableFragment(existServerProfile.Fragment);
}
- if (serverProfile.DnsRules != null)
+ if (serverProfile.Rules != null)
{
- existServerProfile.DnsRules = serverProfile.DnsRules;
- existServerProfile.AgnosticServer.EnableDnsRules(existServerProfile.DnsRules);
- }
- if (serverProfile.ProxyRules != null)
- {
- existServerProfile.ProxyRules = serverProfile.ProxyRules;
- existServerProfile.AgnosticServer.EnableProxyRules(existServerProfile.ProxyRules);
+ existServerProfile.Rules = serverProfile.Rules;
+ existServerProfile.AgnosticServer.EnableRules(existServerProfile.Rules);
}
if (serverProfile.DnsLimit != null)
{
diff --git a/SDCAgnosticServer/Program.cs b/SDCAgnosticServer/Program.cs
index 797f7b5..237b474 100644
--- a/SDCAgnosticServer/Program.cs
+++ b/SDCAgnosticServer/Program.cs
@@ -58,7 +58,6 @@ public static partial class Program
private static readonly Stopwatch StopWatchShowChunkDetails = new();
private static bool WriteRequestsToLog { get; set; } = false;
- private static uint CountRequests { get; set; } = 0;
private static bool WriteFragmentDetailsToLog { get; set; } = false;
private static int ParentPID { get; set; } = -1;
private static ConcurrentDictionary WaitingInputCommands { get; set; } = new();
@@ -68,9 +67,8 @@ public static async void ProxyServer_OnRequestReceived(object? sender, EventArgs
if (WriteRequestsToLog)
if (sender is string msg)
{
- CountRequests++;
if (!StopWatchShowRequests.IsRunning) StopWatchShowRequests.Start();
- if (CountRequests < 5 || StopWatchShowRequests.ElapsedMilliseconds > 40)
+ if (StopWatchShowRequests.ElapsedMilliseconds > 2)
{
await WriteToStderrAsync(msg, ConsoleColor.DarkGray, false);
@@ -221,8 +219,7 @@ private static async Task MainDetailsAsync(string profileName)
mainDetails += $"{sf.AgnosticServer.SettingsSSL_.ChangeSni}|"; // 6
mainDetails += $"{sf.AgnosticServer.IsFragmentActive}|"; // 7
mainDetails += $"{sf.AgnosticServer.FragmentProgram.FragmentMode}|"; // 8
- mainDetails += $"{sf.AgnosticServer.DnsRulesProgram.RulesMode}|"; // 9
- mainDetails += $"{sf.AgnosticServer.ProxyRulesProgram.RulesMode}|"; // 10
+ mainDetails += $"{sf.AgnosticServer.RulesProgram.RulesMode}|"; // 9
await WriteToStdoutAsync(mainDetails);
isMatch = true;
break;
@@ -245,7 +242,7 @@ private static async Task ShowProfileMsgAsync(bool save = true)
Profile = Profile.Trim();
if (!string.IsNullOrEmpty(Profile))
{
- await WriteToStdoutAsync($"{Environment.NewLine}{nameof(Profile)} Set To {Profile}", ConsoleColor.Cyan);
+ await WriteToStdoutAsync($"{Environment.NewLine}{nameof(Profile)} Set To {Profile}", ConsoleColor.Cyan, true, Key.Common.Profile);
if (save)
{
@@ -268,7 +265,7 @@ private static async Task ShowParentProcessMsgAsync()
{
string pid = ParentPID != -1 && ParentPID != 0 ? $"{ParentPID}" : "No Parent";
string msg = $"\nParent Process ID: {pid}";
- await WriteToStdoutAsync(msg, ConsoleColor.Green);
+ await WriteToStdoutAsync(msg, ConsoleColor.Green, true, Key.ParentProcess.Name);
}
private static async Task ShowSettingsMsgAsync(AgnosticSettings settings, bool save = true)
@@ -300,7 +297,7 @@ private static async Task ShowSettingsMsgAsync(AgnosticSettings settings, bool s
}
msg += $"\nApply Upstream Only To Blocked IPs: {settings.ApplyUpstreamOnlyToBlockedIps}";
}
- await WriteToStdoutAsync(msg, ConsoleColor.Blue);
+ await WriteToStdoutAsync(msg, ConsoleColor.Blue, true, Key.Setting.Name);
if (save)
{
@@ -353,7 +350,7 @@ private static async Task ShowSettingsSSLMsgAsync(AgnosticSettingsSSL settingsSS
else
msg += "\nDefault SNI: Empty (Original SNI Will Be Used)";
}
- await WriteToStdoutAsync(msg, ConsoleColor.Blue);
+ await WriteToStdoutAsync(msg, ConsoleColor.Blue, true, Key.SSLSetting.Name);
if (save)
{
@@ -385,7 +382,7 @@ private static async Task ShowFragmentMsgAsync(AgnosticProgram.Fragment fragment
result += $"\nAnti-Pattern Offset: {fragmentProgram.AntiPatternOffset} Chunks";
result += $"\nFragment Delay: {fragmentProgram.FragmentDelay} ms";
}
- await WriteToStdoutAsync(result, ConsoleColor.Green);
+ await WriteToStdoutAsync(result, ConsoleColor.Green, true, Key.Programs.Fragment.Name);
if (save)
{
@@ -404,13 +401,14 @@ private static async Task ShowFragmentMsgAsync(AgnosticProgram.Fragment fragment
}
}
- private static async Task ShowDnsRulesMsgAsync(AgnosticProgram.DnsRules dnsRulesProgram, bool save = true)
+ private static async Task ShowRulesMsgAsync(AgnosticProgram.Rules rulesProgram, bool save = true)
{
try
{
- await WriteToStdoutAsync($"\n{Key.Programs.DnsRules.Name} Mode: {dnsRulesProgram.RulesMode}", ConsoleColor.Green);
- if (dnsRulesProgram.RulesMode != AgnosticProgram.DnsRules.Mode.Disable)
- await WriteToStdoutAsync($"Dns Rules:\n{dnsRulesProgram.PathOrText}", ConsoleColor.Green);
+ string result = $"\n{Key.Programs.Rules.Name} Mode: {rulesProgram.RulesMode}";
+ if (rulesProgram.RulesMode != AgnosticProgram.Rules.Mode.Disable)
+ result += $"\nRules:\n{rulesProgram.PathOrText}";
+ await WriteToStdoutAsync(result, ConsoleColor.Green, true, Key.Programs.Rules.Name);
if (save)
{
@@ -418,39 +416,14 @@ private static async Task ShowDnsRulesMsgAsync(AgnosticProgram.DnsRules dnsRules
ServerProfile sf = new()
{
Name = Profile,
- DnsRules = dnsRulesProgram
+ Rules = rulesProgram
};
AddProfile(sf);
}
}
catch (Exception ex)
{
- Debug.WriteLine("ShowDnsRulesMsgAsync: " + ex.Message);
- }
- }
-
- private static async Task ShowProxyRulesMsgAsync(AgnosticProgram.ProxyRules proxyRulesProgram, bool save = true)
- {
- try
- {
- await WriteToStdoutAsync($"\n{Key.Programs.ProxyRules.Name} Mode: {proxyRulesProgram.RulesMode}", ConsoleColor.Green);
- if (proxyRulesProgram.RulesMode != AgnosticProgram.ProxyRules.Mode.Disable)
- await WriteToStdoutAsync($"Proxy Rules:\n{proxyRulesProgram.PathOrText}", ConsoleColor.Green);
-
- if (save)
- {
- // Add Or Update Server Profile
- ServerProfile sf = new()
- {
- Name = Profile,
- ProxyRules = proxyRulesProgram
- };
- AddProfile(sf);
- }
- }
- catch (Exception ex)
- {
- Debug.WriteLine("ShowProxyRulesMsgAsync: " + ex.Message);
+ Debug.WriteLine("ShowRulesMsgAsync: " + ex.Message);
}
}
@@ -458,15 +431,16 @@ private static async Task ShowDnsLimitMsgAsync(AgnosticProgram.DnsLimit dnsLimit
{
try
{
- await WriteToStdoutAsync($"\n{Key.Programs.DnsLimit.Name} Enable: {dnsLimitProgram.EnableDnsLimit}", ConsoleColor.Green);
+ string result = $"\n{Key.Programs.DnsLimit.Name} Enable: {dnsLimitProgram.EnableDnsLimit}";
if (dnsLimitProgram.EnableDnsLimit)
{
- await WriteToStdoutAsync($"Disable Plain DNS: {dnsLimitProgram.DisablePlainDns}", ConsoleColor.Green);
- await WriteToStdoutAsync($"{Key.Programs.DnsLimit.DoHPathLimitMode.Name} Mode: {dnsLimitProgram.LimitDoHMode}", ConsoleColor.Green);
+ result += $"\nDisable Plain DNS: {dnsLimitProgram.DisablePlainDns}";
+ result += $"\n{Key.Programs.DnsLimit.DoHPathLimitMode.Name} Mode: {dnsLimitProgram.LimitDoHMode}";
if (dnsLimitProgram.LimitDoHMode != AgnosticProgram.DnsLimit.LimitDoHPathsMode.Disable)
- await WriteToStdoutAsync($"DoH Paths:\n{dnsLimitProgram.PathOrText}", ConsoleColor.Green);
+ result += $"\nDoH Paths:\n{dnsLimitProgram.PathOrText}";
}
-
+ await WriteToStdoutAsync(result, ConsoleColor.Green, true, Key.Programs.DnsLimit.Name);
+
if (save)
{
// Add Or Update Server Profile
@@ -480,7 +454,7 @@ private static async Task ShowDnsLimitMsgAsync(AgnosticProgram.DnsLimit dnsLimit
}
catch (Exception ex)
{
- Debug.WriteLine("ShowDnsRulesMsgAsync: " + ex.Message);
+ Debug.WriteLine("ShowDnsLimitMsgAsync: " + ex.Message);
}
}
@@ -526,8 +500,7 @@ private static async Task ShowStatusAsync()
if (sf.Settings != null) await ShowSettingsMsgAsync(sf.Settings, false);
if (sf.SettingsSSL != null) await ShowSettingsSSLMsgAsync(sf.SettingsSSL, false);
if (sf.Fragment != null) await ShowFragmentMsgAsync(sf.Fragment, false);
- if (sf.DnsRules != null) await ShowDnsRulesMsgAsync(sf.DnsRules, false);
- if (sf.ProxyRules != null) await ShowProxyRulesMsgAsync(sf.ProxyRules, false);
+ if (sf.Rules != null) await ShowRulesMsgAsync(sf.Rules, false);
if (sf.DnsLimit != null) await ShowDnsLimitMsgAsync(sf.DnsLimit, false);
}
}
@@ -631,19 +604,11 @@ private static async Task SaveCommandsToFileAsync()
commands.Add(cmd);
}
- if (sf.DnsRules != null)
+ if (sf.Rules != null)
{
- baseCmd = $"{Key.Programs.Name} {Key.Programs.DnsRules.Name}";
- cmd = $"{baseCmd} -{Key.Programs.DnsRules.Mode.Name}={sf.DnsRules.RulesMode}";
- cmd += $" -{Key.Programs.DnsRules.PathOrText}=\"{sf.DnsRules.PathOrText.Replace(Environment.NewLine, "\\n")}\"";
- commands.Add(cmd);
- }
-
- if (sf.ProxyRules != null)
- {
- baseCmd = $"{Key.Programs.Name} {Key.Programs.ProxyRules.Name}";
- cmd = $"{baseCmd} -{Key.Programs.ProxyRules.Mode.Name}={sf.ProxyRules.RulesMode}";
- cmd += $" -{Key.Programs.ProxyRules.PathOrText}=\"{sf.ProxyRules.PathOrText.Replace(Environment.NewLine, "\\n")}\"";
+ baseCmd = $"{Key.Programs.Name} {Key.Programs.Rules.Name}";
+ cmd = $"{baseCmd} -{Key.Programs.Rules.Mode.Name}={sf.Rules.RulesMode}";
+ cmd += $" -{Key.Programs.Rules.PathOrText}=\"{sf.Rules.PathOrText.Replace(Environment.NewLine, "\\n")}\"";
commands.Add(cmd);
}
@@ -718,7 +683,7 @@ private static async Task LoadCommandsFromFileAsync()
}
}
- private static async Task WriteToStdoutAsync(string msg, ConsoleColor consoleColor = ConsoleColor.White, bool resetColor = true)
+ private static async Task WriteToStdoutAsync(string msg, ConsoleColor consoleColor = ConsoleColor.White, bool resetColor = true, string confirmMsg = "")
{
try
{
@@ -727,6 +692,13 @@ private static async Task WriteToStdoutAsync(string msg, ConsoleColor consoleCol
foreach (string line in lines)
await Console.Out.WriteLineAsync(line);
if (resetColor) Console.ResetColor();
+
+ // Send Confirm Msg
+ if (!string.IsNullOrWhiteSpace(confirmMsg))
+ {
+ string confirm = $"Confirmed: {confirmMsg}";
+ await Console.Out.WriteLineAsync(confirm);
+ }
}
catch (Exception ex)
{
diff --git a/SDCAgnosticServer/Properties/PublishProfiles/X64.pubxml.user b/SDCAgnosticServer/Properties/PublishProfiles/X64.pubxml.user
index ee19abc..05f255d 100644
--- a/SDCAgnosticServer/Properties/PublishProfiles/X64.pubxml.user
+++ b/SDCAgnosticServer/Properties/PublishProfiles/X64.pubxml.user
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
- True|2024-06-18T13:31:39.6706828Z;True|2024-06-17T15:23:15.9045486+03:30;True|2024-06-16T19:20:08.5561502+03:30;True|2024-06-16T00:42:57.7703900+03:30;True|2024-06-15T22:29:56.7168556+03:30;True|2024-06-15T21:46:32.2693646+03:30;True|2024-06-15T21:18:20.1541669+03:30;True|2024-06-15T20:46:13.2250937+03:30;True|2024-06-15T17:53:22.3094268+03:30;True|2024-06-15T14:50:40.9456478+03:30;True|2024-06-15T14:49:21.5800057+03:30;True|2024-06-15T03:41:48.8619987+03:30;True|2024-06-14T15:08:39.6933673+03:30;True|2024-06-08T11:30:56.8571060+03:30;True|2024-06-06T17:54:48.5109753+03:30;True|2024-06-06T04:25:08.1488975+03:30;True|2024-06-06T01:26:08.3002810+03:30;True|2024-06-06T00:27:59.5483117+03:30;True|2024-06-02T17:02:42.3530323+03:30;True|2024-06-01T16:26:17.4822224+03:30;True|2024-06-01T15:06:37.4108339+03:30;True|2024-05-28T22:48:06.4803192+03:30;False|2024-05-28T22:46:57.0924933+03:30;True|2024-05-28T20:16:01.8592002+03:30;True|2024-05-18T19:28:49.7981366+03:30;True|2024-05-18T14:23:21.9582614+03:30;True|2024-05-07T17:12:56.7928156+03:30;True|2024-05-07T00:58:16.7488863+03:30;True|2024-05-07T00:45:17.3703620+03:30;True|2024-04-17T14:26:57.2593147+03:30;True|2024-04-16T11:56:39.2878116+03:30;True|2024-04-16T11:34:45.2074277+03:30;True|2024-04-14T23:48:29.1130956+03:30;True|2024-04-14T23:01:48.9303734+03:30;True|2024-04-14T21:40:52.7870328+03:30;True|2024-04-14T11:32:54.7899526+03:30;True|2024-04-13T19:34:37.5496555+03:30;True|2024-04-12T15:17:48.4181603+03:30;True|2024-04-12T13:49:10.4211023+03:30;True|2024-04-09T20:04:42.4503557+03:30;True|2024-04-09T15:57:06.7947364+03:30;True|2024-04-06T23:27:32.0137073+03:30;True|2024-04-05T16:25:10.6909463+03:30;True|2024-04-05T16:04:33.9982315+03:30;True|2024-04-04T11:27:43.0944181+03:30;True|2024-04-03T21:07:40.4309901+03:30;True|2024-04-03T18:41:51.6335233+03:30;True|2024-04-03T18:34:14.3713154+03:30;True|2024-04-03T17:49:59.7276264+03:30;True|2024-04-03T15:23:58.6489096+03:30;True|2024-02-12T16:40:05.5785975+03:30;True|2024-02-04T17:29:35.1950534+03:30;False|2024-02-04T17:15:19.5368282+03:30;False|2024-02-04T17:12:54.4662347+03:30;True|2024-01-24T16:01:35.7945782+03:30;True|2024-01-24T15:59:16.6773364+03:30;True|2024-01-21T21:48:49.8323952+03:30;True|2024-01-21T21:19:56.8670054+03:30;True|2024-01-02T20:47:37.6819460+03:30;True|2024-01-02T20:19:39.7710968+03:30;True|2024-01-02T20:16:41.6607200+03:30;True|2024-01-02T03:26:16.7917104+03:30;True|2024-01-02T03:00:36.9350439+03:30;True|2024-01-02T01:06:06.1702893+03:30;False|2024-01-02T01:03:29.4546421+03:30;True|2024-01-02T00:01:16.5185520+03:30;True|2023-11-26T16:07:09.3460352+03:30;True|2023-11-21T21:09:43.5173885+03:30;True|2023-11-21T21:06:03.9711272+03:30;True|2023-11-20T05:38:35.8888090+03:30;True|2023-11-20T05:26:01.6855162+03:30;True|2023-11-14T21:38:54.6692416+03:30;True|2023-11-10T02:32:23.1549504+03:30;True|2023-11-09T23:34:50.5100590+03:30;True|2023-11-09T22:54:31.5682635+03:30;True|2023-11-09T22:44:44.2203811+03:30;True|2023-11-09T22:21:38.6559608+03:30;True|2023-11-09T02:13:02.5944031+03:30;True|2023-11-09T01:48:41.3367617+03:30;True|2023-11-08T18:16:13.6177667+03:30;True|2023-11-01T16:01:01.7421359+03:30;True|2023-11-01T15:59:01.8859296+03:30;True|2023-11-01T15:56:18.6764972+03:30;True|2023-11-01T15:55:05.5325473+03:30;True|2023-10-27T17:25:04.2115256+03:30;True|2023-10-27T17:24:23.4811886+03:30;True|2023-10-27T17:23:25.4497652+03:30;True|2023-10-27T17:23:02.7561508+03:30;True|2023-10-05T21:40:46.6774899+03:30;True|2023-10-05T21:18:52.2534112+03:30;True|2023-10-03T22:51:55.0276418+03:30;True|2023-10-03T22:39:42.8762399+03:30;True|2023-10-03T17:52:21.3369730+03:30;True|2023-10-03T17:48:41.9002912+03:30;True|2023-10-02T14:42:05.5388747+03:30;True|2023-10-02T14:21:43.3615252+03:30;True|2023-10-01T23:09:26.1347867+03:30;True|2023-10-01T23:08:38.8528494+03:30;True|2023-10-01T22:56:12.2831265+03:30;True|2023-10-01T22:51:08.6752257+03:30;
+ True|2024-10-13T20:04:34.0835797Z;True|2024-10-13T18:27:39.8558013+03:30;True|2024-10-12T00:44:26.5652079+03:30;True|2024-10-11T23:53:14.8559696+03:30;True|2024-10-11T17:11:00.9156676+03:30;True|2024-10-09T18:51:33.2487586+03:30;True|2024-10-09T16:35:08.3302054+03:30;True|2024-10-08T22:10:02.5630063+03:30;True|2024-10-08T00:00:56.5074553+03:30;True|2024-10-05T23:10:54.3638312+03:30;True|2024-10-05T23:09:09.5812574+03:30;True|2024-09-27T16:47:24.7897914+03:30;True|2024-09-21T18:28:27.9893363+03:30;True|2024-06-18T17:01:39.6706828+03:30;True|2024-06-17T15:23:15.9045486+03:30;True|2024-06-16T19:20:08.5561502+03:30;True|2024-06-16T00:42:57.7703900+03:30;True|2024-06-15T22:29:56.7168556+03:30;True|2024-06-15T21:46:32.2693646+03:30;True|2024-06-15T21:18:20.1541669+03:30;True|2024-06-15T20:46:13.2250937+03:30;True|2024-06-15T17:53:22.3094268+03:30;True|2024-06-15T14:50:40.9456478+03:30;True|2024-06-15T14:49:21.5800057+03:30;True|2024-06-15T03:41:48.8619987+03:30;True|2024-06-14T15:08:39.6933673+03:30;True|2024-06-08T11:30:56.8571060+03:30;True|2024-06-06T17:54:48.5109753+03:30;True|2024-06-06T04:25:08.1488975+03:30;True|2024-06-06T01:26:08.3002810+03:30;True|2024-06-06T00:27:59.5483117+03:30;True|2024-06-02T17:02:42.3530323+03:30;True|2024-06-01T16:26:17.4822224+03:30;True|2024-06-01T15:06:37.4108339+03:30;True|2024-05-28T22:48:06.4803192+03:30;False|2024-05-28T22:46:57.0924933+03:30;True|2024-05-28T20:16:01.8592002+03:30;True|2024-05-18T19:28:49.7981366+03:30;True|2024-05-18T14:23:21.9582614+03:30;True|2024-05-07T17:12:56.7928156+03:30;True|2024-05-07T00:58:16.7488863+03:30;True|2024-05-07T00:45:17.3703620+03:30;True|2024-04-17T14:26:57.2593147+03:30;True|2024-04-16T11:56:39.2878116+03:30;True|2024-04-16T11:34:45.2074277+03:30;True|2024-04-14T23:48:29.1130956+03:30;True|2024-04-14T23:01:48.9303734+03:30;True|2024-04-14T21:40:52.7870328+03:30;True|2024-04-14T11:32:54.7899526+03:30;True|2024-04-13T19:34:37.5496555+03:30;True|2024-04-12T15:17:48.4181603+03:30;True|2024-04-12T13:49:10.4211023+03:30;True|2024-04-09T20:04:42.4503557+03:30;True|2024-04-09T15:57:06.7947364+03:30;True|2024-04-06T23:27:32.0137073+03:30;True|2024-04-05T16:25:10.6909463+03:30;True|2024-04-05T16:04:33.9982315+03:30;True|2024-04-04T11:27:43.0944181+03:30;True|2024-04-03T21:07:40.4309901+03:30;True|2024-04-03T18:41:51.6335233+03:30;True|2024-04-03T18:34:14.3713154+03:30;True|2024-04-03T17:49:59.7276264+03:30;True|2024-04-03T15:23:58.6489096+03:30;True|2024-02-12T16:40:05.5785975+03:30;True|2024-02-04T17:29:35.1950534+03:30;False|2024-02-04T17:15:19.5368282+03:30;False|2024-02-04T17:12:54.4662347+03:30;True|2024-01-24T16:01:35.7945782+03:30;True|2024-01-24T15:59:16.6773364+03:30;True|2024-01-21T21:48:49.8323952+03:30;True|2024-01-21T21:19:56.8670054+03:30;True|2024-01-02T20:47:37.6819460+03:30;True|2024-01-02T20:19:39.7710968+03:30;True|2024-01-02T20:16:41.6607200+03:30;True|2024-01-02T03:26:16.7917104+03:30;True|2024-01-02T03:00:36.9350439+03:30;True|2024-01-02T01:06:06.1702893+03:30;False|2024-01-02T01:03:29.4546421+03:30;True|2024-01-02T00:01:16.5185520+03:30;True|2023-11-26T16:07:09.3460352+03:30;True|2023-11-21T21:09:43.5173885+03:30;True|2023-11-21T21:06:03.9711272+03:30;True|2023-11-20T05:38:35.8888090+03:30;True|2023-11-20T05:26:01.6855162+03:30;True|2023-11-14T21:38:54.6692416+03:30;True|2023-11-10T02:32:23.1549504+03:30;True|2023-11-09T23:34:50.5100590+03:30;True|2023-11-09T22:54:31.5682635+03:30;True|2023-11-09T22:44:44.2203811+03:30;True|2023-11-09T22:21:38.6559608+03:30;True|2023-11-09T02:13:02.5944031+03:30;True|2023-11-09T01:48:41.3367617+03:30;True|2023-11-08T18:16:13.6177667+03:30;True|2023-11-01T16:01:01.7421359+03:30;True|2023-11-01T15:59:01.8859296+03:30;True|2023-11-01T15:56:18.6764972+03:30;True|2023-11-01T15:55:05.5325473+03:30;True|2023-10-27T17:25:04.2115256+03:30;True|2023-10-27T17:24:23.4811886+03:30;True|2023-10-27T17:23:25.4497652+03:30;
\ No newline at end of file
diff --git a/SDCAgnosticServer/Properties/PublishProfiles/X86.pubxml.user b/SDCAgnosticServer/Properties/PublishProfiles/X86.pubxml.user
index ee76618..ada8a33 100644
--- a/SDCAgnosticServer/Properties/PublishProfiles/X86.pubxml.user
+++ b/SDCAgnosticServer/Properties/PublishProfiles/X86.pubxml.user
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
- True|2024-06-18T13:29:33.5447735Z;True|2024-06-17T15:24:16.0366965+03:30;True|2024-06-08T11:32:03.9264343+03:30;True|2024-06-01T16:25:26.8586198+03:30;True|2024-06-01T15:05:44.8053151+03:30;True|2024-05-29T18:52:18.8348149+03:30;True|2024-05-28T20:17:19.1795968+03:30;True|2024-05-18T19:30:38.2457827+03:30;True|2024-05-18T14:25:39.0547579+03:30;True|2024-05-07T17:13:47.5200907+03:30;True|2024-05-07T00:57:21.7022028+03:30;True|2024-05-07T00:46:06.1993941+03:30;True|2024-04-16T11:31:32.6016860+03:30;True|2024-04-14T23:52:00.5708011+03:30;True|2024-04-14T22:58:35.8436531+03:30;True|2024-04-14T21:44:22.1838835+03:30;True|2024-04-14T11:29:44.7271720+03:30;True|2024-04-14T11:13:24.8057882+03:30;True|2024-04-13T19:38:04.5878146+03:30;True|2024-04-12T15:14:29.4050728+03:30;True|2024-04-12T13:53:23.5533498+03:30;True|2024-04-09T20:01:48.5875145+03:30;True|2024-04-09T16:00:34.6986176+03:30;True|2024-04-06T23:24:22.5874235+03:30;True|2024-04-05T16:28:24.4497992+03:30;True|2024-04-05T16:01:02.7600703+03:30;True|2024-04-04T11:31:13.9322653+03:30;True|2024-04-03T18:45:47.4848296+03:30;True|2024-04-03T15:20:58.0069203+03:30;True|2024-02-12T16:41:23.0802164+03:30;True|2024-02-04T17:27:59.2458148+03:30;True|2024-02-04T17:21:26.4393719+03:30;False|2024-02-04T17:18:56.7801447+03:30;False|2024-02-04T17:16:45.9111791+03:30;True|2024-01-21T21:51:52.3687673+03:30;True|2024-01-21T21:18:29.9714920+03:30;True|2024-01-02T20:48:30.5070122+03:30;True|2024-01-02T20:21:06.1897900+03:30;True|2023-11-26T16:08:35.0530973+03:30;
+ True|2024-10-13T20:06:12.5514901Z;True|2024-10-11T17:12:34.7577525+03:30;True|2024-06-18T16:59:33.5447735+03:30;True|2024-06-17T15:24:16.0366965+03:30;True|2024-06-08T11:32:03.9264343+03:30;True|2024-06-01T16:25:26.8586198+03:30;True|2024-06-01T15:05:44.8053151+03:30;True|2024-05-29T18:52:18.8348149+03:30;True|2024-05-28T20:17:19.1795968+03:30;True|2024-05-18T19:30:38.2457827+03:30;True|2024-05-18T14:25:39.0547579+03:30;True|2024-05-07T17:13:47.5200907+03:30;True|2024-05-07T00:57:21.7022028+03:30;True|2024-05-07T00:46:06.1993941+03:30;True|2024-04-16T11:31:32.6016860+03:30;True|2024-04-14T23:52:00.5708011+03:30;True|2024-04-14T22:58:35.8436531+03:30;True|2024-04-14T21:44:22.1838835+03:30;True|2024-04-14T11:29:44.7271720+03:30;True|2024-04-14T11:13:24.8057882+03:30;True|2024-04-13T19:38:04.5878146+03:30;True|2024-04-12T15:14:29.4050728+03:30;True|2024-04-12T13:53:23.5533498+03:30;True|2024-04-09T20:01:48.5875145+03:30;True|2024-04-09T16:00:34.6986176+03:30;True|2024-04-06T23:24:22.5874235+03:30;True|2024-04-05T16:28:24.4497992+03:30;True|2024-04-05T16:01:02.7600703+03:30;True|2024-04-04T11:31:13.9322653+03:30;True|2024-04-03T18:45:47.4848296+03:30;True|2024-04-03T15:20:58.0069203+03:30;True|2024-02-12T16:41:23.0802164+03:30;True|2024-02-04T17:27:59.2458148+03:30;True|2024-02-04T17:21:26.4393719+03:30;False|2024-02-04T17:18:56.7801447+03:30;False|2024-02-04T17:16:45.9111791+03:30;True|2024-01-21T21:51:52.3687673+03:30;True|2024-01-21T21:18:29.9714920+03:30;True|2024-01-02T20:48:30.5070122+03:30;True|2024-01-02T20:21:06.1897900+03:30;True|2023-11-26T16:08:35.0530973+03:30;
\ No newline at end of file
diff --git a/SDCAgnosticServer/SDCAgnosticServer.csproj b/SDCAgnosticServer/SDCAgnosticServer.csproj
index 1634fc2..4433701 100644
--- a/SDCAgnosticServer/SDCAgnosticServer.csproj
+++ b/SDCAgnosticServer/SDCAgnosticServer.csproj
@@ -8,7 +8,7 @@
SecureDNSClientMulti.ico
true
MSMH Multi DNS And Proxy Server
- $(VersionPrefix)3.0.9
+ $(VersionPrefix)3.1.5
MSasanMH
SecureDNSClient.png
A Multi Proxy Server.
diff --git a/SDCAgnosticServer/SDCAgnosticServer.csproj.user b/SDCAgnosticServer/SDCAgnosticServer.csproj.user
index cc440b7..03a7b47 100644
--- a/SDCAgnosticServer/SDCAgnosticServer.csproj.user
+++ b/SDCAgnosticServer/SDCAgnosticServer.csproj.user
@@ -1,6 +1,6 @@
- <_LastSelectedProfileId>D:\PPWin\SecureDNSClient\SDCAgnosticServer\Properties\PublishProfiles\X64.pubxml
+ <_LastSelectedProfileId>D:\PPWin\SecureDNSClient\SDCAgnosticServer\Properties\PublishProfiles\X86.pubxml
\ No newline at end of file
diff --git a/SDCAgnosticServer/Structs.cs b/SDCAgnosticServer/Structs.cs
index e5fa399..2ab9af1 100644
--- a/SDCAgnosticServer/Structs.cs
+++ b/SDCAgnosticServer/Structs.cs
@@ -89,22 +89,9 @@ public readonly struct ChunkMode
}
}
- public readonly struct DnsRules
+ public readonly struct Rules
{
- public static readonly string Name = "DnsRules";
- public readonly struct Mode
- {
- public static readonly string Name = "Mode";
- public static readonly string File = "File";
- public static readonly string Text = "Text";
- public static readonly string Disable = "Disable";
- }
- public static readonly string PathOrText = "PathOrText";
- }
-
- public readonly struct ProxyRules
- {
- public static readonly string Name = "ProxyRules";
+ public static readonly string Name = "Rules";
public readonly struct Mode
{
public static readonly string Name = "Mode";
diff --git a/SDCLookup/Properties/PublishProfiles/X64.pubxml.user b/SDCLookup/Properties/PublishProfiles/X64.pubxml.user
index 7b85d53..a24cefd 100644
--- a/SDCLookup/Properties/PublishProfiles/X64.pubxml.user
+++ b/SDCLookup/Properties/PublishProfiles/X64.pubxml.user
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
- True|2024-06-08T08:03:39.1024703Z;True|2024-05-29T18:54:48.0114354+03:30;True|2024-05-18T19:54:22.4315794+03:30;True|2024-05-07T02:43:29.1873875+03:30;True|2024-05-07T02:33:18.5174786+03:30;True|2024-05-07T02:24:09.7904773+03:30;True|2024-05-07T02:15:52.7168760+03:30;True|2024-05-07T01:02:44.4330440+03:30;True|2024-05-07T00:42:03.1786219+03:30;False|2024-05-07T00:39:42.9965750+03:30;False|2024-05-07T00:01:06.9873870+03:30;
+ True|2024-10-13T20:07:59.5473809Z;True|2024-10-11T17:14:20.1576044+03:30;True|2024-10-09T19:04:13.4551085+03:30;True|2024-06-08T11:33:39.1024703+03:30;True|2024-05-29T18:54:48.0114354+03:30;True|2024-05-18T19:54:22.4315794+03:30;True|2024-05-07T02:43:29.1873875+03:30;True|2024-05-07T02:33:18.5174786+03:30;True|2024-05-07T02:24:09.7904773+03:30;True|2024-05-07T02:15:52.7168760+03:30;True|2024-05-07T01:02:44.4330440+03:30;True|2024-05-07T00:42:03.1786219+03:30;False|2024-05-07T00:39:42.9965750+03:30;False|2024-05-07T00:01:06.9873870+03:30;
\ No newline at end of file
diff --git a/SDCLookup/Properties/PublishProfiles/X86.pubxml.user b/SDCLookup/Properties/PublishProfiles/X86.pubxml.user
index 5986388..5b83df1 100644
--- a/SDCLookup/Properties/PublishProfiles/X86.pubxml.user
+++ b/SDCLookup/Properties/PublishProfiles/X86.pubxml.user
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
- True|2024-06-08T08:04:39.5708748Z;True|2024-05-29T18:56:03.1768257+03:30;True|2024-05-18T19:53:34.4491360+03:30;True|2024-05-07T02:44:19.6120041+03:30;True|2024-05-07T01:01:53.2636875+03:30;True|2024-05-07T00:44:14.4249342+03:30;
+ True|2024-10-13T20:09:19.3995635Z;True|2024-10-11T17:15:46.8651682+03:30;True|2024-06-08T11:34:39.5708748+03:30;True|2024-05-29T18:56:03.1768257+03:30;True|2024-05-18T19:53:34.4491360+03:30;True|2024-05-07T02:44:19.6120041+03:30;True|2024-05-07T01:01:53.2636875+03:30;True|2024-05-07T00:44:14.4249342+03:30;
\ No newline at end of file
diff --git a/SDCLookup/SDCLookup.csproj b/SDCLookup/SDCLookup.csproj
index 086a2de..c8f940a 100644
--- a/SDCLookup/SDCLookup.csproj
+++ b/SDCLookup/SDCLookup.csproj
@@ -8,7 +8,7 @@
true
AnyCPU;x64;x86
SecureDNSClientMulti.ico
- $(VersionPrefix)1.0.7
+ $(VersionPrefix)1.1.0
SDC DNS Lookup
MSasanMH
diff --git a/SecureDNSClient/Forms/Assets.cs b/SecureDNSClient/Forms/Assets.cs
new file mode 100644
index 0000000..b142788
--- /dev/null
+++ b/SecureDNSClient/Forms/Assets.cs
@@ -0,0 +1,209 @@
+using MsmhToolsClass;
+using System.Diagnostics;
+using System.Text;
+
+namespace SecureDNSClient;
+
+public partial class FormMain
+{
+ public async Task<(bool IR_Domains_Done, bool IR_CIDRs_Done, bool IR_ADS_Done)> Assets_Download_Async(int timeoutMs = 8000)
+ {
+ bool autoUpdate = false;
+ int hours = 6;
+
+ bool ir_Domains = false, ir_CIDRs = false, ir_ADS = false;
+ bool ir_Domains_Done = false, ir_CIDRs_Done = false, ir_ADS_Done = false;
+ string ir_Domains_msg = "// IR Domains For SDC - Secure DNS Client";
+ string ir_CIDRs_msg = "// IR CIDRs For SDC - Secure DNS Client";
+ string ir_ADS_msg = "// IR ADS Domains For SDC - Secure DNS Client";
+
+ try
+ {
+ this.InvokeIt(() =>
+ {
+ autoUpdate = CustomCheckBoxGeoAssetUpdate.Checked;
+ hours = Convert.ToInt32(CustomNumericUpDownGeoAssetsUpdate.Value);
+ ir_Domains = CustomCheckBoxGeoAsset_IR_Domains.Checked;
+ ir_CIDRs = CustomCheckBoxGeoAsset_IR_CIDRs.Checked;
+ ir_ADS = CustomCheckBoxGeoAsset_IR_ADS.Checked;
+ });
+
+ TimeSpan hoursTS = new(hours, 0, 0);
+ DateTime now = DateTime.UtcNow;
+
+ try
+ {
+ if (autoUpdate)
+ {
+ FileInfo fi = new(SecureDNS.Asset_IR_Domains);
+ if (fi.Exists && (now - fi.LastWriteTimeUtc) < hoursTS) ir_Domains = false;
+
+ fi = new(SecureDNS.Asset_IR_CIDRs);
+ if (fi.Exists && (now - fi.LastWriteTimeUtc) < hoursTS) ir_CIDRs = false;
+
+ fi = new(SecureDNS.Asset_IR_ADS_Domains);
+ if (fi.Exists && (now - fi.LastWriteTimeUtc) < hoursTS) ir_ADS = false;
+ }
+ }
+ catch (Exception e)
+ {
+ Debug.WriteLine("Assets Assets_Download_Async FileInfo: " + e.Message);
+ }
+
+ bool go = ir_Domains || ir_CIDRs || ir_ADS;
+ if (go)
+ {
+ List releaseURLs = await WebAPI.Github_Latest_Release_Async("msasanmh", "Iran-clash-rules", timeoutMs);
+ foreach (string releaseURL in releaseURLs)
+ {
+ // IR_Domains
+ if (ir_Domains && releaseURL.EndsWith("ir.txt"))
+ {
+ List result = await Assets_Get_From_Clash_Async(releaseURL, timeoutMs).ConfigureAwait(false);
+ if (result.Count > 0)
+ {
+ result.Insert(0, ir_Domains_msg);
+ await result.SaveToFileAsync(SecureDNS.Asset_IR_Domains);
+ ir_Domains_Done = true;
+ }
+ }
+
+ // IR_CIDRs
+ if (ir_CIDRs && releaseURL.EndsWith("ircidr.txt"))
+ {
+ List result = await Assets_Get_From_CIDR_Async(releaseURL, timeoutMs).ConfigureAwait(false);
+ if (result.Count > 0)
+ {
+ result.Insert(0, ir_CIDRs_msg);
+ await result.SaveToFileAsync(SecureDNS.Asset_IR_CIDRs);
+ ir_CIDRs_Done = true;
+ }
+ }
+
+ // IR_ADS
+ if (ir_ADS && releaseURL.EndsWith("ads.txt"))
+ {
+ List result = await Assets_Get_From_Clash_Async(releaseURL, timeoutMs).ConfigureAwait(false);
+ if (result.Count > 0)
+ {
+ result.Insert(0, ir_ADS_msg);
+ await result.SaveToFileAsync(SecureDNS.Asset_IR_ADS_Domains);
+ ir_ADS_Done = true;
+ }
+ }
+ }
+
+ // Mirror: IR_Domains
+ if (ir_Domains && !ir_Domains_Done)
+ {
+ string mirror = "https://raw.githubusercontent.com/msasanmh/SecureDNSClient/refs/heads/main/Assets/IR_Domains.txt";
+ byte[] bytes = await WebAPI.DownloadFileAsync(mirror, timeoutMs).ConfigureAwait(false);
+ if (bytes.Length > 0)
+ {
+ await File.WriteAllBytesAsync(SecureDNS.Asset_IR_Domains, bytes);
+ ir_Domains_Done = true;
+ }
+ }
+
+ // Mirror: IR_CIDRs
+ if (ir_CIDRs && !ir_CIDRs_Done)
+ {
+ string mirror = "https://raw.githubusercontent.com/msasanmh/SecureDNSClient/refs/heads/main/Assets/IR_CIDRs.txt";
+ byte[] bytes = await WebAPI.DownloadFileAsync(mirror, timeoutMs).ConfigureAwait(false);
+ if (bytes.Length > 0)
+ {
+ await File.WriteAllBytesAsync(SecureDNS.Asset_IR_CIDRs, bytes);
+ ir_CIDRs_Done = true;
+ }
+ }
+
+ // Mirror: IR_ADS
+ if (ir_ADS && !ir_ADS_Done)
+ {
+ string mirror = "https://raw.githubusercontent.com/msasanmh/SecureDNSClient/refs/heads/main/Assets/IR_ADS_Domains.txt";
+ byte[] bytes = await WebAPI.DownloadFileAsync(mirror, timeoutMs).ConfigureAwait(false);
+ if (bytes.Length > 0)
+ {
+ await File.WriteAllBytesAsync(SecureDNS.Asset_IR_ADS_Domains, bytes);
+ ir_ADS_Done = true;
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Assets Assets_Download_Async: " + ex.Message);
+ }
+
+ return (ir_Domains_Done, ir_CIDRs_Done, ir_ADS_Done);
+ }
+
+ public static async Task> Assets_Get_From_Clash_Async(string url, int timeoutMs)
+ {
+ List result = new();
+
+ try
+ {
+ byte[] bytes = await WebAPI.DownloadFileAsync(url, timeoutMs).ConfigureAwait(false);
+ if (bytes.Length > 0)
+ {
+ string text = Encoding.UTF8.GetString(bytes);
+ List lines = text.SplitToLines();
+
+ for (int n = 0; n < lines.Count; n++)
+ {
+ string line = lines[n].Trim();
+ if (line.StartsWith('#')) continue;
+ if (line.StartsWith("+."))
+ {
+ line = line.TrimStart("+.");
+ if (line.Contains('.'))
+ {
+ result.Add(line);
+ result.Add($"*.{line}");
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Assets Assets_Get_From_Clash_Async: " + ex.Message);
+ }
+
+ return result;
+ }
+
+ public static async Task> Assets_Get_From_CIDR_Async(string url, int timeoutMs)
+ {
+ List result = new();
+
+ try
+ {
+ byte[] bytes = await WebAPI.DownloadFileAsync(url, timeoutMs).ConfigureAwait(false);
+ if (bytes.Length > 0)
+ {
+ string text = Encoding.UTF8.GetString(bytes);
+ List lines = text.SplitToLines();
+
+ for (int n = 0; n < lines.Count; n++)
+ {
+ string line = lines[n].Trim();
+ if (line.StartsWith("//")) continue;
+ if (line.StartsWith('#')) continue;
+ if (line.Contains('/'))
+ {
+ result.Add(line);
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Assets Assets_Get_From_CIDR_Async: " + ex.Message);
+ }
+
+ return result;
+ }
+
+}
\ No newline at end of file
diff --git a/SecureDNSClient/Forms/Buttons.cs b/SecureDNSClient/Forms/Buttons.cs
index 7c2cfa9..d37442c 100644
--- a/SecureDNSClient/Forms/Buttons.cs
+++ b/SecureDNSClient/Forms/Buttons.cs
@@ -4,9 +4,11 @@
using System.Diagnostics;
using System.Globalization;
using System.IO.Compression;
-using System.Reflection;
+using MaxMind.GeoIP2;
+using MaxMind.GeoIP2.Responses;
+using System.Net;
using System.Text;
-using System.Text.RegularExpressions;
+using System.Security.Cryptography;
namespace SecureDNSClient;
@@ -353,7 +355,7 @@ private async void CustomButtonSetDNS_Click(object sender, EventArgs e)
{
if (IsExiting) return;
if (IsInAction(true, true, true, true, true, true, true, true, true, false, true, out _)) return;
- await SetDNS(GetNicNameSetting(CustomComboBoxNICs).NICs);
+ await SetDnsAsync(GetNicNameSetting(CustomComboBoxNICs).NICs);
// Update NIC Status
await UpdateStatusNicAsync();
@@ -413,7 +415,7 @@ private async void CustomButtonShare_Click(object sender, EventArgs e)
{
if (IsExiting) return;
if (IsInAction(true, true, true, true, true, true, true, true, true, true, true, out _)) return;
- await StartProxy();
+ await StartProxyAsync();
}
private async void CustomButtonSetProxy_Click(object sender, EventArgs e)
@@ -428,7 +430,7 @@ private async void CustomButtonPDpiApplyChanges_Click(object sender, EventArgs e
if (IsExiting) return;
this.InvokeIt(() => CustomButtonPDpiApplyChanges.Text = "Applying");
UpdateProxyBools = false;
- await ApplyProxyDpiChanges();
+ await ApplyProxyDpiChangesAsync();
UpdateProxyBools = true;
await UpdateBoolProxyAsync();
@@ -672,25 +674,12 @@ private void CustomButtonSettingQcStartup_Click(object sender, EventArgs e)
}
}
- // Settings -> Connect
- private void CustomButtonSettingDnsRules_Click(object sender, EventArgs e)
+ // Settings -> Rules
+ private void CustomButtonSettingRules_Click(object sender, EventArgs e)
{
if (IsExiting) return;
- FileDirectory.CreateEmptyFile(SecureDNS.DnsRulesPath);
- int notepad = ProcessManager.ExecuteOnly("notepad", null, SecureDNS.DnsRulesPath, false, false, SecureDNS.CurrentPath);
- if (notepad == -1)
- {
- string msg = "Notepad is not installed on your system.";
- CustomRichTextBoxLog.AppendText(msg + NL, Color.IndianRed);
- }
- }
-
- // Settings -> Share -> Advanced
- private void CustomButtonSettingProxyRules_Click(object sender, EventArgs e)
- {
- if (IsExiting) return;
- FileDirectory.CreateEmptyFile(SecureDNS.ProxyRulesPath);
- int notepad = ProcessManager.ExecuteOnly("notepad", null, SecureDNS.ProxyRulesPath, false, false, SecureDNS.CurrentPath);
+ FileDirectory.CreateEmptyFile(SecureDNS.RulesPath);
+ int notepad = ProcessManager.ExecuteOnly("notepad", null, SecureDNS.RulesPath, false, false, SecureDNS.CurrentPath);
if (notepad == -1)
{
string msg = "Notepad is not installed on your system.";
diff --git a/SecureDNSClient/Forms/Certificate.cs b/SecureDNSClient/Forms/Certificate.cs
index 5472142..8ebffa4 100644
--- a/SecureDNSClient/Forms/Certificate.cs
+++ b/SecureDNSClient/Forms/Certificate.cs
@@ -59,7 +59,7 @@ await Task.Run(async () =>
if (IsProxyActivated && IsProxySSLDecryptionActive)
{
// Stop Proxy
- await StartProxy(true);
+ await StartProxyAsync(true);
string msg = "Due To Certificate Changes You Need To Restart Proxy Server.";
CustomMessageBox.Show(this, msg, "Certificate Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
diff --git a/SecureDNSClient/Forms/Connect.cs b/SecureDNSClient/Forms/Connect.cs
index b8c12cc..4790e3f 100644
--- a/SecureDNSClient/Forms/Connect.cs
+++ b/SecureDNSClient/Forms/Connect.cs
@@ -1,5 +1,6 @@
using CustomControls;
using MsmhToolsClass;
+using System.Diagnostics;
using System.Net;
using System.ServiceProcess;
@@ -29,7 +30,11 @@ private async Task StartConnect(ConnectMode connectMode, bool reconnect =
{
// Connect
// Check Internet Connectivity
- if (!IsInternetOnline) return false;
+ if (!IsInternetOnline)
+ {
+ this.InvokeIt(() => CustomButtonConnect.Enabled = true);
+ return false;
+ }
if (IsConnecting) return false;
IsConnecting = true;
@@ -438,4 +443,62 @@ void connectMessage(bool writeToLog = true)
}
}
}
+
+ public async Task ApplyRulesToDnsAsync(string? preRules)
+ {
+ try
+ {
+ List rulesList = new();
+
+ // Add Pre-Rules
+ if (!string.IsNullOrEmpty(preRules))
+ {
+ List preRulesList = preRules.SplitToLines();
+ if (preRulesList.Count > 0) rulesList.AddRange(preRulesList);
+ }
+
+ bool customRules = false;
+ bool ir_ADS = false;
+
+ this.InvokeIt(() =>
+ {
+ customRules = CustomCheckBoxSettingEnableRules.Checked;
+ ir_ADS = CustomCheckBoxGeoAsset_IR_ADS.Checked;
+ });
+
+ if (customRules && File.Exists(SecureDNS.RulesPath))
+ {
+ List customRulesList = new();
+ await customRulesList.LoadFromFileAsync(SecureDNS.RulesPath, true, true);
+ if (customRulesList.Count > 0) rulesList.AddRange(customRulesList);
+ }
+
+ // IR ADS Domains: Block
+ if (ir_ADS && File.Exists(SecureDNS.Asset_IR_ADS_Domains))
+ {
+ string rule = $"{SecureDNS.Asset_IR_ADS_Domains}|-;";
+ rulesList.Add(rule);
+ }
+
+ if (rulesList.Count > 0)
+ {
+ // Save To Temp File
+ await rulesList.SaveToFileAsync(SecureDNS.Rules_Assets_DNS);
+
+ // Send Command
+ string command = $"Programs Rules -Mode=File -PathOrText=\"{SecureDNS.Rules_Assets_DNS}\"";
+ Debug.WriteLine(command);
+ bool success = await DnsConsole.SendCommandAsync(command, 50, 30, "Confirmed: Rules");
+ return success;
+ }
+
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("ShareViaProxy ApplyRulesToDnsAsync: " + ex.Message);
+ return false;
+ }
+ }
+
}
\ No newline at end of file
diff --git a/SecureDNSClient/Forms/ConnectToFPUsingGoodbyeDPI.cs b/SecureDNSClient/Forms/ConnectToFPUsingGoodbyeDPI.cs
index a4719f9..f09f496 100644
--- a/SecureDNSClient/Forms/ConnectToFPUsingGoodbyeDPI.cs
+++ b/SecureDNSClient/Forms/ConnectToFPUsingGoodbyeDPI.cs
@@ -20,7 +20,7 @@ public async Task ConnectToFakeProxyDohUsingGoodbyeDPIAsync()
// Get DoH Clean IP
string dohCleanIP = CustomTextBoxSettingFakeProxyDohCleanIP.Text.Trim();
- bool isValid = NetworkTool.IsIPv4Valid(dohCleanIP, out IPAddress? _);
+ bool isValid = NetworkTool.IsIP(dohCleanIP, out IPAddress? _);
if (!isValid)
{
string msg = $"Fake Proxy Clean IP Is Not Valid, Check Settings.{NL}";
@@ -38,21 +38,11 @@ public async Task ConnectToFakeProxyDohUsingGoodbyeDPIAsync()
// Get Insecure
bool insecure = CustomCheckBoxInsecure.Checked;
- // Get Cloudflare Clean IPv4
- string cfCleanIPv4 = GetCfCleanIpSetting();
+ // Get Cloudflare Clean IP
+ string cfCleanIP = GetCfCleanIpSetting();
- // Set DnsRules Content
- string dnsRulesContent = $"{dohHost}|{dohCleanIP};";
- if (CustomCheckBoxSettingDnsEnableRules.Checked)
- {
- try
- {
- string userDnsRules = await File.ReadAllTextAsync(SecureDNS.DnsRulesPath);
- userDnsRules = userDnsRules.ReplaceLineEndings("\\n");
- dnsRulesContent += $"\\n{userDnsRules}";
- }
- catch (Exception) { }
- }
+ // Set Rules Content
+ string rulesContent = $"{dohHost}|{dohCleanIP};";
// Kill GoodbyeDPI If It's Already Running
await ProcessManager.KillProcessByPidAsync(PIDGoodbyeDPIBypass);
@@ -95,6 +85,7 @@ public async Task ConnectToFakeProxyDohUsingGoodbyeDPIAsync()
// Kill DnsServer If It's Already Running
await ProcessManager.KillProcessByPidAsync(PIDDnsServer);
bool isCmdSent = false;
+ int consoleDelayMs = 50, consoleTimeoutSec = 15;
PIDDnsServer = DnsConsole.Execute(SecureDNS.AgnosticServerPath, null, true, true, SecureDNS.CurrentPath, GetCPUPriority());
await Task.Delay(50);
@@ -123,19 +114,18 @@ public async Task ConnectToFakeProxyDohUsingGoodbyeDPIAsync()
// Send DNS Profile
string command = "Profile BypassWithGoodbyeDPI_DNS";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: Profile");
if (!isCmdSent) return false;
// Send DNS Settings
command = $"Setting -Port={dnsPort} -WorkingMode=Dns -MaxRequests=1000000 -DnsTimeoutSec=10 -KillOnCpuUsage=40";
- command += $" -AllowInsecure={insecure} -DNSs={dohUrl} -CfCleanIP={cfCleanIPv4}";
+ command += $" -AllowInsecure={insecure} -DNSs={dohUrl} -CfCleanIP={cfCleanIP}";
command += $" -BootstrapIp={IPAddress.Loopback} -BootstrapPort={dnsPort}";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: Setting");
if (!isCmdSent) return false;
// Send DNS Rules Command
- command = $"Programs DnsRules -Mode=Text -PathOrText=\"{dnsRulesContent}\"";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await ApplyRulesToDnsAsync(rulesContent);
if (!isCmdSent) return false;
// DoH Server
@@ -151,56 +141,38 @@ public async Task ConnectToFakeProxyDohUsingGoodbyeDPIAsync()
// Send DoH Profile
command = "Profile BypassWithGoodbyeDPI_DoH";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: Profile");
if (!isCmdSent) return false;
// Send DoH Settings
command = $"Setting -Port={dohPort} -WorkingMode=Dns -MaxRequests=1000000 -DnsTimeoutSec=10 -KillOnCpuUsage=40";
command += $" -AllowInsecure={insecure} -DNSs=udp://{IPAddress.Loopback}:{dnsPort}";
command += $" -BootstrapIp={IPAddress.Loopback} -BootstrapPort={dnsPort}";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: Setting");
if (!isCmdSent) return false;
// Send SSL Settings
command = $"SSLSetting -Enable=True -RootCA_Path=\"{SecureDNS.IssuerCertPath}\" -RootCA_KeyPath=\"{SecureDNS.IssuerKeyPath}\" -Cert_Path=\"{SecureDNS.CertPath}\" -Cert_KeyPath=\"{SecureDNS.KeyPath}\"";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: SSLSetting");
if (!isCmdSent) return false;
}
}
// Send Write Requests To Log
- isCmdSent = await DnsConsole.SendCommandAsync("Requests True");
+ isCmdSent = await DnsConsole.SendCommandAsync("Requests True", consoleDelayMs, consoleTimeoutSec, "Confirmed: Requests True");
if (!isCmdSent) return false;
// Send Parent Process Command
command = $"ParentProcess -PID={Environment.ProcessId}";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: ParentProcess");
if (!isCmdSent) return false;
// Send Start Command
- isCmdSent = await DnsConsole.SendCommandAsync("Start");
+ isCmdSent = await DnsConsole.SendCommandAsync("Start", consoleDelayMs, 30, "Confirmed: Start");
if (!isCmdSent) return false;
- // Wait For Confirm Msg
- bool confirmed = false;
- Task wait2 = Task.Run(async () =>
- {
- while (true)
- {
- if (IsDisconnecting) break;
- if (!ProcessManager.FindProcessByPID(PIDDnsServer)) break;
- if (DnsConsole.GetStdoutBag.Contains("Confirmed"))
- {
- confirmed = true;
- break;
- }
- await Task.Delay(25);
- }
- });
- try { await wait2.WaitAsync(TimeSpan.FromSeconds(30)); } catch (Exception) { }
-
GetBlockedDomainSetting(out string blockedDomainNoWww);
- if (IsConnected && confirmed)
+ if (IsConnected)
{
string msgSuccess = $"DNS Server Executed.{NL}Bypassing...{NL}";
this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgSuccess, Color.MediumSeaGreen));
@@ -240,9 +212,9 @@ public async Task ConnectToFakeProxyDohUsingGoodbyeDPIAsync()
}
}
- string msgFailed = "Error: Couldn't Start DNS Server!";
- if (!confirmed) msgFailed = "Couldn't Get Confirm Message From Console.";
- else if (ProcessManager.FindProcessByPID(PIDDnsServer) && !IsDNSConnected)
+ string msgFailed = "Couldn't Get Confirm Message From Console.";
+ if (!ProcessManager.FindProcessByPID(PIDDnsServer)) msgFailed = "Error: Couldn't Start DNS Server!";
+ else if (!IsDNSConnected && ProcessManager.FindProcessByPID(PIDDnsServer))
msgFailed = $"DNS Can't Get Online (Check Domain: {blockedDomainNoWww}). Bypass Failed.";
if (IsDisconnecting) msgFailed = "Task Canceled.";
this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgFailed + NL, Color.IndianRed));
diff --git a/SecureDNSClient/Forms/ConnectToFPUsingProxyDPI.cs b/SecureDNSClient/Forms/ConnectToFPUsingProxyDPI.cs
index e280b6e..99ee2c0 100644
--- a/SecureDNSClient/Forms/ConnectToFPUsingProxyDPI.cs
+++ b/SecureDNSClient/Forms/ConnectToFPUsingProxyDPI.cs
@@ -18,7 +18,7 @@ public async Task ConnectToFakeProxyDohUsingProxyDPIAsync()
// Get DoH Clean IP
string dohCleanIP = CustomTextBoxSettingFakeProxyDohCleanIP.Text.Trim();
- bool isValid = NetworkTool.IsIPv4Valid(dohCleanIP, out IPAddress? _);
+ bool isValid = NetworkTool.IsIP(dohCleanIP, out IPAddress? _);
if (!isValid)
{
string msg = $"Fake Proxy Clean IP Is Not Valid, Check Settings.{NL}";
@@ -36,8 +36,8 @@ public async Task ConnectToFakeProxyDohUsingProxyDPIAsync()
// Get Insecure
bool insecure = CustomCheckBoxInsecure.Checked;
- // Get Cloudflare Clean IPv4
- string cfCleanIPv4 = GetCfCleanIpSetting();
+ // Get Cloudflare Clean IP
+ string cfCleanIP = GetCfCleanIpSetting();
// Get Fragment Settings
int beforSniChunks = Convert.ToInt32(CustomNumericUpDownPDpiBeforeSniChunks.Value);
@@ -55,24 +55,11 @@ public async Task ConnectToFakeProxyDohUsingProxyDPIAsync()
int antiPatternOffset = Convert.ToInt32(CustomNumericUpDownPDpiAntiPatternOffset.Value);
int fragmentDelay = Convert.ToInt32(CustomNumericUpDownPDpiFragDelay.Value);
- // Set DnsRules Content
- string dnsRulesContent = $"{dohHost}|{dohCleanIP};";
- if (CustomCheckBoxSettingDnsEnableRules.Checked)
- {
- try
- {
- string userDnsRules = await File.ReadAllTextAsync(SecureDNS.DnsRulesPath);
- userDnsRules = userDnsRules.ReplaceLineEndings("\\n");
- dnsRulesContent += $"\\n{userDnsRules}";
- }
- catch (Exception) { }
- }
-
- // Set ProxyRules Content (Apply Fake DNS and White List Program)
- string proxyRulesContent = $"{dohHost}|{dohCleanIP};";
- proxyRulesContent += $"\\n{dohCleanIP}|+;";
- proxyRulesContent += $"\\n{IPAddress.Loopback}|-;"; // Block Loopback IPv4
- proxyRulesContent += $"\\n{IPAddress.IPv6Loopback}|-;"; // Block Loopback IPv6
+ // Set Rules Content
+ string rulesContent = $"{dohHost}|{dohCleanIP};";
+ rulesContent += $"{NL}{dohCleanIP}|+;";
+ rulesContent += $"{NL}{IPAddress.Loopback}|-;"; // Block Loopback IPv4
+ rulesContent += $"{NL}{IPAddress.IPv6Loopback}|-;"; // Block Loopback IPv6
string host1 = "dns.cloudflare.com";
string host2 = "cloudflare-dns.com";
@@ -80,17 +67,18 @@ public async Task ConnectToFakeProxyDohUsingProxyDPIAsync()
if (dohHost.Equals(host1) || dohHost.Equals(host2) || dohHost.Equals(host3))
{
- proxyRulesContent = $"{host1}|{dohCleanIP};";
- proxyRulesContent += $"\\n{host2}|{dohCleanIP};";
- proxyRulesContent += $"\\n{host3}|{dohCleanIP};";
- proxyRulesContent += $"\\n{dohCleanIP}|+;";
- proxyRulesContent += $"\\n{IPAddress.Loopback}|-;"; // Block Loopback IPv4
- proxyRulesContent += $"\\n{IPAddress.IPv6Loopback}|-;"; // Block Loopback IPv6
+ rulesContent = $"{host1}|{dohCleanIP};";
+ rulesContent += $"{NL}{host2}|{dohCleanIP};";
+ rulesContent += $"{NL}{host3}|{dohCleanIP};";
+ rulesContent += $"{NL}{dohCleanIP}|+;";
+ rulesContent += $"{NL}{IPAddress.Loopback}|-;"; // Block Loopback IPv4
+ rulesContent += $"{NL}{IPAddress.IPv6Loopback}|-;"; // Block Loopback IPv6
}
// Kill If It's Already Running
await ProcessManager.KillProcessByPidAsync(PIDDnsServer);
bool isCmdSent = false;
+ int consoleDelayMs = 50, consoleTimeoutSec = 15;
PIDDnsServer = DnsConsole.Execute(SecureDNS.AgnosticServerPath, null, true, true, SecureDNS.CurrentPath, GetCPUPriority());
await Task.Delay(50);
@@ -119,30 +107,24 @@ public async Task ConnectToFakeProxyDohUsingProxyDPIAsync()
// Send DNS Profile
string command = "Profile BypassWithProxy_DNS";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: Profile");
if (!isCmdSent) return false;
// Send DNS Settings
command = $"Setting -Port={dnsPort} -WorkingMode=DnsAndProxy -MaxRequests=1000000 -DnsTimeoutSec=10 -ProxyTimeoutSec=40 -KillOnCpuUsage=40 -BlockPort80=True";
- command += $" -AllowInsecure={insecure} -DNSs={dohUrl} -CfCleanIP={cfCleanIPv4}";
+ command += $" -AllowInsecure={insecure} -DNSs={dohUrl} -CfCleanIP={cfCleanIP}";
command += $" -BootstrapIp={IPAddress.Loopback} -BootstrapPort={dnsPort}";
command += $" -ProxyScheme=socks5://{IPAddress.Loopback}:{dnsPort}";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: Setting");
if (!isCmdSent) return false;
// Send Fragment Command
command = $"Programs Fragment -Mode=Program -BeforeSniChunks={beforSniChunks} -ChunkMode={chunkMode} -SniChunks={sniChunks} -AntiPatternOffset={antiPatternOffset} -FragmentDelay={fragmentDelay}";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
- if (!isCmdSent) return false;
-
- // Send DNS Rules Command
- command = $"Programs DnsRules -Mode=Text -PathOrText=\"{dnsRulesContent}\"";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: Fragment");
if (!isCmdSent) return false;
- // Send Proxy Rules Command
- command = $"Programs ProxyRules -Mode=Text -PathOrText=\"{proxyRulesContent}\"";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ // Send Rules Command
+ isCmdSent = await ApplyRulesToDnsAsync(rulesContent);
if (!isCmdSent) return false;
// DoH Server
@@ -158,56 +140,38 @@ public async Task ConnectToFakeProxyDohUsingProxyDPIAsync()
// Send DoH Profile
command = "Profile BypassWithProxy_DoH";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: Profile");
if (!isCmdSent) return false;
// Send DoH Settings
command = $"Setting -Port={dohPort} -WorkingMode=Dns -MaxRequests=1000000 -DnsTimeoutSec=10 -KillOnCpuUsage=40";
command += $" -AllowInsecure={insecure} -DNSs=udp://{IPAddress.Loopback}:{dnsPort}";
command += $" -BootstrapIp={IPAddress.Loopback} -BootstrapPort={dnsPort}";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: Setting");
if (!isCmdSent) return false;
// Send SSL Settings
command = $"SSLSetting -Enable=True -RootCA_Path=\"{SecureDNS.IssuerCertPath}\" -RootCA_KeyPath=\"{SecureDNS.IssuerKeyPath}\" -Cert_Path=\"{SecureDNS.CertPath}\" -Cert_KeyPath=\"{SecureDNS.KeyPath}\"";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: SSLSetting");
if (!isCmdSent) return false;
}
}
// Send Write Requests To Log
- isCmdSent = await DnsConsole.SendCommandAsync("Requests True");
+ isCmdSent = await DnsConsole.SendCommandAsync("Requests True", consoleDelayMs, consoleTimeoutSec, "Confirmed: Requests True");
if (!isCmdSent) return false;
// Send Parent Process Command
command = $"ParentProcess -PID={Environment.ProcessId}";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: ParentProcess");
if (!isCmdSent) return false;
// Send Start Command
- isCmdSent = await DnsConsole.SendCommandAsync("Start");
+ isCmdSent = await DnsConsole.SendCommandAsync("Start", consoleDelayMs, 30, "Confirmed: Start");
if (!isCmdSent) return false;
- // Wait For Confirm Msg
- bool confirmed = false;
- Task wait2 = Task.Run(async () =>
- {
- while (true)
- {
- if (IsDisconnecting) break;
- if (!ProcessManager.FindProcessByPID(PIDDnsServer)) break;
- if (DnsConsole.GetStdoutBag.Contains("Confirmed"))
- {
- confirmed = true;
- break;
- }
- await Task.Delay(25);
- }
- });
- try { await wait2.WaitAsync(TimeSpan.FromSeconds(30)); } catch (Exception) { }
-
GetBlockedDomainSetting(out string blockedDomainNoWww);
- if (IsConnected && confirmed)
+ if (IsConnected)
{
string msgSuccess = $"DNS Server Executed.{NL}Bypassing...{NL}";
this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgSuccess, Color.MediumSeaGreen));
@@ -246,9 +210,9 @@ public async Task ConnectToFakeProxyDohUsingProxyDPIAsync()
}
}
- string msgFailed = "Error: Couldn't Start DNS Server!";
- if (!confirmed) msgFailed = "Couldn't Get Confirm Message From Console.";
- else if (ProcessManager.FindProcessByPID(PIDDnsServer) && !IsDNSConnected)
+ string msgFailed = "Couldn't Get Confirm Message From Console.";
+ if (!ProcessManager.FindProcessByPID(PIDDnsServer)) msgFailed = "Error: Couldn't Start DNS Server!";
+ else if (!IsDNSConnected && ProcessManager.FindProcessByPID(PIDDnsServer))
msgFailed = $"DNS Can't Get Online (Check Domain: {blockedDomainNoWww}). Bypass Failed.";
if (IsDisconnecting) msgFailed = "Task Canceled.";
this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgFailed + NL, Color.IndianRed));
diff --git a/SecureDNSClient/Forms/ConnectToServersUsingProxy.cs b/SecureDNSClient/Forms/ConnectToServersUsingProxy.cs
index d2d8d18..dbb9b1d 100644
--- a/SecureDNSClient/Forms/ConnectToServersUsingProxy.cs
+++ b/SecureDNSClient/Forms/ConnectToServersUsingProxy.cs
@@ -21,16 +21,16 @@ private async Task ConnectToServersUsingProxy()
NetworkTool.GetUrlDetails(proxyScheme, 0, out _, out string host, out _, out _, out int port, out string _, out bool _);
// Check if proxy works
- string sampleRequest = "https://dns.google/dns-query?dns=AAABAAABAAAAAAABCGdvb2dsZQNjb20AAAEAAQ";
+ string sampleRequest = $"https://{GetBlockedDomainSetting(out _)}";
string headers = await NetworkTool.GetHeadersAsync(sampleRequest, null, 5000, false, proxyScheme);
- string[] header = headers.Split(NL, StringSplitOptions.RemoveEmptyEntries);
- if (header.Length > 0) headers = header[0];
- Color statusColor = headers.Contains("OK") ? Color.MediumSeaGreen : Color.IndianRed;
+ string[] headersSplit = headers.Split(NL, StringSplitOptions.RemoveEmptyEntries);
+ if (headersSplit.Length > 0) headers = headersSplit[0];
+ Color statusColor = !headers.Contains("RequestTimeout") ? Color.MediumSeaGreen : Color.IndianRed;
if (!string.IsNullOrEmpty(headers))
this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"Proxy Status: {headers}{NL}", statusColor));
if (statusColor.Equals(Color.IndianRed))
{
- string msgProxy = $"Your Upstream Proxy Doesn't Work.";
+ string msgProxy = $"Your Upstream Proxy Doesn't Work. Couldn't Open {sampleRequest}";
this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgProxy + NL, Color.IndianRed));
return false;
}
@@ -44,8 +44,8 @@ private async Task ConnectToServersUsingProxy()
// Get Insecure
bool insecure = CustomCheckBoxInsecure.Checked;
- // Get Cloudflare Clean IPv4
- string cfCleanIPv4 = GetCfCleanIpSetting();
+ // Get Cloudflare Clean IP
+ string cfCleanIP = GetCfCleanIpSetting();
// Get Bootstrap IP & Port
string bootstrapIP = GetBootstrapSetting(out int bootstrapPort).ToString();
@@ -53,6 +53,7 @@ private async Task ConnectToServersUsingProxy()
// Kill DnsServer If It's Already Running
await ProcessManager.KillProcessByPidAsync(PIDDnsServer);
bool isCmdSent = false;
+ int consoleDelayMs = 50, consoleTimeoutSec = 15;
PIDDnsServer = DnsConsole.Execute(SecureDNS.AgnosticServerPath, null, true, true, SecureDNS.CurrentPath, GetCPUPriority());
await Task.Delay(50);
@@ -81,24 +82,20 @@ private async Task ConnectToServersUsingProxy()
// Send DNS Profile
string command = "Profile UpstreamProxy_DNS";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: Profile");
if (!isCmdSent) return false;
// Send DNS Settings
command = $"Setting -Port={dnsPort} -WorkingMode=Dns -MaxRequests=1000000 -DnsTimeoutSec=10 -KillOnCpuUsage=40";
- command += $" -AllowInsecure={insecure} -DNSs={dnss} -CfCleanIP={cfCleanIPv4}";
+ command += $" -AllowInsecure={insecure} -DNSs={dnss} -CfCleanIP={cfCleanIP}";
command += $" -BootstrapIp={bootstrapIP} -BootstrapPort={bootstrapPort}";
command += $" -ProxyScheme={proxyScheme}";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: Setting");
if (!isCmdSent) return false;
- // Send DNS Rules
- if (CustomCheckBoxSettingDnsEnableRules.Checked)
- {
- string dnsRulesCmd = $"Programs DnsRules -Mode=File -PathOrText=\"{SecureDNS.DnsRulesPath}\"";
- isCmdSent = await DnsConsole.SendCommandAsync(dnsRulesCmd);
- if (!isCmdSent) return false;
- }
+ // Send Rules
+ isCmdSent = await ApplyRulesToDnsAsync(null);
+ if (!isCmdSent) return false;
// DoH Server
if (CustomRadioButtonSettingWorkingModeDNSandDoH.Checked)
@@ -113,65 +110,43 @@ private async Task ConnectToServersUsingProxy()
// Send DoH Profile
command = "Profile UpstreamProxy_DoH";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: Profile");
if (!isCmdSent) return false;
// Send DoH Settings
command = $"Setting -Port={dohPort} -WorkingMode=Dns -MaxRequests=1000000 -DnsTimeoutSec=10 -KillOnCpuUsage=40";
- command += $" -AllowInsecure={insecure} -DNSs={dnss} -CfCleanIP={cfCleanIPv4}";
+ command += $" -AllowInsecure={insecure} -DNSs={dnss} -CfCleanIP={cfCleanIP}";
command += $" -BootstrapIp={bootstrapIP} -BootstrapPort={bootstrapPort}";
command += $" -ProxyScheme={proxyScheme}";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: Setting");
if (!isCmdSent) return false;
// Send SSL Settings
command = $"SSLSetting -Enable=True -RootCA_Path=\"{SecureDNS.IssuerCertPath}\" -RootCA_KeyPath=\"{SecureDNS.IssuerKeyPath}\" -Cert_Path=\"{SecureDNS.CertPath}\" -Cert_KeyPath=\"{SecureDNS.KeyPath}\"";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: SSLSetting");
if (!isCmdSent) return false;
// Send DNS Rules
- if (CustomCheckBoxSettingDnsEnableRules.Checked)
- {
- string dnsRulesCmd = $"Programs DnsRules -Mode=File -PathOrText=\"{SecureDNS.DnsRulesPath}\"";
- isCmdSent = await DnsConsole.SendCommandAsync(dnsRulesCmd);
- if (!isCmdSent) return false;
- }
+ isCmdSent = await ApplyRulesToDnsAsync(null);
+ if (!isCmdSent) return false;
}
}
// Send Write Requests To Log
- isCmdSent = await DnsConsole.SendCommandAsync("Requests True");
+ isCmdSent = await DnsConsole.SendCommandAsync("Requests True", consoleDelayMs, consoleTimeoutSec, "Confirmed: Requests True");
if (!isCmdSent) return false;
// Send Parent Process Command
command = $"ParentProcess -PID={Environment.ProcessId}";
- isCmdSent = await DnsConsole.SendCommandAsync(command);
+ isCmdSent = await DnsConsole.SendCommandAsync(command, consoleDelayMs, consoleTimeoutSec, "Confirmed: ParentProcess");
if (!isCmdSent) return false;
// Send Start Command
- isCmdSent = await DnsConsole.SendCommandAsync("Start");
+ isCmdSent = await DnsConsole.SendCommandAsync("Start", consoleDelayMs, 30, "Confirmed: Start");
if (!isCmdSent) return false;
- // Wait For Confirm Msg
- bool confirmed = false;
- Task wait2 = Task.Run(async () =>
- {
- while (true)
- {
- if (IsDisconnecting) break;
- if (!ProcessManager.FindProcessByPID(PIDDnsServer)) break;
- if (DnsConsole.GetStdoutBag.Contains("Confirmed"))
- {
- confirmed = true;
- break;
- }
- await Task.Delay(25);
- }
- });
- try { await wait2.WaitAsync(TimeSpan.FromSeconds(30)); } catch (Exception) { }
-
GetBlockedDomainSetting(out string blockedDomainNoWww);
- if (IsConnected && confirmed)
+ if (IsConnected)
{
string msgSuccess = $"DNS Server Executed.{NL}Waiting For DNS To Get Online...{NL}";
this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgSuccess, Color.MediumSeaGreen));
@@ -210,9 +185,9 @@ private async Task ConnectToServersUsingProxy()
}
}
- string msgFailed = "Error: Couldn't Start DNS Server!";
- if (!confirmed) msgFailed = "Couldn't Get Confirm Message From Console.";
- else if (ProcessManager.FindProcessByPID(PIDDnsServer) && !IsDNSConnected)
+ string msgFailed = "Couldn't Get Confirm Message From Console.";
+ if (!ProcessManager.FindProcessByPID(PIDDnsServer)) msgFailed = "Error: Couldn't Start DNS Server!";
+ else if (!IsDNSConnected && ProcessManager.FindProcessByPID(PIDDnsServer))
msgFailed = $"DNS Can't Get Online (Check Domain: {blockedDomainNoWww}).";
if (IsDisconnecting) msgFailed = "Task Canceled.";
this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgFailed + NL, Color.IndianRed));
diff --git a/SecureDNSClient/Forms/ConnectToWorkingServers.cs b/SecureDNSClient/Forms/ConnectToWorkingServers.cs
index 4d511fa..4c31c01 100644
--- a/SecureDNSClient/Forms/ConnectToWorkingServers.cs
+++ b/SecureDNSClient/Forms/ConnectToWorkingServers.cs
@@ -73,8 +73,8 @@ private async Task NormalConnectAsync(string dnss, int numberOfUsingServer
// Get Insecure
bool insecure = CustomCheckBoxInsecure.Checked;
- // Get Cloudflare Clean IPv4
- string cfCleanIPv4 = GetCfCleanIpSetting();
+ // Get Cloudflare Clean IP
+ string cfCleanIP = GetCfCleanIpSetting();
// Get Bootstrap IP & Port
string bootstrapIP = GetBootstrapSetting(out int bootstrapPort).ToString();
@@ -82,11 +82,12 @@ private async Task NormalConnectAsync(string dnss, int numberOfUsingServer
// Kill If It's Already Running
await ProcessManager.KillProcessByPidAsync(PIDDnsServer);
bool isCmdSent = false;
+ int consoleDelayMs = 50, consoleTimeoutSec = 15;
PIDDnsServer = DnsConsole.Execute(SecureDNS.AgnosticServerPath, null, true, true, SecureDNS.CurrentPath, GetCPUPriority());
await Task.Delay(50);
// Wait For DNS Server
- Task wait1 = Task.Run(async () =>
+ Task wait = Task.Run(async () =>
{
while (true)
{
@@ -95,7 +96,7 @@ private async Task NormalConnectAsync(string dnss, int numberOfUsingServer
await Task.Delay(50);
}
});
- try { await wait1.WaitAsync(TimeSpan.FromSeconds(5)); } catch (Exception) { }
+ try { await wait.WaitAsync(TimeSpan.FromSeconds(5)); } catch (Exception) { }
if (!ProcessManager.FindProcessByPID(PIDDnsServer))
{
@@ -109,23 +110,19 @@ private async Task NormalConnectAsync(string dnss, int numberOfUsingServer
IsConnected = true;
// Send Set Profile
- isCmdSent = await DnsConsole.SendCommandAsync("Profile DNS");
+ isCmdSent = await DnsConsole.SendCommandAsync("Profile DNS", consoleDelayMs, consoleTimeoutSec, "Confirmed: Profile");
if (!isCmdSent) return false;
// Send DNS Settings
string dnsSettingsCmd = $"Setting -Port={dnsPort} -WorkingMode=Dns -MaxRequests=1000000 -DnsTimeoutSec=10 -KillOnCpuUsage=40";
- dnsSettingsCmd += $" -AllowInsecure={insecure} -DNSs={dnss} -CfCleanIP={cfCleanIPv4}";
+ dnsSettingsCmd += $" -AllowInsecure={insecure} -DNSs={dnss} -CfCleanIP={cfCleanIP}";
dnsSettingsCmd += $" -BootstrapIp={bootstrapIP} -BootstrapPort={bootstrapPort}";
- isCmdSent = await DnsConsole.SendCommandAsync(dnsSettingsCmd);
+ isCmdSent = await DnsConsole.SendCommandAsync(dnsSettingsCmd, consoleDelayMs, consoleTimeoutSec, "Confirmed: Setting");
if (!isCmdSent) return false;
- // Send DNS Rules
- if (CustomCheckBoxSettingDnsEnableRules.Checked)
- {
- string dnsRulesCmd = $"Programs DnsRules -Mode=File -PathOrText=\"{SecureDNS.DnsRulesPath}\"";
- isCmdSent = await DnsConsole.SendCommandAsync(dnsRulesCmd);
- if (!isCmdSent) return false;
- }
+ // Send Rules
+ isCmdSent = await ApplyRulesToDnsAsync(null);
+ if (!isCmdSent) return false;
// DoH Server
if (CustomRadioButtonSettingWorkingModeDNSandDoH.Checked)
@@ -139,64 +136,42 @@ private async Task NormalConnectAsync(string dnss, int numberOfUsingServer
ConnectedDohPort = dohPort;
// Send Set Profile
- isCmdSent = await DnsConsole.SendCommandAsync("Profile DoH");
+ isCmdSent = await DnsConsole.SendCommandAsync("Profile DoH", consoleDelayMs, consoleTimeoutSec, "Confirmed: Profile");
if (!isCmdSent) return false;
// Send DoH Settings
string dohSettingsCmd = $"Setting -Port={dohPort} -WorkingMode=Dns -MaxRequests=1000000 -DnsTimeoutSec=10 -KillOnCpuUsage=40";
- dohSettingsCmd += $" -AllowInsecure={insecure} -DNSs={dnss} -CfCleanIP={cfCleanIPv4}";
+ dohSettingsCmd += $" -AllowInsecure={insecure} -DNSs={dnss} -CfCleanIP={cfCleanIP}";
dohSettingsCmd += $" -BootstrapIp={bootstrapIP} -BootstrapPort={bootstrapPort}";
- isCmdSent = await DnsConsole.SendCommandAsync(dohSettingsCmd);
+ isCmdSent = await DnsConsole.SendCommandAsync(dohSettingsCmd, consoleDelayMs, consoleTimeoutSec, "Confirmed: Setting");
if (!isCmdSent) return false;
// Send SSL Settings
string dohSslSettingsCmd = $"SSLSetting -Enable=True -RootCA_Path=\"{SecureDNS.IssuerCertPath}\" -RootCA_KeyPath=\"{SecureDNS.IssuerKeyPath}\" -Cert_Path=\"{SecureDNS.CertPath}\" -Cert_KeyPath=\"{SecureDNS.KeyPath}\"";
- isCmdSent = await DnsConsole.SendCommandAsync(dohSslSettingsCmd);
+ isCmdSent = await DnsConsole.SendCommandAsync(dohSslSettingsCmd, consoleDelayMs, consoleTimeoutSec, "Confirmed: SSLSetting");
if (!isCmdSent) return false;
// Send DNS Rules
- if (CustomCheckBoxSettingDnsEnableRules.Checked)
- {
- string dnsRulesCmd = $"Programs DnsRules -Mode=File -PathOrText=\"{SecureDNS.DnsRulesPath}\"";
- isCmdSent = await DnsConsole.SendCommandAsync(dnsRulesCmd);
- if (!isCmdSent) return false;
- }
+ isCmdSent = await ApplyRulesToDnsAsync(null);
+ if (!isCmdSent) return false;
}
}
// Send Write Requests To Log
- isCmdSent = await DnsConsole.SendCommandAsync("Requests True");
+ isCmdSent = await DnsConsole.SendCommandAsync("Requests True", consoleDelayMs, consoleTimeoutSec, "Confirmed: Requests True");
if (!isCmdSent) return false;
// Send Parent Process Command
string parentCommand = $"ParentProcess -PID={Environment.ProcessId}";
- isCmdSent = await DnsConsole.SendCommandAsync(parentCommand);
+ isCmdSent = await DnsConsole.SendCommandAsync(parentCommand, consoleDelayMs, consoleTimeoutSec, "Confirmed: ParentProcess");
if (!isCmdSent) return false;
// Send Start Command
- isCmdSent = await DnsConsole.SendCommandAsync("Start");
+ isCmdSent = await DnsConsole.SendCommandAsync("Start", consoleDelayMs, 30, "Confirmed: Start");
if (!isCmdSent) return false;
- // Wait For Confirm Msg
- bool confirmed = false;
- Task wait2 = Task.Run(async () =>
- {
- while (true)
- {
- if (IsDisconnecting) break;
- if (!ProcessManager.FindProcessByPID(PIDDnsServer)) break;
- if (DnsConsole.GetStdoutBag.Contains("Confirmed"))
- {
- confirmed = true;
- break;
- }
- await Task.Delay(25);
- }
- });
- try { await wait2.WaitAsync(TimeSpan.FromSeconds(30)); } catch (Exception) { }
-
GetBlockedDomainSetting(out string blockedDomainNoWww);
- if (IsConnected && confirmed)
+ if (IsConnected)
{
string msgSuccess = $"Connected.{NL}Waiting For DNS To Get Online...{NL}";
this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgSuccess, Color.MediumSeaGreen));
@@ -238,9 +213,9 @@ private async Task NormalConnectAsync(string dnss, int numberOfUsingServer
}
}
- string msgFailed = "Error: Couldn't Start DNS Server!";
- if (!confirmed) msgFailed = "Couldn't Get Confirm Message From Console.";
- else if (ProcessManager.FindProcessByPID(PIDDnsServer) && !IsDNSConnected)
+ string msgFailed = "Couldn't Get Confirm Message From Console.";
+ if (!ProcessManager.FindProcessByPID(PIDDnsServer)) msgFailed = "Error: Couldn't Start DNS Server!";
+ else if (!IsDNSConnected && ProcessManager.FindProcessByPID(PIDDnsServer))
msgFailed = $"DNS Can't Get Online (Check Domain: {blockedDomainNoWww}). Check Servers.";
if (IsDisconnecting) msgFailed = "Task Canceled.";
this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgFailed + NL, Color.IndianRed));
diff --git a/SecureDNSClient/Forms/ContextMenuStripIcon.cs b/SecureDNSClient/Forms/ContextMenuStripIcon.cs
index d7fb56e..0bac700 100644
--- a/SecureDNSClient/Forms/ContextMenuStripIcon.cs
+++ b/SecureDNSClient/Forms/ContextMenuStripIcon.cs
@@ -167,7 +167,7 @@ private void GoodbyeDpiDeactive_Click(object? sender, EventArgs e)
private async void Proxy_Click(object? sender, EventArgs e)
{
if (IsExiting) return;
- await StartProxy();
+ await StartProxyAsync();
}
private async void ProxySet_Click(object? sender, EventArgs e)
@@ -373,7 +373,7 @@ async Task dc()
IsProxyDeactivating = false;
}
- // Disconnect - Kill all processes
+ // Disconnect - Kill All Processes
if (IsConnected || IsConnecting)
{
IsDisconnecting = true;
@@ -399,6 +399,8 @@ async Task dc()
async Task dcDns()
{
// Unset DNS
+ IsDNSSet = SetDnsOnNic_.IsDnsSet(CustomComboBoxNICs, out bool isDnsSetOn, out _);
+ IsDNSSetOn = isDnsSetOn;
if (IsDNSSet || IsDNSSetting)
{
this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"Unsetting DNS...{NL}", Color.LightGray));
@@ -414,6 +416,14 @@ async Task dcDns()
await UpdateBoolProxyAsync();
bool isEverythingDisconnected = IsEverythingDisconnected(out string debug);
if (isEverythingDisconnected) break;
+ else
+ {
+ if (IsExiting && IsConnecting)
+ {
+ await LogToDebugFileAsync(debug);
+ break;
+ }
+ }
if (!sw.IsRunning) sw.Start();
if (sw.ElapsedMilliseconds > 10000)
diff --git a/SecureDNSClient/Forms/Debug.cs b/SecureDNSClient/Forms/Debug.cs
index d4c0e57..f21a0a4 100644
--- a/SecureDNSClient/Forms/Debug.cs
+++ b/SecureDNSClient/Forms/Debug.cs
@@ -10,7 +10,8 @@ private async void DnsConsole_StandardDataReceived(object? sender, DataReceivedE
string? msg = e.Data;
if (msg != null)
{
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msg + NL, Color.DarkGray));
+ if (!msg.StartsWith("Confirmed:"))
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msg + NL, Color.DarkGray));
await LogToDebugFileAsync(msg);
}
}
@@ -22,7 +23,8 @@ private async void ProxyConsole_StandardDataReceived(object? sender, DataReceive
{
if (!msg.StartsWith("details"))
{
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msg + NL, Color.DarkGray));
+ if (!msg.StartsWith("Confirmed:"))
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msg + NL, Color.DarkGray));
await LogToDebugFileAsync(msg);
}
}
diff --git a/SecureDNSClient/Forms/DefaultSettings.cs b/SecureDNSClient/Forms/DefaultSettings.cs
index 3870054..7fc7643 100644
--- a/SecureDNSClient/Forms/DefaultSettings.cs
+++ b/SecureDNSClient/Forms/DefaultSettings.cs
@@ -132,35 +132,43 @@ private async Task DefaultSettingsAsync()
// Settings Connect
CustomNumericUpDownSettingMaxServers.Value = (decimal)5;
CustomCheckBoxSettingConnectRetry.Checked = false;
- CustomCheckBoxDnsEventShowRequest.Checked = false;
- CustomCheckBoxSettingDnsEnableRules.Checked = false;
+ CustomCheckBoxDnsEventShowRequest.Checked = true;
// Settings Set/Unset DNS
CustomRadioButtonSettingUnsetDnsToDhcp.Checked = false;
CustomRadioButtonSettingUnsetDnsToStatic.Checked = true;
CustomTextBoxSettingUnsetDns1.Text = "8.8.8.8";
CustomTextBoxSettingUnsetDns2.Text = "8.8.4.4";
+ CustomTextBoxSettingUnsetDnsIPv6_1.Text = string.Empty;
+ CustomTextBoxSettingUnsetDnsIPv6_2.Text = string.Empty;
// Settings Share Basic
CustomNumericUpDownSettingProxyPort.Value = (decimal)8080;
CustomNumericUpDownSettingProxyHandleRequests.Value = (decimal)5000;
- CustomCheckBoxSettingProxyBlockPort80.Checked = true;
+ CustomCheckBoxSettingProxyBlockPort80.Checked = false;
CustomNumericUpDownSettingProxyKillRequestTimeout.Value = (decimal)60;
CustomCheckBoxSettingProxyUpstream.Checked = false;
CustomCheckBoxSettingProxyUpstreamOnlyBlockedIPs.Checked = true;
- CustomComboBoxSettingProxyUpstreamMode.SelectedIndex = CustomComboBoxSettingProxyUpstreamMode.Items.Count > 1 ? 1 : -1;
+ CustomComboBoxSettingProxyUpstreamMode.SelectedIndex = CustomComboBoxSettingProxyUpstreamMode.Items.Count > 1 ? 0 : -1;
CustomTextBoxSettingProxyUpstreamHost.Text = IPAddress.Loopback.ToString();
CustomNumericUpDownSettingProxyUpstreamPort.Value = (decimal)1090;
- // Settings Share Advanced
- CustomCheckBoxSettingProxyCfCleanIP.Checked = false;
- CustomTextBoxSettingProxyCfCleanIP.Text = string.Empty;
- CustomCheckBoxSettingProxyEnableRules.Checked = false;
-
// Settings Fake Proxy
CustomTextBoxSettingFakeProxyDohAddress.Text = "https://dns.cloudflare.com/dns-query";
CustomTextBoxSettingFakeProxyDohCleanIP.Text = "104.16.132.229";
+ // Settings Rules
+ CustomCheckBoxSettingProxyCfCleanIP.Checked = false;
+ CustomTextBoxSettingProxyCfCleanIP.Text = string.Empty;
+ CustomCheckBoxSettingEnableRules.Checked = false;
+
+ // Geo Assets
+ CustomCheckBoxGeoAsset_IR_Domains.Checked = true;
+ CustomCheckBoxGeoAsset_IR_CIDRs.Checked = true;
+ CustomCheckBoxGeoAsset_IR_ADS.Checked = false;
+ CustomCheckBoxGeoAssetUpdate.Checked = true;
+ CustomNumericUpDownGeoAssetsUpdate.Value = (decimal)24;
+
// Settings CPU
CustomRadioButtonSettingCPUHigh.Checked = false;
CustomRadioButtonSettingCPUAboveNormal.Checked = false;
diff --git a/SecureDNSClient/Forms/DnsServersSubscription.cs b/SecureDNSClient/Forms/DnsServersSubscription.cs
index 36315ee..2d0915f 100644
--- a/SecureDNSClient/Forms/DnsServersSubscription.cs
+++ b/SecureDNSClient/Forms/DnsServersSubscription.cs
@@ -30,7 +30,7 @@ public static async Task> GetServersFromContentAsync(string content
string temp = line;
int index = temp.LastIndexOf(':');
if (index != -1) temp = temp.Remove(index);
- if (NetworkTool.IsIp(temp, out _)) isIP = true;
+ if (NetworkTool.IsIP(temp, out _)) isIP = true;
}
}
catch (Exception) { }
@@ -53,7 +53,7 @@ public static async Task> GetServersFromContentAsync(string content
string temp = tempWithPort;
int index = temp.LastIndexOf(':');
if (index != -1) temp = temp.Remove(index);
- if (NetworkTool.IsIp(temp, out _))
+ if (NetworkTool.IsIP(temp, out _))
{
isWithRelay = true;
urls.Add(tempWithPort);
diff --git a/SecureDNSClient/Forms/Events.cs b/SecureDNSClient/Forms/Events.cs
index e2be8aa..22758c1 100644
--- a/SecureDNSClient/Forms/Events.cs
+++ b/SecureDNSClient/Forms/Events.cs
@@ -16,20 +16,21 @@ public partial class FormMain : Form
private void DnsConsole_ErrorDataReceived(object? sender, DataReceivedEventArgs e)
{
string? msg = e.Data;
- if (!string.IsNullOrEmpty(msg) && CustomCheckBoxDnsEventShowRequest.Checked)
+ bool writeDnsToLog = true;
+ this.InvokeIt(() => writeDnsToLog = CustomCheckBoxDnsEventShowRequest.Checked);
+ if (!string.IsNullOrEmpty(msg) && writeDnsToLog)
{
if (!StopWatchWriteDnsOutputDelay.IsRunning) StopWatchWriteDnsOutputDelay.Start();
- if (StopWatchWriteDnsOutputDelay.ElapsedMilliseconds < 100) return;
+ if (StopWatchWriteDnsOutputDelay.ElapsedMilliseconds < 80) return;
StopWatchWriteDnsOutputDelay.Restart();
if (!IsInternetOnline) return;
- bool writeToLog = true;
_ = GetBlockedDomainSetting(out string blockedDomainNoWww);
- if (msg.Contains(blockedDomainNoWww) || msg.Contains($"{IPAddress.Loopback}:53")) writeToLog = false;
+ if (msg.Contains(blockedDomainNoWww) || msg.Contains($"{IPAddress.Loopback}:53")) writeDnsToLog = false;
// Write To Log
Color reqColor = msg.Contains("Request Denied") ? Color.Orange : Color.Gray;
- if (writeToLog && !IsExiting && IsConnected && IsDNSConnected && !IsInActionState)
+ if (writeDnsToLog && !IsExiting && IsConnected && IsDNSConnected && !IsInActionState)
this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msg + NL, reqColor));
}
}
@@ -37,17 +38,23 @@ private void DnsConsole_ErrorDataReceived(object? sender, DataReceivedEventArgs
private void ProxyConsole_ErrorDataReceived(object? sender, DataReceivedEventArgs e)
{
string? msg = e.Data;
+ bool writeDnsToLog = true;
+ this.InvokeIt(() => writeDnsToLog = CustomCheckBoxDnsEventShowRequest.Checked);
if (!string.IsNullOrEmpty(msg))
{
if (!StopWatchWriteProxyOutputDelay.IsRunning) StopWatchWriteProxyOutputDelay.Start();
- if (StopWatchWriteProxyOutputDelay.ElapsedMilliseconds < 100) return;
+ if (StopWatchWriteProxyOutputDelay.ElapsedMilliseconds < 80) return;
StopWatchWriteProxyOutputDelay.Restart();
if (!IsInternetOnline) return;
-
+
// Write To Log
- Color reqColor = msg.Contains("Request Denied") ? Color.Orange : Color.Gray;
- if (!IsExiting && IsProxyActivated && IsProxyRunning && !IsInActionState)
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msg + NL, reqColor));
+ bool isProxyDnsQuery = msg.Contains("Q:");
+ if (!isProxyDnsQuery || (isProxyDnsQuery && writeDnsToLog))
+ {
+ Color reqColor = msg.Contains("Request Denied") ? Color.Orange : Color.Gray;
+ if (!IsExiting && IsProxyActivated && IsProxyRunning && !IsInActionState)
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msg + NL, reqColor));
+ }
}
}
diff --git a/SecureDNSClient/Forms/FormIpScanner.Designer.cs b/SecureDNSClient/Forms/FormIpScanner.Designer.cs
index 1746651..ba39dc0 100644
--- a/SecureDNSClient/Forms/FormIpScanner.Designer.cs
+++ b/SecureDNSClient/Forms/FormIpScanner.Designer.cs
@@ -44,14 +44,13 @@ private void InitializeComponent()
CustomContextMenuStripMain = new CustomControls.CustomContextMenuStrip();
CustomLabelCheckWebsite = new CustomControls.CustomLabel();
CustomTextBoxCheckWebsite = new CustomControls.CustomTextBox();
- CustomLabelProxyPort = new CustomControls.CustomLabel();
- CustomNumericUpDownProxyPort = new CustomControls.CustomNumericUpDown();
CustomCheckBoxRandomScan = new CustomControls.CustomCheckBox();
CustomLabelCheckIpWithThisPort = new CustomControls.CustomLabel();
CustomNumericUpDownCheckIpWithThisPort = new CustomControls.CustomNumericUpDown();
+ CustomLabelSelectCIDR = new CustomControls.CustomLabel();
+ CustomComboBoxSelectCIDR = new CustomControls.CustomComboBox();
((System.ComponentModel.ISupportInitialize)CustomNumericUpDownDelay).BeginInit();
((System.ComponentModel.ISupportInitialize)CustomDataGridViewResult).BeginInit();
- ((System.ComponentModel.ISupportInitialize)CustomNumericUpDownProxyPort).BeginInit();
((System.ComponentModel.ISupportInitialize)CustomNumericUpDownCheckIpWithThisPort).BeginInit();
SuspendLayout();
//
@@ -126,7 +125,7 @@ private void InitializeComponent()
CustomDataGridViewResult.ColumnHeadersBorder = true;
dataGridViewCellStyle1.Alignment = DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = Color.FromArgb(73, 73, 73);
- dataGridViewCellStyle1.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
+ dataGridViewCellStyle1.Font = new Font("Segoe UI", 9F);
dataGridViewCellStyle1.ForeColor = Color.White;
dataGridViewCellStyle1.SelectionBackColor = Color.FromArgb(73, 73, 73);
dataGridViewCellStyle1.SelectionForeColor = Color.White;
@@ -136,14 +135,14 @@ private void InitializeComponent()
CustomDataGridViewResult.Columns.AddRange(new DataGridViewColumn[] { RealDelay, TCPDelay, PingDelay, CleanIP });
dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = Color.DimGray;
- dataGridViewCellStyle2.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
+ dataGridViewCellStyle2.Font = new Font("Segoe UI", 9F);
dataGridViewCellStyle2.ForeColor = Color.White;
dataGridViewCellStyle2.SelectionBackColor = Color.FromArgb(97, 177, 255);
dataGridViewCellStyle2.SelectionForeColor = Color.White;
dataGridViewCellStyle2.WrapMode = DataGridViewTriState.False;
CustomDataGridViewResult.DefaultCellStyle = dataGridViewCellStyle2;
CustomDataGridViewResult.GridColor = Color.LightBlue;
- CustomDataGridViewResult.Location = new Point(12, 170);
+ CustomDataGridViewResult.Location = new Point(12, 237);
CustomDataGridViewResult.MultiSelect = false;
CustomDataGridViewResult.Name = "CustomDataGridViewResult";
CustomDataGridViewResult.ReadOnly = true;
@@ -156,7 +155,7 @@ private void InitializeComponent()
CustomDataGridViewResult.ShowCellErrors = false;
CustomDataGridViewResult.ShowEditingIcon = false;
CustomDataGridViewResult.ShowRowErrors = false;
- CustomDataGridViewResult.Size = new Size(360, 229);
+ CustomDataGridViewResult.Size = new Size(360, 162);
CustomDataGridViewResult.TabIndex = 7;
CustomDataGridViewResult.MouseClick += CustomDataGridViewResult_MouseClick;
//
@@ -202,7 +201,7 @@ private void InitializeComponent()
CustomLabelChecking.BorderColor = Color.Blue;
CustomLabelChecking.FlatStyle = FlatStyle.Flat;
CustomLabelChecking.ForeColor = Color.White;
- CustomLabelChecking.Location = new Point(12, 150);
+ CustomLabelChecking.Location = new Point(12, 200);
CustomLabelChecking.Name = "CustomLabelChecking";
CustomLabelChecking.RoundedCorners = 0;
CustomLabelChecking.Size = new Size(146, 17);
@@ -215,6 +214,7 @@ private void InitializeComponent()
CustomContextMenuStripMain.BorderColor = Color.Blue;
CustomContextMenuStripMain.ForeColor = Color.White;
CustomContextMenuStripMain.Name = "CustomContextMenuStripMain";
+ CustomContextMenuStripMain.RoundedCorners = 0;
CustomContextMenuStripMain.SameColorForSubItems = true;
CustomContextMenuStripMain.SelectionColor = Color.LightBlue;
CustomContextMenuStripMain.Size = new Size(61, 4);
@@ -227,7 +227,7 @@ private void InitializeComponent()
CustomLabelCheckWebsite.BorderColor = Color.Blue;
CustomLabelCheckWebsite.FlatStyle = FlatStyle.Flat;
CustomLabelCheckWebsite.ForeColor = Color.White;
- CustomLabelCheckWebsite.Location = new Point(12, 45);
+ CustomLabelCheckWebsite.Location = new Point(12, 95);
CustomLabelCheckWebsite.Name = "CustomLabelCheckWebsite";
CustomLabelCheckWebsite.RoundedCorners = 0;
CustomLabelCheckWebsite.Size = new Size(90, 17);
@@ -243,10 +243,10 @@ private void InitializeComponent()
CustomTextBoxCheckWebsite.BorderColor = Color.Blue;
CustomTextBoxCheckWebsite.BorderSize = 1;
CustomTextBoxCheckWebsite.CharacterCasing = CharacterCasing.Normal;
- CustomTextBoxCheckWebsite.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
+ CustomTextBoxCheckWebsite.Font = new Font("Segoe UI", 9F);
CustomTextBoxCheckWebsite.ForeColor = Color.White;
CustomTextBoxCheckWebsite.HideSelection = true;
- CustomTextBoxCheckWebsite.Location = new Point(108, 43);
+ CustomTextBoxCheckWebsite.Location = new Point(108, 93);
CustomTextBoxCheckWebsite.MaxLength = 32767;
CustomTextBoxCheckWebsite.Multiline = false;
CustomTextBoxCheckWebsite.Name = "CustomTextBoxCheckWebsite";
@@ -262,35 +262,6 @@ private void InitializeComponent()
CustomTextBoxCheckWebsite.UsePasswordChar = false;
CustomTextBoxCheckWebsite.WordWrap = true;
//
- // CustomLabelProxyPort
- //
- CustomLabelProxyPort.AutoSize = true;
- CustomLabelProxyPort.BackColor = Color.DimGray;
- CustomLabelProxyPort.Border = false;
- CustomLabelProxyPort.BorderColor = Color.Blue;
- CustomLabelProxyPort.FlatStyle = FlatStyle.Flat;
- CustomLabelProxyPort.ForeColor = Color.White;
- CustomLabelProxyPort.Location = new Point(12, 115);
- CustomLabelProxyPort.Name = "CustomLabelProxyPort";
- CustomLabelProxyPort.RoundedCorners = 0;
- CustomLabelProxyPort.Size = new Size(67, 17);
- CustomLabelProxyPort.TabIndex = 11;
- CustomLabelProxyPort.Text = "Proxy Port:";
- //
- // CustomNumericUpDownProxyPort
- //
- CustomNumericUpDownProxyPort.BackColor = Color.DimGray;
- CustomNumericUpDownProxyPort.BorderColor = Color.Blue;
- CustomNumericUpDownProxyPort.BorderStyle = BorderStyle.FixedSingle;
- CustomNumericUpDownProxyPort.Location = new Point(85, 113);
- CustomNumericUpDownProxyPort.Maximum = new decimal(new int[] { 65535, 0, 0, 0 });
- CustomNumericUpDownProxyPort.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
- CustomNumericUpDownProxyPort.Name = "CustomNumericUpDownProxyPort";
- CustomNumericUpDownProxyPort.RoundedCorners = 5;
- CustomNumericUpDownProxyPort.Size = new Size(55, 23);
- CustomNumericUpDownProxyPort.TabIndex = 12;
- CustomNumericUpDownProxyPort.Value = new decimal(new int[] { 8090, 0, 0, 0 });
- //
// CustomCheckBoxRandomScan
//
CustomCheckBoxRandomScan.BackColor = Color.DimGray;
@@ -299,7 +270,7 @@ private void InitializeComponent()
CustomCheckBoxRandomScan.Checked = true;
CustomCheckBoxRandomScan.CheckState = CheckState.Checked;
CustomCheckBoxRandomScan.ForeColor = Color.White;
- CustomCheckBoxRandomScan.Location = new Point(167, 115);
+ CustomCheckBoxRandomScan.Location = new Point(14, 165);
CustomCheckBoxRandomScan.Name = "CustomCheckBoxRandomScan";
CustomCheckBoxRandomScan.SelectionColor = Color.LightBlue;
CustomCheckBoxRandomScan.Size = new Size(134, 17);
@@ -315,7 +286,7 @@ private void InitializeComponent()
CustomLabelCheckIpWithThisPort.BorderColor = Color.Blue;
CustomLabelCheckIpWithThisPort.FlatStyle = FlatStyle.Flat;
CustomLabelCheckIpWithThisPort.ForeColor = Color.White;
- CustomLabelCheckIpWithThisPort.Location = new Point(12, 80);
+ CustomLabelCheckIpWithThisPort.Location = new Point(12, 130);
CustomLabelCheckIpWithThisPort.Name = "CustomLabelCheckIpWithThisPort";
CustomLabelCheckIpWithThisPort.RoundedCorners = 0;
CustomLabelCheckIpWithThisPort.Size = new Size(136, 17);
@@ -327,7 +298,7 @@ private void InitializeComponent()
CustomNumericUpDownCheckIpWithThisPort.BackColor = Color.DimGray;
CustomNumericUpDownCheckIpWithThisPort.BorderColor = Color.Blue;
CustomNumericUpDownCheckIpWithThisPort.BorderStyle = BorderStyle.FixedSingle;
- CustomNumericUpDownCheckIpWithThisPort.Location = new Point(154, 78);
+ CustomNumericUpDownCheckIpWithThisPort.Location = new Point(154, 128);
CustomNumericUpDownCheckIpWithThisPort.Maximum = new decimal(new int[] { 65535, 0, 0, 0 });
CustomNumericUpDownCheckIpWithThisPort.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
CustomNumericUpDownCheckIpWithThisPort.Name = "CustomNumericUpDownCheckIpWithThisPort";
@@ -336,17 +307,47 @@ private void InitializeComponent()
CustomNumericUpDownCheckIpWithThisPort.TabIndex = 16;
CustomNumericUpDownCheckIpWithThisPort.Value = new decimal(new int[] { 443, 0, 0, 0 });
//
+ // CustomLabelSelectCIDR
+ //
+ CustomLabelSelectCIDR.AutoSize = true;
+ CustomLabelSelectCIDR.BackColor = Color.DimGray;
+ CustomLabelSelectCIDR.Border = false;
+ CustomLabelSelectCIDR.BorderColor = Color.Blue;
+ CustomLabelSelectCIDR.FlatStyle = FlatStyle.Flat;
+ CustomLabelSelectCIDR.ForeColor = Color.White;
+ CustomLabelSelectCIDR.Location = new Point(12, 52);
+ CustomLabelSelectCIDR.Name = "CustomLabelSelectCIDR";
+ CustomLabelSelectCIDR.RoundedCorners = 0;
+ CustomLabelSelectCIDR.Size = new Size(72, 17);
+ CustomLabelSelectCIDR.TabIndex = 18;
+ CustomLabelSelectCIDR.Text = "Select CIDR:";
+ //
+ // CustomComboBoxSelectCIDR
+ //
+ CustomComboBoxSelectCIDR.BackColor = Color.DimGray;
+ CustomComboBoxSelectCIDR.BorderColor = Color.Blue;
+ CustomComboBoxSelectCIDR.DrawMode = DrawMode.OwnerDrawVariable;
+ CustomComboBoxSelectCIDR.ForeColor = Color.White;
+ CustomComboBoxSelectCIDR.FormattingEnabled = true;
+ CustomComboBoxSelectCIDR.ItemHeight = 17;
+ CustomComboBoxSelectCIDR.Location = new Point(108, 49);
+ CustomComboBoxSelectCIDR.Name = "CustomComboBoxSelectCIDR";
+ CustomComboBoxSelectCIDR.RoundedCorners = 0;
+ CustomComboBoxSelectCIDR.SelectionColor = Color.DodgerBlue;
+ CustomComboBoxSelectCIDR.Size = new Size(200, 23);
+ CustomComboBoxSelectCIDR.TabIndex = 20;
+ //
// FormIpScanner
//
AutoScaleDimensions = new SizeF(96F, 96F);
AutoScaleMode = AutoScaleMode.Dpi;
BackColor = Color.DimGray;
ClientSize = new Size(384, 411);
+ Controls.Add(CustomComboBoxSelectCIDR);
+ Controls.Add(CustomLabelSelectCIDR);
Controls.Add(CustomNumericUpDownCheckIpWithThisPort);
Controls.Add(CustomLabelCheckIpWithThisPort);
Controls.Add(CustomCheckBoxRandomScan);
- Controls.Add(CustomNumericUpDownProxyPort);
- Controls.Add(CustomLabelProxyPort);
Controls.Add(CustomTextBoxCheckWebsite);
Controls.Add(CustomLabelCheckWebsite);
Controls.Add(CustomLabelChecking);
@@ -364,7 +365,6 @@ private void InitializeComponent()
FormClosing += FormIpScanner_FormClosing;
((System.ComponentModel.ISupportInitialize)CustomNumericUpDownDelay).EndInit();
((System.ComponentModel.ISupportInitialize)CustomDataGridViewResult).EndInit();
- ((System.ComponentModel.ISupportInitialize)CustomNumericUpDownProxyPort).EndInit();
((System.ComponentModel.ISupportInitialize)CustomNumericUpDownCheckIpWithThisPort).EndInit();
ResumeLayout(false);
PerformLayout();
@@ -385,10 +385,10 @@ private void InitializeComponent()
private DataGridViewTextBoxColumn CleanIP;
private CustomControls.CustomLabel CustomLabelCheckWebsite;
private CustomControls.CustomTextBox CustomTextBoxCheckWebsite;
- private CustomControls.CustomLabel CustomLabelProxyPort;
- private CustomControls.CustomNumericUpDown CustomNumericUpDownProxyPort;
private CustomControls.CustomCheckBox CustomCheckBoxRandomScan;
private CustomControls.CustomLabel CustomLabelCheckIpWithThisPort;
private CustomControls.CustomNumericUpDown CustomNumericUpDownCheckIpWithThisPort;
+ private CustomControls.CustomLabel CustomLabelSelectCIDR;
+ private CustomControls.CustomComboBox CustomComboBoxSelectCIDR;
}
}
\ No newline at end of file
diff --git a/SecureDNSClient/Forms/FormIpScanner.cs b/SecureDNSClient/Forms/FormIpScanner.cs
index 807a953..f28e757 100644
--- a/SecureDNSClient/Forms/FormIpScanner.cs
+++ b/SecureDNSClient/Forms/FormIpScanner.cs
@@ -3,6 +3,7 @@
using MsmhToolsWinFormsClass;
using MsmhToolsWinFormsClass.Themes;
using System.ComponentModel;
+using System.Diagnostics;
using System.Globalization;
namespace SecureDNSClient;
@@ -38,6 +39,8 @@ public FormIpScanner()
ToolStripMenuItemCopy.Click += ToolStripMenuItemCopy_Click;
CustomContextMenuStripMain.Items.Add(ToolStripMenuItemCopy);
+ FillComboBox(CustomComboBoxSelectCIDR);
+
// Set Tooltips
string msgCheckWebsite = "An open website with chosen CDN to check. e.g. https://www.cloudflare.com";
CustomLabelCheckWebsite.SetToolTip(FormMain.MainToolTip, "Info", msgCheckWebsite);
@@ -71,8 +74,14 @@ private async void FixScreenDpi()
CustomButtonStartStop.Left = CustomNumericUpDownDelay.Right + spaceHH;
CustomButtonStartStop.Top = CustomNumericUpDownDelay.Top;
+ CustomLabelSelectCIDR.Left = spaceRight;
+ CustomLabelSelectCIDR.Top = CustomButtonStartStop.Bottom + spaceV;
+
+ CustomComboBoxSelectCIDR.Left = CustomLabelSelectCIDR.Right + spaceH;
+ CustomComboBoxSelectCIDR.Top = CustomLabelSelectCIDR.Top - 2;
+
CustomLabelCheckWebsite.Left = spaceRight;
- CustomLabelCheckWebsite.Top = CustomButtonStartStop.Bottom + spaceV;
+ CustomLabelCheckWebsite.Top = CustomLabelSelectCIDR.Bottom + (spaceV * 2);
CustomTextBoxCheckWebsite.Left = CustomLabelCheckWebsite.Right + spaceH;
CustomTextBoxCheckWebsite.Top = CustomLabelCheckWebsite.Top - 2;
@@ -83,14 +92,8 @@ private async void FixScreenDpi()
CustomNumericUpDownCheckIpWithThisPort.Left = CustomLabelCheckIpWithThisPort.Right + spaceH;
CustomNumericUpDownCheckIpWithThisPort.Top = CustomLabelCheckIpWithThisPort.Top - 2;
- CustomLabelProxyPort.Left = spaceRight;
- CustomLabelProxyPort.Top = CustomNumericUpDownCheckIpWithThisPort.Bottom + spaceV;
-
- CustomNumericUpDownProxyPort.Left = CustomLabelProxyPort.Right + spaceH;
- CustomNumericUpDownProxyPort.Top = CustomLabelProxyPort.Top - 2;
-
- CustomCheckBoxRandomScan.Left = CustomNumericUpDownProxyPort.Right + spaceHH;
- CustomCheckBoxRandomScan.Top = CustomLabelProxyPort.Top;
+ CustomCheckBoxRandomScan.Left = spaceRight;
+ CustomCheckBoxRandomScan.Top = CustomNumericUpDownCheckIpWithThisPort.Bottom + spaceV;
CustomLabelChecking.Left = spaceRight;
CustomLabelChecking.Top = CustomCheckBoxRandomScan.Bottom + spaceV;
@@ -108,50 +111,83 @@ private async void FixScreenDpi()
Controllers.SetDarkControl(this);
}
- private void CustomButtonStartStop_Click(object sender, EventArgs e)
+ private static void FillComboBox(CustomComboBox ccb)
{
// Built-in CF IPs
- string defaultCfIPs = "103.21.244.0 - 103.21.244.255\n";
- defaultCfIPs += "103.22.200.0 - 103.22.200.255\n";
- defaultCfIPs += "103.31.4.0 - 103.31.5.255\n";
- defaultCfIPs += "104.16.0.0 - 104.31.255.255\n";
- defaultCfIPs += "108.162.192.0 - 108.162.207.255\n";
- defaultCfIPs += "131.0.72.0 - 131.0.75.255\n";
- defaultCfIPs += "141.101.64.0 - 141.101.65.255\n";
- defaultCfIPs += "162.158.0.0 - 162.158.3.255\n";
- defaultCfIPs += "172.64.0.0 - 172.67.255.255\n";
- defaultCfIPs += "173.245.48.0 - 173.245.48.255\n";
- defaultCfIPs += "188.114.96.0 - 188.114.99.255\n";
- defaultCfIPs += "190.93.240.0 - 190.93.243.255\n";
- defaultCfIPs += "197.234.240.0 - 197.234.243.255\n";
- defaultCfIPs += "198.41.128.0 - 198.41.143.255";
-
- if (!Scanner.IsRunning)
- start();
- else
- stop();
+ List cloudflareCIDRs = new()
+ {
+ "103.21.244.0/22",
+ "103.22.200.0/22",
+ "103.31.4.0/22",
+ "104.16.0.0/13",
+ "104.24.0.0/14",
+ "108.162.192.0/18",
+ "131.0.72.0/22",
+ "141.101.64.0/18",
+ "162.158.0.0/15",
+ "172.64.0.0/13",
+ "173.245.48.0/20",
+ "188.114.96.0/20",
+ "190.93.240.0/20",
+ "197.234.240.0/22",
+ "198.41.128.0/17",
+ "2400:cb00::/32",
+ "2405:8100::/32",
+ "2405:b500::/32",
+ "2606:4700::/32",
+ "2803:f800::/32",
+ "2a06:98c0::/29",
+ "2c0f:f248::/32"
+ };
+
+ ccb.InvokeIt(() =>
+ {
+ ccb.DataSource = cloudflareCIDRs;
+ ccb.SetDarkControl();
+ });
+ }
+
+ private void CustomButtonStartStop_Click(object? sender, EventArgs? e)
+ {
+ if (!Scanner.IsRunning) start();
+ else stop();
void start()
{
- // Start
- CustomDataGridViewResult.Rows.Clear();
-
- Scanner.SetIpRange(defaultCfIPs);
- Scanner.CheckPort = Convert.ToInt32(CustomNumericUpDownCheckIpWithThisPort.Value);
- Scanner.CheckWebsite = CustomTextBoxCheckWebsite.Text;
- Scanner.ProxyServerPort = Convert.ToInt32(CustomNumericUpDownProxyPort.Value);
- Scanner.RandomScan = CustomCheckBoxRandomScan.Checked;
- Scanner.Timeout = Convert.ToInt32(CustomNumericUpDownDelay.Value * 1000);
-
- Scanner.OnWorkingIpReceived -= Scanner_OnWorkingIpReceived;
- Scanner.OnWorkingIpReceived += Scanner_OnWorkingIpReceived;
- Scanner.OnFullReportChanged -= Scanner_OnFullReportChanged;
- Scanner.OnFullReportChanged += Scanner_OnFullReportChanged;
-
- if (!Scanner.IsRunning)
+ try
{
- Scanner.Start();
- this.InvokeIt(() => CustomButtonStartStop.Text = "Stop");
+ string? cidr = string.Empty;
+ this.InvokeIt(() =>
+ {
+ if (CustomComboBoxSelectCIDR.SelectedIndex == -1 && CustomComboBoxSelectCIDR.Items.Count > 0)
+ CustomComboBoxSelectCIDR.SelectedIndex = 0;
+ cidr = CustomComboBoxSelectCIDR.SelectedItem.ToString();
+ });
+ if (string.IsNullOrWhiteSpace(cidr)) return;
+
+ // Start
+ CustomDataGridViewResult.Rows.Clear();
+
+ Scanner.SetIpRange(new List { cidr });
+ Scanner.CheckPort = Convert.ToInt32(CustomNumericUpDownCheckIpWithThisPort.Value);
+ Scanner.CheckWebsite = CustomTextBoxCheckWebsite.Text;
+ Scanner.RandomScan = CustomCheckBoxRandomScan.Checked;
+ Scanner.Timeout = Convert.ToInt32(CustomNumericUpDownDelay.Value * 1000);
+
+ Scanner.OnWorkingIpReceived -= Scanner_OnWorkingIpReceived;
+ Scanner.OnWorkingIpReceived += Scanner_OnWorkingIpReceived;
+ Scanner.OnFullReportChanged -= Scanner_OnFullReportChanged;
+ Scanner.OnFullReportChanged += Scanner_OnFullReportChanged;
+
+ if (!Scanner.IsRunning)
+ {
+ Scanner.Start();
+ this.InvokeIt(() => CustomButtonStartStop.Text = "Stop");
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("FormIpScanner Start: " + ex.Message);
}
}
@@ -206,9 +242,10 @@ private void Scanner_OnWorkingIpReceived(object? sender, EventArgs e)
CustomDataGridViewResult.Sort(CustomDataGridViewResult.Columns[0], ListSortDirection.Ascending);
CustomDataGridViewResult.EndEdit();
- });
-
+ if (CustomDataGridViewResult.RowCount >= 20)
+ CustomButtonStartStop_Click(null, null);
+ });
}
}
@@ -271,6 +308,7 @@ private async void FormIpScanner_FormClosing(object sender, FormClosingEventArgs
AppSettings.AddSelectedControlAndProperty(typeof(CustomRadioButton), "Checked");
AppSettings.AddSelectedControlAndProperty(typeof(CustomTextBox), "Text");
AppSettings.AddSelectedControlAndProperty(typeof(CustomTextBox), "Texts");
+ AppSettings.AddSelectedControlAndProperty(typeof(CustomComboBox), "SelectedIndex");
// Add AgnosticSettings to save
AppSettings.AddSelectedSettings(this);
diff --git a/SecureDNSClient/Forms/FormMain.Designer.cs b/SecureDNSClient/Forms/FormMain.Designer.cs
index 3c2eed6..9d3cad1 100644
--- a/SecureDNSClient/Forms/FormMain.Designer.cs
+++ b/SecureDNSClient/Forms/FormMain.Designer.cs
@@ -29,11 +29,11 @@ protected override void Dispose(bool disposing)
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
- DataGridViewCellStyle dataGridViewCellStyle13 = new DataGridViewCellStyle();
- DataGridViewCellStyle dataGridViewCellStyle14 = new DataGridViewCellStyle();
+ DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
+ DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
+ DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();
+ DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
- DataGridViewCellStyle dataGridViewCellStyle15 = new DataGridViewCellStyle();
- DataGridViewCellStyle dataGridViewCellStyle16 = new DataGridViewCellStyle();
SplitContainerShareMain = new SplitContainer();
SplitContainerShareTop = new SplitContainer();
SplitContainerShareContent = new SplitContainer();
@@ -241,11 +241,13 @@ private void InitializeComponent()
TabPageSettingsConnect = new TabPage();
CustomCheckBoxSettingConnectRetry = new CustomControls.CustomCheckBox();
CustomCheckBoxDnsEventShowRequest = new CustomControls.CustomCheckBox();
- CustomButtonSettingDnsRules = new CustomControls.CustomButton();
- CustomCheckBoxSettingDnsEnableRules = new CustomControls.CustomCheckBox();
CustomNumericUpDownSettingMaxServers = new CustomControls.CustomNumericUpDown();
CustomLabelSettingMaxServers = new CustomControls.CustomLabel();
TabPageSettingsSetUnsetDNS = new TabPage();
+ CustomTextBoxSettingUnsetDnsIPv6_2 = new CustomControls.CustomTextBox();
+ CustomTextBoxSettingUnsetDnsIPv6_1 = new CustomControls.CustomTextBox();
+ CustomLabelSettingUnsetDnsIPv6_2 = new CustomControls.CustomLabel();
+ CustomLabelSettingUnsetDnsIPv6_1 = new CustomControls.CustomLabel();
CustomTextBoxSettingUnsetDns2 = new CustomControls.CustomTextBox();
CustomTextBoxSettingUnsetDns1 = new CustomControls.CustomTextBox();
CustomLabelSettingUnsetDns2 = new CustomControls.CustomLabel();
@@ -269,19 +271,32 @@ private void InitializeComponent()
CustomLabelSettingProxyHandleRequests = new CustomControls.CustomLabel();
CustomNumericUpDownSettingProxyPort = new CustomControls.CustomNumericUpDown();
CustomNumericUpDownSettingProxyHandleRequests = new CustomControls.CustomNumericUpDown();
- TabPageSettingProxyAdvanced = new TabPage();
- CustomCheckBoxSettingProxyCfCleanIP = new CustomControls.CustomCheckBox();
- CustomTextBoxSettingProxyCfCleanIP = new CustomControls.CustomTextBox();
- CustomCheckBoxSettingProxyEnableRules = new CustomControls.CustomCheckBox();
- CustomLabelSettingShareSeparator1 = new CustomControls.CustomLabel();
- CustomLabelSettingProxyRules = new CustomControls.CustomLabel();
- CustomButtonSettingProxyRules = new CustomControls.CustomButton();
TabPageSettingsFakeProxy = new TabPage();
CustomTextBoxSettingFakeProxyDohCleanIP = new CustomControls.CustomTextBox();
CustomTextBoxSettingFakeProxyDohAddress = new CustomControls.CustomTextBox();
CustomLabelSettingFakeProxyDohCleanIP = new CustomControls.CustomLabel();
CustomLabelSettingFakeProxyDohAddress = new CustomControls.CustomLabel();
CustomLabelSettingFakeProxyInfo = new CustomControls.CustomLabel();
+ TabPageSettingsRules = new TabPage();
+ FlowLayoutPanelRules = new FlowLayoutPanel();
+ FlowLayoutPanelRules2 = new FlowLayoutPanel();
+ CustomCheckBoxSettingProxyCfCleanIP = new CustomControls.CustomCheckBox();
+ CustomTextBoxSettingProxyCfCleanIP = new CustomControls.CustomTextBox();
+ FlowLayoutPanelRules3 = new FlowLayoutPanel();
+ CustomCheckBoxSettingEnableRules = new CustomControls.CustomCheckBox();
+ CustomButtonSettingRules = new CustomControls.CustomButton();
+ LinkLabelSettingRulesHelp = new LinkLabel();
+ TabPageSettingsGeoAssets = new TabPage();
+ FlowLayoutPanelGeoAssets = new FlowLayoutPanel();
+ CustomLabelGeoAssetsSpacer1 = new CustomControls.CustomLabel();
+ CustomCheckBoxGeoAsset_IR_Domains = new CustomControls.CustomCheckBox();
+ CustomCheckBoxGeoAsset_IR_CIDRs = new CustomControls.CustomCheckBox();
+ CustomCheckBoxGeoAsset_IR_ADS = new CustomControls.CustomCheckBox();
+ CustomLabelGeoAssetsSpacer2 = new CustomControls.CustomLabel();
+ FlowLayoutPanelGeoAssets2 = new FlowLayoutPanel();
+ CustomCheckBoxGeoAssetUpdate = new CustomControls.CustomCheckBox();
+ CustomNumericUpDownGeoAssetsUpdate = new CustomControls.CustomNumericUpDown();
+ CustomLabelGeoAssetsSpacer3 = new CustomControls.CustomLabel();
TabPageSettingsCPU = new TabPage();
CustomNumericUpDownUpdateAutoDelayMS = new CustomControls.CustomNumericUpDown();
CustomLabelUpdateAutoDelayMS = new CustomControls.CustomLabel();
@@ -448,8 +463,15 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)CustomNumericUpDownSettingProxyUpstreamPort).BeginInit();
((System.ComponentModel.ISupportInitialize)CustomNumericUpDownSettingProxyPort).BeginInit();
((System.ComponentModel.ISupportInitialize)CustomNumericUpDownSettingProxyHandleRequests).BeginInit();
- TabPageSettingProxyAdvanced.SuspendLayout();
TabPageSettingsFakeProxy.SuspendLayout();
+ TabPageSettingsRules.SuspendLayout();
+ FlowLayoutPanelRules.SuspendLayout();
+ FlowLayoutPanelRules2.SuspendLayout();
+ FlowLayoutPanelRules3.SuspendLayout();
+ TabPageSettingsGeoAssets.SuspendLayout();
+ FlowLayoutPanelGeoAssets.SuspendLayout();
+ FlowLayoutPanelGeoAssets2.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)CustomNumericUpDownGeoAssetsUpdate).BeginInit();
TabPageSettingsCPU.SuspendLayout();
((System.ComponentModel.ISupportInitialize)CustomNumericUpDownUpdateAutoDelayMS).BeginInit();
((System.ComponentModel.ISupportInitialize)CustomNumericUpDownSettingCpuKillProxyRequests).BeginInit();
@@ -560,7 +582,7 @@ private void InitializeComponent()
CustomLabelProxySSLInfo.Margin = new Padding(3);
CustomLabelProxySSLInfo.Name = "CustomLabelProxySSLInfo";
CustomLabelProxySSLInfo.RoundedCorners = 0;
- CustomLabelProxySSLInfo.Size = new Size(212, 15);
+ CustomLabelProxySSLInfo.Size = new Size(214, 17);
CustomLabelProxySSLInfo.TabIndex = 147;
CustomLabelProxySSLInfo.Text = "By Installing Root Certificate Authority.";
CustomLabelProxySSLInfo.TextAlign = ContentAlignment.MiddleLeft;
@@ -592,7 +614,7 @@ private void InitializeComponent()
CustomLabelShareInfo.Location = new Point(13, 5);
CustomLabelShareInfo.Name = "CustomLabelShareInfo";
CustomLabelShareInfo.RoundedCorners = 0;
- CustomLabelShareInfo.Size = new Size(317, 21);
+ CustomLabelShareInfo.Size = new Size(319, 23);
CustomLabelShareInfo.TabIndex = 132;
CustomLabelShareInfo.Text = "Share to other devices on the same network.";
//
@@ -725,7 +747,7 @@ private void InitializeComponent()
CustomLabelPDpiPresets.Location = new Point(318, 39);
CustomLabelPDpiPresets.Name = "CustomLabelPDpiPresets";
CustomLabelPDpiPresets.RoundedCorners = 0;
- CustomLabelPDpiPresets.Size = new Size(47, 15);
+ CustomLabelPDpiPresets.Size = new Size(49, 17);
CustomLabelPDpiPresets.TabIndex = 144;
CustomLabelPDpiPresets.Text = "Presets:";
//
@@ -772,7 +794,7 @@ private void InitializeComponent()
CustomLabelPDpiBeforeSniChunks.Margin = new Padding(3);
CustomLabelPDpiBeforeSniChunks.Name = "CustomLabelPDpiBeforeSniChunks";
CustomLabelPDpiBeforeSniChunks.RoundedCorners = 0;
- CustomLabelPDpiBeforeSniChunks.Size = new Size(108, 15);
+ CustomLabelPDpiBeforeSniChunks.Size = new Size(110, 17);
CustomLabelPDpiBeforeSniChunks.TabIndex = 142;
CustomLabelPDpiBeforeSniChunks.Text = "Chunks before SNI:";
CustomLabelPDpiBeforeSniChunks.TextAlign = ContentAlignment.MiddleLeft;
@@ -804,7 +826,7 @@ private void InitializeComponent()
CustomLabelPDpiSniChunkMode.Margin = new Padding(3);
CustomLabelPDpiSniChunkMode.Name = "CustomLabelPDpiSniChunkMode";
CustomLabelPDpiSniChunkMode.RoundedCorners = 0;
- CustomLabelPDpiSniChunkMode.Size = new Size(98, 15);
+ CustomLabelPDpiSniChunkMode.Size = new Size(100, 17);
CustomLabelPDpiSniChunkMode.TabIndex = 141;
CustomLabelPDpiSniChunkMode.Text = "SNI chunk mode:";
CustomLabelPDpiSniChunkMode.TextAlign = ContentAlignment.MiddleLeft;
@@ -853,7 +875,7 @@ private void InitializeComponent()
CustomLabelPDpiSniChunks.Margin = new Padding(3);
CustomLabelPDpiSniChunks.Name = "CustomLabelPDpiSniChunks";
CustomLabelPDpiSniChunks.RoundedCorners = 0;
- CustomLabelPDpiSniChunks.Size = new Size(71, 15);
+ CustomLabelPDpiSniChunks.Size = new Size(73, 17);
CustomLabelPDpiSniChunks.TabIndex = 134;
CustomLabelPDpiSniChunks.Text = "Chunks SNI:";
CustomLabelPDpiSniChunks.TextAlign = ContentAlignment.MiddleLeft;
@@ -979,7 +1001,7 @@ private void InitializeComponent()
CustomGroupBoxShareRulesStatus.Size = new Size(200, 275);
CustomGroupBoxShareRulesStatus.TabIndex = 0;
CustomGroupBoxShareRulesStatus.TabStop = false;
- CustomGroupBoxShareRulesStatus.Text = "ProxyRules Status";
+ CustomGroupBoxShareRulesStatus.Text = "Rules Status";
//
// SplitContainerShareRulesStatus1
//
@@ -1041,9 +1063,9 @@ private void InitializeComponent()
CustomLabelShareRulesStatus.Location = new Point(4, 2);
CustomLabelShareRulesStatus.Name = "CustomLabelShareRulesStatus";
CustomLabelShareRulesStatus.RoundedCorners = 0;
- CustomLabelShareRulesStatus.Size = new Size(175, 15);
+ CustomLabelShareRulesStatus.Size = new Size(147, 17);
CustomLabelShareRulesStatus.TabIndex = 0;
- CustomLabelShareRulesStatus.Text = "Check ProxyRules for a domain:";
+ CustomLabelShareRulesStatus.Text = "Check Rules for a domain:";
//
// SplitContainerShareRulesStatus2
//
@@ -2131,25 +2153,25 @@ private void InitializeComponent()
CustomDataGridViewNicStatus.BorderColor = Color.Blue;
CustomDataGridViewNicStatus.CheckColor = Color.Blue;
CustomDataGridViewNicStatus.ColumnHeadersBorder = true;
- dataGridViewCellStyle13.Alignment = DataGridViewContentAlignment.MiddleLeft;
- dataGridViewCellStyle13.BackColor = Color.FromArgb(73, 73, 73);
- dataGridViewCellStyle13.Font = new Font("Segoe UI", 9F);
- dataGridViewCellStyle13.ForeColor = Color.White;
- dataGridViewCellStyle13.SelectionBackColor = Color.FromArgb(73, 73, 73);
- dataGridViewCellStyle13.SelectionForeColor = Color.White;
- dataGridViewCellStyle13.WrapMode = DataGridViewTriState.True;
- CustomDataGridViewNicStatus.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle13;
+ dataGridViewCellStyle1.Alignment = DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle1.BackColor = Color.FromArgb(73, 73, 73);
+ dataGridViewCellStyle1.Font = new Font("Segoe UI", 9F);
+ dataGridViewCellStyle1.ForeColor = Color.White;
+ dataGridViewCellStyle1.SelectionBackColor = Color.FromArgb(73, 73, 73);
+ dataGridViewCellStyle1.SelectionForeColor = Color.White;
+ dataGridViewCellStyle1.WrapMode = DataGridViewTriState.True;
+ CustomDataGridViewNicStatus.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
CustomDataGridViewNicStatus.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
CustomDataGridViewNicStatus.ColumnHeadersVisible = false;
CustomDataGridViewNicStatus.Columns.AddRange(new DataGridViewColumn[] { ColumnNicStatusName, ColumnNicStatusText });
- dataGridViewCellStyle14.Alignment = DataGridViewContentAlignment.MiddleLeft;
- dataGridViewCellStyle14.BackColor = Color.DimGray;
- dataGridViewCellStyle14.Font = new Font("Segoe UI", 9F);
- dataGridViewCellStyle14.ForeColor = Color.White;
- dataGridViewCellStyle14.SelectionBackColor = Color.FromArgb(97, 177, 255);
- dataGridViewCellStyle14.SelectionForeColor = Color.White;
- dataGridViewCellStyle14.WrapMode = DataGridViewTriState.False;
- CustomDataGridViewNicStatus.DefaultCellStyle = dataGridViewCellStyle14;
+ dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle2.BackColor = Color.DimGray;
+ dataGridViewCellStyle2.Font = new Font("Segoe UI", 9F);
+ dataGridViewCellStyle2.ForeColor = Color.White;
+ dataGridViewCellStyle2.SelectionBackColor = Color.FromArgb(97, 177, 255);
+ dataGridViewCellStyle2.SelectionForeColor = Color.White;
+ dataGridViewCellStyle2.WrapMode = DataGridViewTriState.False;
+ CustomDataGridViewNicStatus.DefaultCellStyle = dataGridViewCellStyle2;
CustomDataGridViewNicStatus.Dock = DockStyle.Fill;
CustomDataGridViewNicStatus.GridColor = Color.LightBlue;
CustomDataGridViewNicStatus.Location = new Point(3, 19);
@@ -3197,7 +3219,7 @@ private void InitializeComponent()
CustomListBoxSettingsMenu.IntegralHeight = false;
CustomListBoxSettingsMenu.ItemBorder = true;
CustomListBoxSettingsMenu.ItemHeight = 30;
- CustomListBoxSettingsMenu.Items.AddRange(new object[] { "Working Mode", "Check", "Quick Connect", "Connect", "Set/Unset DNS", "Share", "Fake Proxy", "CPU", "Others" });
+ CustomListBoxSettingsMenu.Items.AddRange(new object[] { "Working Mode", "Check", "Quick Connect", "Connect", "Set/Unset DNS", "Share", "Fake Proxy", "Rules", "Geo Assets", "CPU", "Others" });
CustomListBoxSettingsMenu.Location = new Point(0, 0);
CustomListBoxSettingsMenu.Name = "CustomListBoxSettingsMenu";
CustomListBoxSettingsMenu.RightToLeft = RightToLeft.No;
@@ -3219,6 +3241,8 @@ private void InitializeComponent()
CustomTabControlSettings.Controls.Add(TabPageSettingsSetUnsetDNS);
CustomTabControlSettings.Controls.Add(TabPageSettingsShare);
CustomTabControlSettings.Controls.Add(TabPageSettingsFakeProxy);
+ CustomTabControlSettings.Controls.Add(TabPageSettingsRules);
+ CustomTabControlSettings.Controls.Add(TabPageSettingsGeoAssets);
CustomTabControlSettings.Controls.Add(TabPageSettingsCPU);
CustomTabControlSettings.Controls.Add(TabPageSettingsOthers);
CustomTabControlSettings.Dock = DockStyle.Fill;
@@ -3926,8 +3950,6 @@ private void InitializeComponent()
TabPageSettingsConnect.BackColor = Color.Transparent;
TabPageSettingsConnect.Controls.Add(CustomCheckBoxSettingConnectRetry);
TabPageSettingsConnect.Controls.Add(CustomCheckBoxDnsEventShowRequest);
- TabPageSettingsConnect.Controls.Add(CustomButtonSettingDnsRules);
- TabPageSettingsConnect.Controls.Add(CustomCheckBoxSettingDnsEnableRules);
TabPageSettingsConnect.Controls.Add(CustomNumericUpDownSettingMaxServers);
TabPageSettingsConnect.Controls.Add(CustomLabelSettingMaxServers);
TabPageSettingsConnect.Location = new Point(99, 4);
@@ -3958,6 +3980,8 @@ private void InitializeComponent()
CustomCheckBoxDnsEventShowRequest.BackColor = Color.DimGray;
CustomCheckBoxDnsEventShowRequest.BorderColor = Color.Blue;
CustomCheckBoxDnsEventShowRequest.CheckColor = Color.Blue;
+ CustomCheckBoxDnsEventShowRequest.Checked = true;
+ CustomCheckBoxDnsEventShowRequest.CheckState = CheckState.Checked;
CustomCheckBoxDnsEventShowRequest.ForeColor = Color.White;
CustomCheckBoxDnsEventShowRequest.Location = new Point(50, 127);
CustomCheckBoxDnsEventShowRequest.Name = "CustomCheckBoxDnsEventShowRequest";
@@ -3967,34 +3991,6 @@ private void InitializeComponent()
CustomCheckBoxDnsEventShowRequest.Text = "Write DNS requests to log";
CustomCheckBoxDnsEventShowRequest.UseVisualStyleBackColor = false;
//
- // CustomButtonSettingDnsRules
- //
- CustomButtonSettingDnsRules.BorderColor = Color.Blue;
- CustomButtonSettingDnsRules.FlatStyle = FlatStyle.Flat;
- CustomButtonSettingDnsRules.Location = new Point(210, 176);
- CustomButtonSettingDnsRules.Name = "CustomButtonSettingDnsRules";
- CustomButtonSettingDnsRules.RoundedCorners = 5;
- CustomButtonSettingDnsRules.SelectionColor = Color.LightBlue;
- CustomButtonSettingDnsRules.Size = new Size(120, 27);
- CustomButtonSettingDnsRules.TabIndex = 9;
- CustomButtonSettingDnsRules.Text = "Edit DNS Rules";
- CustomButtonSettingDnsRules.UseVisualStyleBackColor = true;
- CustomButtonSettingDnsRules.Click += CustomButtonSettingDnsRules_Click;
- //
- // CustomCheckBoxSettingDnsEnableRules
- //
- CustomCheckBoxSettingDnsEnableRules.BackColor = Color.DimGray;
- CustomCheckBoxSettingDnsEnableRules.BorderColor = Color.Blue;
- CustomCheckBoxSettingDnsEnableRules.CheckColor = Color.Blue;
- CustomCheckBoxSettingDnsEnableRules.ForeColor = Color.White;
- CustomCheckBoxSettingDnsEnableRules.Location = new Point(50, 178);
- CustomCheckBoxSettingDnsEnableRules.Name = "CustomCheckBoxSettingDnsEnableRules";
- CustomCheckBoxSettingDnsEnableRules.SelectionColor = Color.LightBlue;
- CustomCheckBoxSettingDnsEnableRules.Size = new Size(116, 17);
- CustomCheckBoxSettingDnsEnableRules.TabIndex = 8;
- CustomCheckBoxSettingDnsEnableRules.Text = "Enable DNS Rules";
- CustomCheckBoxSettingDnsEnableRules.UseVisualStyleBackColor = false;
- //
// CustomNumericUpDownSettingMaxServers
//
CustomNumericUpDownSettingMaxServers.BackColor = Color.DimGray;
@@ -4028,6 +4024,10 @@ private void InitializeComponent()
//
TabPageSettingsSetUnsetDNS.AutoScroll = true;
TabPageSettingsSetUnsetDNS.BackColor = Color.Transparent;
+ TabPageSettingsSetUnsetDNS.Controls.Add(CustomTextBoxSettingUnsetDnsIPv6_2);
+ TabPageSettingsSetUnsetDNS.Controls.Add(CustomTextBoxSettingUnsetDnsIPv6_1);
+ TabPageSettingsSetUnsetDNS.Controls.Add(CustomLabelSettingUnsetDnsIPv6_2);
+ TabPageSettingsSetUnsetDNS.Controls.Add(CustomLabelSettingUnsetDnsIPv6_1);
TabPageSettingsSetUnsetDNS.Controls.Add(CustomTextBoxSettingUnsetDns2);
TabPageSettingsSetUnsetDNS.Controls.Add(CustomTextBoxSettingUnsetDns1);
TabPageSettingsSetUnsetDNS.Controls.Add(CustomLabelSettingUnsetDns2);
@@ -4043,6 +4043,92 @@ private void InitializeComponent()
TabPageSettingsSetUnsetDNS.Text = "Set/Unset DNS";
TabPageSettingsSetUnsetDNS.Visible = false;
//
+ // CustomTextBoxSettingUnsetDnsIPv6_2
+ //
+ CustomTextBoxSettingUnsetDnsIPv6_2.AcceptsReturn = false;
+ CustomTextBoxSettingUnsetDnsIPv6_2.AcceptsTab = false;
+ CustomTextBoxSettingUnsetDnsIPv6_2.BackColor = Color.DimGray;
+ CustomTextBoxSettingUnsetDnsIPv6_2.Border = true;
+ CustomTextBoxSettingUnsetDnsIPv6_2.BorderColor = Color.Blue;
+ CustomTextBoxSettingUnsetDnsIPv6_2.BorderSize = 1;
+ CustomTextBoxSettingUnsetDnsIPv6_2.CharacterCasing = CharacterCasing.Normal;
+ CustomTextBoxSettingUnsetDnsIPv6_2.Font = new Font("Segoe UI", 9F);
+ CustomTextBoxSettingUnsetDnsIPv6_2.ForeColor = Color.White;
+ CustomTextBoxSettingUnsetDnsIPv6_2.HideSelection = true;
+ CustomTextBoxSettingUnsetDnsIPv6_2.Location = new Point(220, 223);
+ CustomTextBoxSettingUnsetDnsIPv6_2.MaxLength = 32767;
+ CustomTextBoxSettingUnsetDnsIPv6_2.Multiline = false;
+ CustomTextBoxSettingUnsetDnsIPv6_2.Name = "CustomTextBoxSettingUnsetDnsIPv6_2";
+ CustomTextBoxSettingUnsetDnsIPv6_2.ReadOnly = false;
+ CustomTextBoxSettingUnsetDnsIPv6_2.RoundedCorners = 0;
+ CustomTextBoxSettingUnsetDnsIPv6_2.ScrollBars = ScrollBars.None;
+ CustomTextBoxSettingUnsetDnsIPv6_2.ShortcutsEnabled = true;
+ CustomTextBoxSettingUnsetDnsIPv6_2.Size = new Size(143, 23);
+ CustomTextBoxSettingUnsetDnsIPv6_2.TabIndex = 0;
+ CustomTextBoxSettingUnsetDnsIPv6_2.TextAlign = HorizontalAlignment.Left;
+ CustomTextBoxSettingUnsetDnsIPv6_2.Texts = "";
+ CustomTextBoxSettingUnsetDnsIPv6_2.UnderlinedStyle = true;
+ CustomTextBoxSettingUnsetDnsIPv6_2.UsePasswordChar = false;
+ CustomTextBoxSettingUnsetDnsIPv6_2.WordWrap = true;
+ //
+ // CustomTextBoxSettingUnsetDnsIPv6_1
+ //
+ CustomTextBoxSettingUnsetDnsIPv6_1.AcceptsReturn = false;
+ CustomTextBoxSettingUnsetDnsIPv6_1.AcceptsTab = false;
+ CustomTextBoxSettingUnsetDnsIPv6_1.BackColor = Color.DimGray;
+ CustomTextBoxSettingUnsetDnsIPv6_1.Border = true;
+ CustomTextBoxSettingUnsetDnsIPv6_1.BorderColor = Color.Blue;
+ CustomTextBoxSettingUnsetDnsIPv6_1.BorderSize = 1;
+ CustomTextBoxSettingUnsetDnsIPv6_1.CharacterCasing = CharacterCasing.Normal;
+ CustomTextBoxSettingUnsetDnsIPv6_1.Font = new Font("Segoe UI", 9F);
+ CustomTextBoxSettingUnsetDnsIPv6_1.ForeColor = Color.White;
+ CustomTextBoxSettingUnsetDnsIPv6_1.HideSelection = true;
+ CustomTextBoxSettingUnsetDnsIPv6_1.Location = new Point(220, 181);
+ CustomTextBoxSettingUnsetDnsIPv6_1.MaxLength = 32767;
+ CustomTextBoxSettingUnsetDnsIPv6_1.Multiline = false;
+ CustomTextBoxSettingUnsetDnsIPv6_1.Name = "CustomTextBoxSettingUnsetDnsIPv6_1";
+ CustomTextBoxSettingUnsetDnsIPv6_1.ReadOnly = false;
+ CustomTextBoxSettingUnsetDnsIPv6_1.RoundedCorners = 0;
+ CustomTextBoxSettingUnsetDnsIPv6_1.ScrollBars = ScrollBars.None;
+ CustomTextBoxSettingUnsetDnsIPv6_1.ShortcutsEnabled = true;
+ CustomTextBoxSettingUnsetDnsIPv6_1.Size = new Size(143, 23);
+ CustomTextBoxSettingUnsetDnsIPv6_1.TabIndex = 0;
+ CustomTextBoxSettingUnsetDnsIPv6_1.TextAlign = HorizontalAlignment.Left;
+ CustomTextBoxSettingUnsetDnsIPv6_1.Texts = "";
+ CustomTextBoxSettingUnsetDnsIPv6_1.UnderlinedStyle = true;
+ CustomTextBoxSettingUnsetDnsIPv6_1.UsePasswordChar = false;
+ CustomTextBoxSettingUnsetDnsIPv6_1.WordWrap = true;
+ //
+ // CustomLabelSettingUnsetDnsIPv6_2
+ //
+ CustomLabelSettingUnsetDnsIPv6_2.AutoSize = true;
+ CustomLabelSettingUnsetDnsIPv6_2.BackColor = Color.DimGray;
+ CustomLabelSettingUnsetDnsIPv6_2.Border = false;
+ CustomLabelSettingUnsetDnsIPv6_2.BorderColor = Color.Blue;
+ CustomLabelSettingUnsetDnsIPv6_2.FlatStyle = FlatStyle.Flat;
+ CustomLabelSettingUnsetDnsIPv6_2.ForeColor = Color.White;
+ CustomLabelSettingUnsetDnsIPv6_2.Location = new Point(110, 223);
+ CustomLabelSettingUnsetDnsIPv6_2.Name = "CustomLabelSettingUnsetDnsIPv6_2";
+ CustomLabelSettingUnsetDnsIPv6_2.RoundedCorners = 0;
+ CustomLabelSettingUnsetDnsIPv6_2.Size = new Size(90, 15);
+ CustomLabelSettingUnsetDnsIPv6_2.TabIndex = 5;
+ CustomLabelSettingUnsetDnsIPv6_2.Text = "Secondary IPv6:";
+ //
+ // CustomLabelSettingUnsetDnsIPv6_1
+ //
+ CustomLabelSettingUnsetDnsIPv6_1.AutoSize = true;
+ CustomLabelSettingUnsetDnsIPv6_1.BackColor = Color.DimGray;
+ CustomLabelSettingUnsetDnsIPv6_1.Border = false;
+ CustomLabelSettingUnsetDnsIPv6_1.BorderColor = Color.Blue;
+ CustomLabelSettingUnsetDnsIPv6_1.FlatStyle = FlatStyle.Flat;
+ CustomLabelSettingUnsetDnsIPv6_1.ForeColor = Color.White;
+ CustomLabelSettingUnsetDnsIPv6_1.Location = new Point(110, 181);
+ CustomLabelSettingUnsetDnsIPv6_1.Name = "CustomLabelSettingUnsetDnsIPv6_1";
+ CustomLabelSettingUnsetDnsIPv6_1.RoundedCorners = 0;
+ CustomLabelSettingUnsetDnsIPv6_1.Size = new Size(76, 15);
+ CustomLabelSettingUnsetDnsIPv6_1.TabIndex = 4;
+ CustomLabelSettingUnsetDnsIPv6_1.Text = "Primary IPv6:";
+ //
// CustomTextBoxSettingUnsetDns2
//
CustomTextBoxSettingUnsetDns2.AcceptsReturn = false;
@@ -4055,7 +4141,7 @@ private void InitializeComponent()
CustomTextBoxSettingUnsetDns2.Font = new Font("Segoe UI", 9F);
CustomTextBoxSettingUnsetDns2.ForeColor = Color.White;
CustomTextBoxSettingUnsetDns2.HideSelection = true;
- CustomTextBoxSettingUnsetDns2.Location = new Point(180, 138);
+ CustomTextBoxSettingUnsetDns2.Location = new Point(220, 138);
CustomTextBoxSettingUnsetDns2.MaxLength = 32767;
CustomTextBoxSettingUnsetDns2.Multiline = false;
CustomTextBoxSettingUnsetDns2.Name = "CustomTextBoxSettingUnsetDns2";
@@ -4063,7 +4149,7 @@ private void InitializeComponent()
CustomTextBoxSettingUnsetDns2.RoundedCorners = 0;
CustomTextBoxSettingUnsetDns2.ScrollBars = ScrollBars.None;
CustomTextBoxSettingUnsetDns2.ShortcutsEnabled = true;
- CustomTextBoxSettingUnsetDns2.Size = new Size(95, 23);
+ CustomTextBoxSettingUnsetDns2.Size = new Size(143, 23);
CustomTextBoxSettingUnsetDns2.TabIndex = 0;
CustomTextBoxSettingUnsetDns2.TextAlign = HorizontalAlignment.Left;
CustomTextBoxSettingUnsetDns2.Texts = "8.8.4.4";
@@ -4083,7 +4169,7 @@ private void InitializeComponent()
CustomTextBoxSettingUnsetDns1.Font = new Font("Segoe UI", 9F);
CustomTextBoxSettingUnsetDns1.ForeColor = Color.White;
CustomTextBoxSettingUnsetDns1.HideSelection = true;
- CustomTextBoxSettingUnsetDns1.Location = new Point(180, 103);
+ CustomTextBoxSettingUnsetDns1.Location = new Point(220, 103);
CustomTextBoxSettingUnsetDns1.MaxLength = 32767;
CustomTextBoxSettingUnsetDns1.Multiline = false;
CustomTextBoxSettingUnsetDns1.Name = "CustomTextBoxSettingUnsetDns1";
@@ -4091,7 +4177,7 @@ private void InitializeComponent()
CustomTextBoxSettingUnsetDns1.RoundedCorners = 0;
CustomTextBoxSettingUnsetDns1.ScrollBars = ScrollBars.None;
CustomTextBoxSettingUnsetDns1.ShortcutsEnabled = true;
- CustomTextBoxSettingUnsetDns1.Size = new Size(95, 23);
+ CustomTextBoxSettingUnsetDns1.Size = new Size(143, 23);
CustomTextBoxSettingUnsetDns1.TabIndex = 0;
CustomTextBoxSettingUnsetDns1.TextAlign = HorizontalAlignment.Left;
CustomTextBoxSettingUnsetDns1.Texts = "8.8.8.8";
@@ -4110,9 +4196,9 @@ private void InitializeComponent()
CustomLabelSettingUnsetDns2.Location = new Point(110, 140);
CustomLabelSettingUnsetDns2.Name = "CustomLabelSettingUnsetDns2";
CustomLabelSettingUnsetDns2.RoundedCorners = 0;
- CustomLabelSettingUnsetDns2.Size = new Size(65, 15);
+ CustomLabelSettingUnsetDns2.Size = new Size(90, 15);
CustomLabelSettingUnsetDns2.TabIndex = 3;
- CustomLabelSettingUnsetDns2.Text = "Secondary:";
+ CustomLabelSettingUnsetDns2.Text = "Secondary IPv4:";
//
// CustomLabelSettingUnsetDns1
//
@@ -4125,9 +4211,9 @@ private void InitializeComponent()
CustomLabelSettingUnsetDns1.Location = new Point(110, 105);
CustomLabelSettingUnsetDns1.Name = "CustomLabelSettingUnsetDns1";
CustomLabelSettingUnsetDns1.RoundedCorners = 0;
- CustomLabelSettingUnsetDns1.Size = new Size(51, 15);
+ CustomLabelSettingUnsetDns1.Size = new Size(76, 15);
CustomLabelSettingUnsetDns1.TabIndex = 2;
- CustomLabelSettingUnsetDns1.Text = "Primary:";
+ CustomLabelSettingUnsetDns1.Text = "Primary IPv4:";
//
// CustomRadioButtonSettingUnsetDnsToStatic
//
@@ -4176,7 +4262,6 @@ private void InitializeComponent()
//
CustomTabControlSettingProxy.BorderColor = Color.Blue;
CustomTabControlSettingProxy.Controls.Add(TabPageSettingProxyBasic);
- CustomTabControlSettingProxy.Controls.Add(TabPageSettingProxyAdvanced);
CustomTabControlSettingProxy.Dock = DockStyle.Fill;
CustomTabControlSettingProxy.HideTabHeader = false;
CustomTabControlSettingProxy.Location = new Point(3, 3);
@@ -4382,8 +4467,6 @@ private void InitializeComponent()
CustomCheckBoxSettingProxyBlockPort80.BackColor = Color.DimGray;
CustomCheckBoxSettingProxyBlockPort80.BorderColor = Color.Blue;
CustomCheckBoxSettingProxyBlockPort80.CheckColor = Color.Blue;
- CustomCheckBoxSettingProxyBlockPort80.Checked = true;
- CustomCheckBoxSettingProxyBlockPort80.CheckState = CheckState.Checked;
CustomCheckBoxSettingProxyBlockPort80.ForeColor = Color.White;
CustomCheckBoxSettingProxyBlockPort80.Location = new Point(403, 25);
CustomCheckBoxSettingProxyBlockPort80.Name = "CustomCheckBoxSettingProxyBlockPort80";
@@ -4436,124 +4519,6 @@ private void InitializeComponent()
CustomNumericUpDownSettingProxyHandleRequests.TabIndex = 44;
CustomNumericUpDownSettingProxyHandleRequests.Value = new decimal(new int[] { 5000, 0, 0, 0 });
//
- // TabPageSettingProxyAdvanced
- //
- TabPageSettingProxyAdvanced.AutoScroll = true;
- TabPageSettingProxyAdvanced.BackColor = Color.Transparent;
- TabPageSettingProxyAdvanced.Controls.Add(CustomCheckBoxSettingProxyCfCleanIP);
- TabPageSettingProxyAdvanced.Controls.Add(CustomTextBoxSettingProxyCfCleanIP);
- TabPageSettingProxyAdvanced.Controls.Add(CustomCheckBoxSettingProxyEnableRules);
- TabPageSettingProxyAdvanced.Controls.Add(CustomLabelSettingShareSeparator1);
- TabPageSettingProxyAdvanced.Controls.Add(CustomLabelSettingProxyRules);
- TabPageSettingProxyAdvanced.Controls.Add(CustomButtonSettingProxyRules);
- TabPageSettingProxyAdvanced.Location = new Point(4, 25);
- TabPageSettingProxyAdvanced.Name = "TabPageSettingProxyAdvanced";
- TabPageSettingProxyAdvanced.Padding = new Padding(3);
- TabPageSettingProxyAdvanced.Size = new Size(504, 322);
- TabPageSettingProxyAdvanced.TabIndex = 1;
- TabPageSettingProxyAdvanced.Tag = 1;
- TabPageSettingProxyAdvanced.Text = "Advanced";
- TabPageSettingProxyAdvanced.Visible = false;
- //
- // CustomCheckBoxSettingProxyCfCleanIP
- //
- CustomCheckBoxSettingProxyCfCleanIP.BackColor = Color.DimGray;
- CustomCheckBoxSettingProxyCfCleanIP.BorderColor = Color.Blue;
- CustomCheckBoxSettingProxyCfCleanIP.CheckColor = Color.Blue;
- CustomCheckBoxSettingProxyCfCleanIP.ForeColor = Color.White;
- CustomCheckBoxSettingProxyCfCleanIP.Location = new Point(6, 10);
- CustomCheckBoxSettingProxyCfCleanIP.Name = "CustomCheckBoxSettingProxyCfCleanIP";
- CustomCheckBoxSettingProxyCfCleanIP.SelectionColor = Color.LightBlue;
- CustomCheckBoxSettingProxyCfCleanIP.Size = new Size(249, 17);
- CustomCheckBoxSettingProxyCfCleanIP.TabIndex = 1;
- CustomCheckBoxSettingProxyCfCleanIP.Text = "Redirect all Cloudflare IPv4s to a clean IPv4:";
- CustomCheckBoxSettingProxyCfCleanIP.UseVisualStyleBackColor = false;
- CustomCheckBoxSettingProxyCfCleanIP.CheckedChanged += CustomCheckBoxSettingProxyCfCleanIP_CheckedChanged;
- //
- // CustomTextBoxSettingProxyCfCleanIP
- //
- CustomTextBoxSettingProxyCfCleanIP.AcceptsReturn = false;
- CustomTextBoxSettingProxyCfCleanIP.AcceptsTab = false;
- CustomTextBoxSettingProxyCfCleanIP.BackColor = Color.DimGray;
- CustomTextBoxSettingProxyCfCleanIP.Border = true;
- CustomTextBoxSettingProxyCfCleanIP.BorderColor = Color.Blue;
- CustomTextBoxSettingProxyCfCleanIP.BorderSize = 1;
- CustomTextBoxSettingProxyCfCleanIP.CharacterCasing = CharacterCasing.Normal;
- CustomTextBoxSettingProxyCfCleanIP.Font = new Font("Segoe UI", 9F);
- CustomTextBoxSettingProxyCfCleanIP.ForeColor = Color.White;
- CustomTextBoxSettingProxyCfCleanIP.HideSelection = true;
- CustomTextBoxSettingProxyCfCleanIP.Location = new Point(263, 8);
- CustomTextBoxSettingProxyCfCleanIP.MaxLength = 32767;
- CustomTextBoxSettingProxyCfCleanIP.Multiline = false;
- CustomTextBoxSettingProxyCfCleanIP.Name = "CustomTextBoxSettingProxyCfCleanIP";
- CustomTextBoxSettingProxyCfCleanIP.ReadOnly = false;
- CustomTextBoxSettingProxyCfCleanIP.RoundedCorners = 0;
- CustomTextBoxSettingProxyCfCleanIP.ScrollBars = ScrollBars.None;
- CustomTextBoxSettingProxyCfCleanIP.ShortcutsEnabled = true;
- CustomTextBoxSettingProxyCfCleanIP.Size = new Size(150, 23);
- CustomTextBoxSettingProxyCfCleanIP.TabIndex = 0;
- CustomTextBoxSettingProxyCfCleanIP.TextAlign = HorizontalAlignment.Left;
- CustomTextBoxSettingProxyCfCleanIP.Texts = "104.18.145.170";
- CustomTextBoxSettingProxyCfCleanIP.UnderlinedStyle = true;
- CustomTextBoxSettingProxyCfCleanIP.UsePasswordChar = false;
- CustomTextBoxSettingProxyCfCleanIP.WordWrap = true;
- //
- // CustomCheckBoxSettingProxyEnableRules
- //
- CustomCheckBoxSettingProxyEnableRules.BackColor = Color.DimGray;
- CustomCheckBoxSettingProxyEnableRules.BorderColor = Color.Blue;
- CustomCheckBoxSettingProxyEnableRules.CheckColor = Color.Blue;
- CustomCheckBoxSettingProxyEnableRules.ForeColor = Color.White;
- CustomCheckBoxSettingProxyEnableRules.Location = new Point(6, 55);
- CustomCheckBoxSettingProxyEnableRules.Name = "CustomCheckBoxSettingProxyEnableRules";
- CustomCheckBoxSettingProxyEnableRules.SelectionColor = Color.LightBlue;
- CustomCheckBoxSettingProxyEnableRules.Size = new Size(116, 17);
- CustomCheckBoxSettingProxyEnableRules.TabIndex = 3;
- CustomCheckBoxSettingProxyEnableRules.Text = "Enable Proxy Rules";
- CustomCheckBoxSettingProxyEnableRules.UseVisualStyleBackColor = false;
- //
- // CustomLabelSettingShareSeparator1
- //
- CustomLabelSettingShareSeparator1.BackColor = Color.DimGray;
- CustomLabelSettingShareSeparator1.Border = true;
- CustomLabelSettingShareSeparator1.BorderColor = Color.Blue;
- CustomLabelSettingShareSeparator1.FlatStyle = FlatStyle.Flat;
- CustomLabelSettingShareSeparator1.ForeColor = Color.White;
- CustomLabelSettingShareSeparator1.Location = new Point(12, 40);
- CustomLabelSettingShareSeparator1.Name = "CustomLabelSettingShareSeparator1";
- CustomLabelSettingShareSeparator1.RoundedCorners = 0;
- CustomLabelSettingShareSeparator1.Size = new Size(550, 1);
- CustomLabelSettingShareSeparator1.TabIndex = 6;
- //
- // CustomLabelSettingProxyRules
- //
- CustomLabelSettingProxyRules.AutoSize = true;
- CustomLabelSettingProxyRules.BackColor = Color.DimGray;
- CustomLabelSettingProxyRules.Border = false;
- CustomLabelSettingProxyRules.BorderColor = Color.Blue;
- CustomLabelSettingProxyRules.FlatStyle = FlatStyle.Flat;
- CustomLabelSettingProxyRules.ForeColor = Color.White;
- CustomLabelSettingProxyRules.Location = new Point(22, 75);
- CustomLabelSettingProxyRules.Name = "CustomLabelSettingProxyRules";
- CustomLabelSettingProxyRules.RoundedCorners = 0;
- CustomLabelSettingProxyRules.Size = new Size(231, 210);
- CustomLabelSettingProxyRules.TabIndex = 4;
- CustomLabelSettingProxyRules.Text = resources.GetString("CustomLabelSettingProxyRules.Text");
- //
- // CustomButtonSettingProxyRules
- //
- CustomButtonSettingProxyRules.BorderColor = Color.Blue;
- CustomButtonSettingProxyRules.FlatStyle = FlatStyle.Flat;
- CustomButtonSettingProxyRules.Location = new Point(276, 65);
- CustomButtonSettingProxyRules.Name = "CustomButtonSettingProxyRules";
- CustomButtonSettingProxyRules.RoundedCorners = 5;
- CustomButtonSettingProxyRules.SelectionColor = Color.LightBlue;
- CustomButtonSettingProxyRules.Size = new Size(120, 27);
- CustomButtonSettingProxyRules.TabIndex = 5;
- CustomButtonSettingProxyRules.Text = "Edit Proxy Rules";
- CustomButtonSettingProxyRules.UseVisualStyleBackColor = true;
- CustomButtonSettingProxyRules.Click += CustomButtonSettingProxyRules_Click;
- //
// TabPageSettingsFakeProxy
//
TabPageSettingsFakeProxy.AutoScroll = true;
@@ -4592,7 +4557,7 @@ private void InitializeComponent()
CustomTextBoxSettingFakeProxyDohCleanIP.RoundedCorners = 0;
CustomTextBoxSettingFakeProxyDohCleanIP.ScrollBars = ScrollBars.None;
CustomTextBoxSettingFakeProxyDohCleanIP.ShortcutsEnabled = true;
- CustomTextBoxSettingFakeProxyDohCleanIP.Size = new Size(95, 23);
+ CustomTextBoxSettingFakeProxyDohCleanIP.Size = new Size(162, 23);
CustomTextBoxSettingFakeProxyDohCleanIP.TabIndex = 0;
CustomTextBoxSettingFakeProxyDohCleanIP.TextAlign = HorizontalAlignment.Left;
CustomTextBoxSettingFakeProxyDohCleanIP.Texts = "104.16.132.229";
@@ -4674,6 +4639,309 @@ private void InitializeComponent()
CustomLabelSettingFakeProxyInfo.TabIndex = 48;
CustomLabelSettingFakeProxyInfo.Text = "Fake Proxy is use to bypass a DoH.";
//
+ // TabPageSettingsRules
+ //
+ TabPageSettingsRules.Controls.Add(FlowLayoutPanelRules);
+ TabPageSettingsRules.Location = new Point(99, 4);
+ TabPageSettingsRules.Name = "TabPageSettingsRules";
+ TabPageSettingsRules.Padding = new Padding(3);
+ TabPageSettingsRules.Size = new Size(518, 357);
+ TabPageSettingsRules.TabIndex = 10;
+ TabPageSettingsRules.Tag = 7;
+ TabPageSettingsRules.Text = "Rules";
+ TabPageSettingsRules.UseVisualStyleBackColor = true;
+ //
+ // FlowLayoutPanelRules
+ //
+ FlowLayoutPanelRules.AutoScroll = true;
+ FlowLayoutPanelRules.AutoSize = true;
+ FlowLayoutPanelRules.Controls.Add(FlowLayoutPanelRules2);
+ FlowLayoutPanelRules.Controls.Add(FlowLayoutPanelRules3);
+ FlowLayoutPanelRules.Dock = DockStyle.Fill;
+ FlowLayoutPanelRules.FlowDirection = FlowDirection.TopDown;
+ FlowLayoutPanelRules.Location = new Point(3, 3);
+ FlowLayoutPanelRules.Name = "FlowLayoutPanelRules";
+ FlowLayoutPanelRules.Padding = new Padding(5);
+ FlowLayoutPanelRules.Size = new Size(512, 351);
+ FlowLayoutPanelRules.TabIndex = 0;
+ FlowLayoutPanelRules.WrapContents = false;
+ //
+ // FlowLayoutPanelRules2
+ //
+ FlowLayoutPanelRules2.AutoSize = true;
+ FlowLayoutPanelRules2.Controls.Add(CustomCheckBoxSettingProxyCfCleanIP);
+ FlowLayoutPanelRules2.Controls.Add(CustomTextBoxSettingProxyCfCleanIP);
+ FlowLayoutPanelRules2.Location = new Point(8, 8);
+ FlowLayoutPanelRules2.Name = "FlowLayoutPanelRules2";
+ FlowLayoutPanelRules2.Padding = new Padding(10);
+ FlowLayoutPanelRules2.Size = new Size(445, 49);
+ FlowLayoutPanelRules2.TabIndex = 0;
+ FlowLayoutPanelRules2.WrapContents = false;
+ //
+ // CustomCheckBoxSettingProxyCfCleanIP
+ //
+ CustomCheckBoxSettingProxyCfCleanIP.BackColor = Color.DimGray;
+ CustomCheckBoxSettingProxyCfCleanIP.BorderColor = Color.Blue;
+ CustomCheckBoxSettingProxyCfCleanIP.CheckColor = Color.Blue;
+ CustomCheckBoxSettingProxyCfCleanIP.ForeColor = Color.White;
+ CustomCheckBoxSettingProxyCfCleanIP.Location = new Point(15, 15);
+ CustomCheckBoxSettingProxyCfCleanIP.Margin = new Padding(5);
+ CustomCheckBoxSettingProxyCfCleanIP.Name = "CustomCheckBoxSettingProxyCfCleanIP";
+ CustomCheckBoxSettingProxyCfCleanIP.SelectionColor = Color.LightBlue;
+ CustomCheckBoxSettingProxyCfCleanIP.Size = new Size(226, 17);
+ CustomCheckBoxSettingProxyCfCleanIP.TabIndex = 3;
+ CustomCheckBoxSettingProxyCfCleanIP.Text = "Redirect all Cloudflare IPs to a clean IP:";
+ CustomCheckBoxSettingProxyCfCleanIP.UseVisualStyleBackColor = false;
+ //
+ // CustomTextBoxSettingProxyCfCleanIP
+ //
+ CustomTextBoxSettingProxyCfCleanIP.AcceptsReturn = false;
+ CustomTextBoxSettingProxyCfCleanIP.AcceptsTab = false;
+ CustomTextBoxSettingProxyCfCleanIP.BackColor = Color.DimGray;
+ CustomTextBoxSettingProxyCfCleanIP.Border = true;
+ CustomTextBoxSettingProxyCfCleanIP.BorderColor = Color.Blue;
+ CustomTextBoxSettingProxyCfCleanIP.BorderSize = 1;
+ CustomTextBoxSettingProxyCfCleanIP.CharacterCasing = CharacterCasing.Normal;
+ CustomTextBoxSettingProxyCfCleanIP.Font = new Font("Segoe UI", 9F);
+ CustomTextBoxSettingProxyCfCleanIP.ForeColor = Color.White;
+ CustomTextBoxSettingProxyCfCleanIP.HideSelection = true;
+ CustomTextBoxSettingProxyCfCleanIP.Location = new Point(249, 13);
+ CustomTextBoxSettingProxyCfCleanIP.MaxLength = 32767;
+ CustomTextBoxSettingProxyCfCleanIP.Multiline = false;
+ CustomTextBoxSettingProxyCfCleanIP.Name = "CustomTextBoxSettingProxyCfCleanIP";
+ CustomTextBoxSettingProxyCfCleanIP.ReadOnly = false;
+ CustomTextBoxSettingProxyCfCleanIP.RoundedCorners = 0;
+ CustomTextBoxSettingProxyCfCleanIP.ScrollBars = ScrollBars.None;
+ CustomTextBoxSettingProxyCfCleanIP.ShortcutsEnabled = true;
+ CustomTextBoxSettingProxyCfCleanIP.Size = new Size(183, 23);
+ CustomTextBoxSettingProxyCfCleanIP.TabIndex = 0;
+ CustomTextBoxSettingProxyCfCleanIP.TextAlign = HorizontalAlignment.Left;
+ CustomTextBoxSettingProxyCfCleanIP.Texts = "104.18.145.170";
+ CustomTextBoxSettingProxyCfCleanIP.UnderlinedStyle = true;
+ CustomTextBoxSettingProxyCfCleanIP.UsePasswordChar = false;
+ CustomTextBoxSettingProxyCfCleanIP.WordWrap = true;
+ //
+ // FlowLayoutPanelRules3
+ //
+ FlowLayoutPanelRules3.AutoSize = true;
+ FlowLayoutPanelRules3.Controls.Add(CustomCheckBoxSettingEnableRules);
+ FlowLayoutPanelRules3.Controls.Add(CustomButtonSettingRules);
+ FlowLayoutPanelRules3.Controls.Add(LinkLabelSettingRulesHelp);
+ FlowLayoutPanelRules3.Location = new Point(8, 63);
+ FlowLayoutPanelRules3.Name = "FlowLayoutPanelRules3";
+ FlowLayoutPanelRules3.Padding = new Padding(10);
+ FlowLayoutPanelRules3.Size = new Size(287, 53);
+ FlowLayoutPanelRules3.TabIndex = 1;
+ FlowLayoutPanelRules3.WrapContents = false;
+ //
+ // CustomCheckBoxSettingEnableRules
+ //
+ CustomCheckBoxSettingEnableRules.BackColor = Color.DimGray;
+ CustomCheckBoxSettingEnableRules.BorderColor = Color.Blue;
+ CustomCheckBoxSettingEnableRules.CheckColor = Color.Blue;
+ CustomCheckBoxSettingEnableRules.ForeColor = Color.White;
+ CustomCheckBoxSettingEnableRules.Location = new Point(15, 15);
+ CustomCheckBoxSettingEnableRules.Margin = new Padding(5);
+ CustomCheckBoxSettingEnableRules.Name = "CustomCheckBoxSettingEnableRules";
+ CustomCheckBoxSettingEnableRules.SelectionColor = Color.LightBlue;
+ CustomCheckBoxSettingEnableRules.Size = new Size(94, 17);
+ CustomCheckBoxSettingEnableRules.TabIndex = 9;
+ CustomCheckBoxSettingEnableRules.Text = "Enable Rules";
+ CustomCheckBoxSettingEnableRules.UseVisualStyleBackColor = false;
+ //
+ // CustomButtonSettingRules
+ //
+ CustomButtonSettingRules.BorderColor = Color.Blue;
+ CustomButtonSettingRules.FlatStyle = FlatStyle.Flat;
+ CustomButtonSettingRules.Location = new Point(117, 13);
+ CustomButtonSettingRules.Name = "CustomButtonSettingRules";
+ CustomButtonSettingRules.RoundedCorners = 5;
+ CustomButtonSettingRules.SelectionColor = Color.LightBlue;
+ CustomButtonSettingRules.Size = new Size(103, 27);
+ CustomButtonSettingRules.TabIndex = 10;
+ CustomButtonSettingRules.Text = "Edit Rules";
+ CustomButtonSettingRules.UseVisualStyleBackColor = true;
+ CustomButtonSettingRules.Click += CustomButtonSettingRules_Click;
+ //
+ // LinkLabelSettingRulesHelp
+ //
+ LinkLabelSettingRulesHelp.AutoSize = true;
+ LinkLabelSettingRulesHelp.LinkBehavior = LinkBehavior.NeverUnderline;
+ LinkLabelSettingRulesHelp.Location = new Point(226, 10);
+ LinkLabelSettingRulesHelp.Name = "LinkLabelSettingRulesHelp";
+ LinkLabelSettingRulesHelp.Padding = new Padding(8);
+ LinkLabelSettingRulesHelp.Size = new Size(48, 31);
+ LinkLabelSettingRulesHelp.TabIndex = 14;
+ LinkLabelSettingRulesHelp.TabStop = true;
+ LinkLabelSettingRulesHelp.Text = "Help";
+ LinkLabelSettingRulesHelp.LinkClicked += LinkLabelSettingRulesHelp_LinkClicked;
+ //
+ // TabPageSettingsGeoAssets
+ //
+ TabPageSettingsGeoAssets.Controls.Add(FlowLayoutPanelGeoAssets);
+ TabPageSettingsGeoAssets.Location = new Point(99, 4);
+ TabPageSettingsGeoAssets.Name = "TabPageSettingsGeoAssets";
+ TabPageSettingsGeoAssets.Padding = new Padding(3);
+ TabPageSettingsGeoAssets.Size = new Size(518, 357);
+ TabPageSettingsGeoAssets.TabIndex = 9;
+ TabPageSettingsGeoAssets.Tag = 8;
+ TabPageSettingsGeoAssets.Text = "Geo Assets";
+ TabPageSettingsGeoAssets.UseVisualStyleBackColor = true;
+ //
+ // FlowLayoutPanelGeoAssets
+ //
+ FlowLayoutPanelGeoAssets.Controls.Add(CustomLabelGeoAssetsSpacer1);
+ FlowLayoutPanelGeoAssets.Controls.Add(CustomCheckBoxGeoAsset_IR_Domains);
+ FlowLayoutPanelGeoAssets.Controls.Add(CustomCheckBoxGeoAsset_IR_CIDRs);
+ FlowLayoutPanelGeoAssets.Controls.Add(CustomCheckBoxGeoAsset_IR_ADS);
+ FlowLayoutPanelGeoAssets.Controls.Add(CustomLabelGeoAssetsSpacer2);
+ FlowLayoutPanelGeoAssets.Controls.Add(FlowLayoutPanelGeoAssets2);
+ FlowLayoutPanelGeoAssets.Controls.Add(CustomLabelGeoAssetsSpacer3);
+ FlowLayoutPanelGeoAssets.Dock = DockStyle.Fill;
+ FlowLayoutPanelGeoAssets.FlowDirection = FlowDirection.TopDown;
+ FlowLayoutPanelGeoAssets.Location = new Point(3, 3);
+ FlowLayoutPanelGeoAssets.Name = "FlowLayoutPanelGeoAssets";
+ FlowLayoutPanelGeoAssets.Padding = new Padding(5);
+ FlowLayoutPanelGeoAssets.Size = new Size(512, 351);
+ FlowLayoutPanelGeoAssets.TabIndex = 0;
+ FlowLayoutPanelGeoAssets.WrapContents = false;
+ //
+ // CustomLabelGeoAssetsSpacer1
+ //
+ CustomLabelGeoAssetsSpacer1.BackColor = Color.DimGray;
+ CustomLabelGeoAssetsSpacer1.Border = false;
+ CustomLabelGeoAssetsSpacer1.BorderColor = Color.Blue;
+ CustomLabelGeoAssetsSpacer1.FlatStyle = FlatStyle.Flat;
+ CustomLabelGeoAssetsSpacer1.ForeColor = Color.White;
+ CustomLabelGeoAssetsSpacer1.Location = new Point(8, 8);
+ CustomLabelGeoAssetsSpacer1.Margin = new Padding(3);
+ CustomLabelGeoAssetsSpacer1.Name = "CustomLabelGeoAssetsSpacer1";
+ CustomLabelGeoAssetsSpacer1.RoundedCorners = 0;
+ CustomLabelGeoAssetsSpacer1.Size = new Size(103, 20);
+ CustomLabelGeoAssetsSpacer1.TabIndex = 10;
+ CustomLabelGeoAssetsSpacer1.Text = " ";
+ //
+ // CustomCheckBoxGeoAsset_IR_Domains
+ //
+ CustomCheckBoxGeoAsset_IR_Domains.BackColor = Color.DimGray;
+ CustomCheckBoxGeoAsset_IR_Domains.BorderColor = Color.Blue;
+ CustomCheckBoxGeoAsset_IR_Domains.CheckColor = Color.Blue;
+ CustomCheckBoxGeoAsset_IR_Domains.Checked = true;
+ CustomCheckBoxGeoAsset_IR_Domains.CheckState = CheckState.Checked;
+ CustomCheckBoxGeoAsset_IR_Domains.ForeColor = Color.White;
+ CustomCheckBoxGeoAsset_IR_Domains.Location = new Point(8, 34);
+ CustomCheckBoxGeoAsset_IR_Domains.Name = "CustomCheckBoxGeoAsset_IR_Domains";
+ CustomCheckBoxGeoAsset_IR_Domains.SelectionColor = Color.LightBlue;
+ CustomCheckBoxGeoAsset_IR_Domains.Size = new Size(118, 19);
+ CustomCheckBoxGeoAsset_IR_Domains.TabIndex = 11;
+ CustomCheckBoxGeoAsset_IR_Domains.Text = "IR Domains: Direct";
+ CustomCheckBoxGeoAsset_IR_Domains.UseVisualStyleBackColor = false;
+ CustomCheckBoxGeoAsset_IR_Domains.CheckedChanged += CustomCheckBoxGeoAsset_GeoAssets_CheckedChanged;
+ //
+ // CustomCheckBoxGeoAsset_IR_CIDRs
+ //
+ CustomCheckBoxGeoAsset_IR_CIDRs.BackColor = Color.DimGray;
+ CustomCheckBoxGeoAsset_IR_CIDRs.BorderColor = Color.Blue;
+ CustomCheckBoxGeoAsset_IR_CIDRs.CheckColor = Color.Blue;
+ CustomCheckBoxGeoAsset_IR_CIDRs.Checked = true;
+ CustomCheckBoxGeoAsset_IR_CIDRs.CheckState = CheckState.Checked;
+ CustomCheckBoxGeoAsset_IR_CIDRs.ForeColor = Color.White;
+ CustomCheckBoxGeoAsset_IR_CIDRs.Location = new Point(8, 59);
+ CustomCheckBoxGeoAsset_IR_CIDRs.Name = "CustomCheckBoxGeoAsset_IR_CIDRs";
+ CustomCheckBoxGeoAsset_IR_CIDRs.SelectionColor = Color.LightBlue;
+ CustomCheckBoxGeoAsset_IR_CIDRs.Size = new Size(85, 19);
+ CustomCheckBoxGeoAsset_IR_CIDRs.TabIndex = 12;
+ CustomCheckBoxGeoAsset_IR_CIDRs.Text = "IR IPs: Direct";
+ CustomCheckBoxGeoAsset_IR_CIDRs.UseVisualStyleBackColor = false;
+ CustomCheckBoxGeoAsset_IR_CIDRs.CheckedChanged += CustomCheckBoxGeoAsset_GeoAssets_CheckedChanged;
+ //
+ // CustomCheckBoxGeoAsset_IR_ADS
+ //
+ CustomCheckBoxGeoAsset_IR_ADS.BackColor = Color.DimGray;
+ CustomCheckBoxGeoAsset_IR_ADS.BorderColor = Color.Blue;
+ CustomCheckBoxGeoAsset_IR_ADS.CheckColor = Color.Blue;
+ CustomCheckBoxGeoAsset_IR_ADS.ForeColor = Color.White;
+ CustomCheckBoxGeoAsset_IR_ADS.Location = new Point(8, 84);
+ CustomCheckBoxGeoAsset_IR_ADS.Name = "CustomCheckBoxGeoAsset_IR_ADS";
+ CustomCheckBoxGeoAsset_IR_ADS.SelectionColor = Color.LightBlue;
+ CustomCheckBoxGeoAsset_IR_ADS.Size = new Size(145, 19);
+ CustomCheckBoxGeoAsset_IR_ADS.TabIndex = 13;
+ CustomCheckBoxGeoAsset_IR_ADS.Text = "IR Advertisement: Block";
+ CustomCheckBoxGeoAsset_IR_ADS.UseVisualStyleBackColor = false;
+ CustomCheckBoxGeoAsset_IR_ADS.CheckedChanged += CustomCheckBoxGeoAsset_GeoAssets_CheckedChanged;
+ //
+ // CustomLabelGeoAssetsSpacer2
+ //
+ CustomLabelGeoAssetsSpacer2.BackColor = Color.DimGray;
+ CustomLabelGeoAssetsSpacer2.Border = false;
+ CustomLabelGeoAssetsSpacer2.BorderColor = Color.Blue;
+ CustomLabelGeoAssetsSpacer2.FlatStyle = FlatStyle.Flat;
+ CustomLabelGeoAssetsSpacer2.ForeColor = Color.White;
+ CustomLabelGeoAssetsSpacer2.Location = new Point(8, 109);
+ CustomLabelGeoAssetsSpacer2.Margin = new Padding(3);
+ CustomLabelGeoAssetsSpacer2.Name = "CustomLabelGeoAssetsSpacer2";
+ CustomLabelGeoAssetsSpacer2.RoundedCorners = 0;
+ CustomLabelGeoAssetsSpacer2.Size = new Size(103, 20);
+ CustomLabelGeoAssetsSpacer2.TabIndex = 14;
+ CustomLabelGeoAssetsSpacer2.Text = " ";
+ //
+ // FlowLayoutPanelGeoAssets2
+ //
+ FlowLayoutPanelGeoAssets2.AutoSize = true;
+ FlowLayoutPanelGeoAssets2.Controls.Add(CustomCheckBoxGeoAssetUpdate);
+ FlowLayoutPanelGeoAssets2.Controls.Add(CustomNumericUpDownGeoAssetsUpdate);
+ FlowLayoutPanelGeoAssets2.Location = new Point(8, 135);
+ FlowLayoutPanelGeoAssets2.Name = "FlowLayoutPanelGeoAssets2";
+ FlowLayoutPanelGeoAssets2.Padding = new Padding(10);
+ FlowLayoutPanelGeoAssets2.Size = new Size(225, 49);
+ FlowLayoutPanelGeoAssets2.TabIndex = 26;
+ FlowLayoutPanelGeoAssets2.WrapContents = false;
+ //
+ // CustomCheckBoxGeoAssetUpdate
+ //
+ CustomCheckBoxGeoAssetUpdate.BackColor = Color.DimGray;
+ CustomCheckBoxGeoAssetUpdate.BorderColor = Color.Blue;
+ CustomCheckBoxGeoAssetUpdate.CheckColor = Color.Blue;
+ CustomCheckBoxGeoAssetUpdate.Checked = true;
+ CustomCheckBoxGeoAssetUpdate.CheckState = CheckState.Checked;
+ CustomCheckBoxGeoAssetUpdate.ForeColor = Color.White;
+ CustomCheckBoxGeoAssetUpdate.Location = new Point(13, 13);
+ CustomCheckBoxGeoAssetUpdate.Name = "CustomCheckBoxGeoAssetUpdate";
+ CustomCheckBoxGeoAssetUpdate.SelectionColor = Color.LightBlue;
+ CustomCheckBoxGeoAssetUpdate.Size = new Size(133, 19);
+ CustomCheckBoxGeoAssetUpdate.TabIndex = 27;
+ CustomCheckBoxGeoAssetUpdate.Text = "Auto Update (Hours):";
+ CustomCheckBoxGeoAssetUpdate.UseVisualStyleBackColor = false;
+ //
+ // CustomNumericUpDownGeoAssetsUpdate
+ //
+ CustomNumericUpDownGeoAssetsUpdate.BackColor = Color.DimGray;
+ CustomNumericUpDownGeoAssetsUpdate.BorderColor = Color.Blue;
+ CustomNumericUpDownGeoAssetsUpdate.BorderStyle = BorderStyle.FixedSingle;
+ CustomNumericUpDownGeoAssetsUpdate.Location = new Point(152, 13);
+ CustomNumericUpDownGeoAssetsUpdate.Maximum = new decimal(new int[] { 168, 0, 0, 0 });
+ CustomNumericUpDownGeoAssetsUpdate.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
+ CustomNumericUpDownGeoAssetsUpdate.Name = "CustomNumericUpDownGeoAssetsUpdate";
+ CustomNumericUpDownGeoAssetsUpdate.RoundedCorners = 5;
+ CustomNumericUpDownGeoAssetsUpdate.Size = new Size(60, 23);
+ CustomNumericUpDownGeoAssetsUpdate.TabIndex = 23;
+ CustomNumericUpDownGeoAssetsUpdate.Value = new decimal(new int[] { 24, 0, 0, 0 });
+ //
+ // CustomLabelGeoAssetsSpacer3
+ //
+ CustomLabelGeoAssetsSpacer3.BackColor = Color.DimGray;
+ CustomLabelGeoAssetsSpacer3.Border = false;
+ CustomLabelGeoAssetsSpacer3.BorderColor = Color.Blue;
+ CustomLabelGeoAssetsSpacer3.FlatStyle = FlatStyle.Flat;
+ CustomLabelGeoAssetsSpacer3.ForeColor = Color.White;
+ CustomLabelGeoAssetsSpacer3.Location = new Point(8, 190);
+ CustomLabelGeoAssetsSpacer3.Margin = new Padding(3);
+ CustomLabelGeoAssetsSpacer3.Name = "CustomLabelGeoAssetsSpacer3";
+ CustomLabelGeoAssetsSpacer3.RoundedCorners = 0;
+ CustomLabelGeoAssetsSpacer3.Size = new Size(103, 20);
+ CustomLabelGeoAssetsSpacer3.TabIndex = 25;
+ CustomLabelGeoAssetsSpacer3.Text = " ";
+ //
// TabPageSettingsCPU
//
TabPageSettingsCPU.AutoScroll = true;
@@ -4693,7 +4961,7 @@ private void InitializeComponent()
TabPageSettingsCPU.Padding = new Padding(3);
TabPageSettingsCPU.Size = new Size(518, 357);
TabPageSettingsCPU.TabIndex = 1;
- TabPageSettingsCPU.Tag = 7;
+ TabPageSettingsCPU.Tag = 9;
TabPageSettingsCPU.Text = "CPU";
TabPageSettingsCPU.Visible = false;
//
@@ -4852,7 +5120,7 @@ private void InitializeComponent()
TabPageSettingsOthers.Padding = new Padding(3);
TabPageSettingsOthers.Size = new Size(518, 357);
TabPageSettingsOthers.TabIndex = 2;
- TabPageSettingsOthers.Tag = 8;
+ TabPageSettingsOthers.Tag = 10;
TabPageSettingsOthers.Text = "Others";
TabPageSettingsOthers.Visible = false;
//
@@ -4952,7 +5220,7 @@ private void InitializeComponent()
CustomTextBoxSettingBootstrapDnsIP.RoundedCorners = 0;
CustomTextBoxSettingBootstrapDnsIP.ScrollBars = ScrollBars.None;
CustomTextBoxSettingBootstrapDnsIP.ShortcutsEnabled = true;
- CustomTextBoxSettingBootstrapDnsIP.Size = new Size(95, 23);
+ CustomTextBoxSettingBootstrapDnsIP.Size = new Size(118, 23);
CustomTextBoxSettingBootstrapDnsIP.TabIndex = 0;
CustomTextBoxSettingBootstrapDnsIP.TextAlign = HorizontalAlignment.Left;
CustomTextBoxSettingBootstrapDnsIP.Texts = "8.8.8.8";
@@ -5026,7 +5294,7 @@ private void InitializeComponent()
CustomTextBoxSettingFallbackDnsIP.RoundedCorners = 0;
CustomTextBoxSettingFallbackDnsIP.ScrollBars = ScrollBars.None;
CustomTextBoxSettingFallbackDnsIP.ShortcutsEnabled = true;
- CustomTextBoxSettingFallbackDnsIP.Size = new Size(95, 23);
+ CustomTextBoxSettingFallbackDnsIP.Size = new Size(118, 23);
CustomTextBoxSettingFallbackDnsIP.TabIndex = 0;
CustomTextBoxSettingFallbackDnsIP.TextAlign = HorizontalAlignment.Left;
CustomTextBoxSettingFallbackDnsIP.Texts = "8.8.8.8";
@@ -5181,7 +5449,7 @@ private void InitializeComponent()
CustomLabelAboutVersion.Location = new Point(600, 51);
CustomLabelAboutVersion.Name = "CustomLabelAboutVersion";
CustomLabelAboutVersion.RoundedCorners = 0;
- CustomLabelAboutVersion.Size = new Size(47, 17);
+ CustomLabelAboutVersion.Size = new Size(45, 15);
CustomLabelAboutVersion.TabIndex = 7;
CustomLabelAboutVersion.Text = "Version";
//
@@ -5206,7 +5474,7 @@ private void InitializeComponent()
CustomLabelAboutCopyright.Location = new Point(55, 185);
CustomLabelAboutCopyright.Name = "CustomLabelAboutCopyright";
CustomLabelAboutCopyright.RoundedCorners = 0;
- CustomLabelAboutCopyright.Size = new Size(146, 32);
+ CustomLabelAboutCopyright.Size = new Size(144, 30);
CustomLabelAboutCopyright.TabIndex = 11;
CustomLabelAboutCopyright.Text = "© 2023 - 2024 MSasanMH\r\nLicense: GPLv3";
//
@@ -5233,7 +5501,7 @@ private void InitializeComponent()
CustomLabelAboutSpecialThanks.Location = new Point(446, 135);
CustomLabelAboutSpecialThanks.Name = "CustomLabelAboutSpecialThanks";
CustomLabelAboutSpecialThanks.RoundedCorners = 0;
- CustomLabelAboutSpecialThanks.Size = new Size(83, 122);
+ CustomLabelAboutSpecialThanks.Size = new Size(81, 120);
CustomLabelAboutSpecialThanks.TabIndex = 9;
CustomLabelAboutSpecialThanks.Text = "special thanks\r\n{\r\n\r\n\r\n\r\n\r\n\r\n}";
//
@@ -5272,7 +5540,7 @@ private void InitializeComponent()
CustomLabelAboutUsing.Location = new Point(270, 135);
CustomLabelAboutUsing.Name = "CustomLabelAboutUsing";
CustomLabelAboutUsing.RoundedCorners = 0;
- CustomLabelAboutUsing.Size = new Size(38, 92);
+ CustomLabelAboutUsing.Size = new Size(36, 90);
CustomLabelAboutUsing.TabIndex = 8;
CustomLabelAboutUsing.Text = "using\r\n{\r\n\r\n\r\n\r\n}";
//
@@ -5287,7 +5555,7 @@ private void InitializeComponent()
CustomLabelAboutThis2.Location = new Point(235, 75);
CustomLabelAboutThis2.Name = "CustomLabelAboutThis2";
CustomLabelAboutThis2.RoundedCorners = 0;
- CustomLabelAboutThis2.Size = new Size(460, 17);
+ CustomLabelAboutThis2.Size = new Size(458, 15);
CustomLabelAboutThis2.TabIndex = 2;
CustomLabelAboutThis2.Text = "A DNS Client, Supporting Anonymized DNSCrypt, DNSCrypt, DoH, DoT, UDP and TCP.";
//
@@ -5304,7 +5572,7 @@ private void InitializeComponent()
CustomLabelAboutThis.Location = new Point(235, 33);
CustomLabelAboutThis.Name = "CustomLabelAboutThis";
CustomLabelAboutThis.RoundedCorners = 0;
- CustomLabelAboutThis.Size = new Size(369, 34);
+ CustomLabelAboutThis.Size = new Size(367, 32);
CustomLabelAboutThis.TabIndex = 1;
CustomLabelAboutThis.Text = "SDC - Secure DNS Client";
CustomLabelAboutThis.Click += CustomLabelAboutThis_Click;
@@ -5328,25 +5596,25 @@ private void InitializeComponent()
CustomDataGridViewStatus.BorderColor = Color.Blue;
CustomDataGridViewStatus.CheckColor = Color.Blue;
CustomDataGridViewStatus.ColumnHeadersBorder = true;
- dataGridViewCellStyle15.Alignment = DataGridViewContentAlignment.MiddleLeft;
- dataGridViewCellStyle15.BackColor = Color.FromArgb(73, 73, 73);
- dataGridViewCellStyle15.Font = new Font("Segoe UI", 9F);
- dataGridViewCellStyle15.ForeColor = Color.White;
- dataGridViewCellStyle15.SelectionBackColor = Color.FromArgb(73, 73, 73);
- dataGridViewCellStyle15.SelectionForeColor = Color.White;
- dataGridViewCellStyle15.WrapMode = DataGridViewTriState.True;
- CustomDataGridViewStatus.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle15;
+ dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle3.BackColor = Color.FromArgb(73, 73, 73);
+ dataGridViewCellStyle3.Font = new Font("Segoe UI", 9F);
+ dataGridViewCellStyle3.ForeColor = Color.White;
+ dataGridViewCellStyle3.SelectionBackColor = Color.FromArgb(73, 73, 73);
+ dataGridViewCellStyle3.SelectionForeColor = Color.White;
+ dataGridViewCellStyle3.WrapMode = DataGridViewTriState.True;
+ CustomDataGridViewStatus.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3;
CustomDataGridViewStatus.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
CustomDataGridViewStatus.ColumnHeadersVisible = false;
CustomDataGridViewStatus.Columns.AddRange(new DataGridViewColumn[] { ColumnStatusName, ColumnStatusText });
- dataGridViewCellStyle16.Alignment = DataGridViewContentAlignment.MiddleLeft;
- dataGridViewCellStyle16.BackColor = Color.DimGray;
- dataGridViewCellStyle16.Font = new Font("Segoe UI", 9F);
- dataGridViewCellStyle16.ForeColor = Color.White;
- dataGridViewCellStyle16.SelectionBackColor = Color.FromArgb(97, 177, 255);
- dataGridViewCellStyle16.SelectionForeColor = Color.White;
- dataGridViewCellStyle16.WrapMode = DataGridViewTriState.False;
- CustomDataGridViewStatus.DefaultCellStyle = dataGridViewCellStyle16;
+ dataGridViewCellStyle4.Alignment = DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle4.BackColor = Color.DimGray;
+ dataGridViewCellStyle4.Font = new Font("Segoe UI", 9F);
+ dataGridViewCellStyle4.ForeColor = Color.White;
+ dataGridViewCellStyle4.SelectionBackColor = Color.FromArgb(97, 177, 255);
+ dataGridViewCellStyle4.SelectionForeColor = Color.White;
+ dataGridViewCellStyle4.WrapMode = DataGridViewTriState.False;
+ CustomDataGridViewStatus.DefaultCellStyle = dataGridViewCellStyle4;
CustomDataGridViewStatus.Dock = DockStyle.Fill;
CustomDataGridViewStatus.GridColor = Color.LightBlue;
CustomDataGridViewStatus.Location = new Point(0, 0);
@@ -5654,10 +5922,20 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)CustomNumericUpDownSettingProxyUpstreamPort).EndInit();
((System.ComponentModel.ISupportInitialize)CustomNumericUpDownSettingProxyPort).EndInit();
((System.ComponentModel.ISupportInitialize)CustomNumericUpDownSettingProxyHandleRequests).EndInit();
- TabPageSettingProxyAdvanced.ResumeLayout(false);
- TabPageSettingProxyAdvanced.PerformLayout();
TabPageSettingsFakeProxy.ResumeLayout(false);
TabPageSettingsFakeProxy.PerformLayout();
+ TabPageSettingsRules.ResumeLayout(false);
+ TabPageSettingsRules.PerformLayout();
+ FlowLayoutPanelRules.ResumeLayout(false);
+ FlowLayoutPanelRules.PerformLayout();
+ FlowLayoutPanelRules2.ResumeLayout(false);
+ FlowLayoutPanelRules3.ResumeLayout(false);
+ FlowLayoutPanelRules3.PerformLayout();
+ TabPageSettingsGeoAssets.ResumeLayout(false);
+ FlowLayoutPanelGeoAssets.ResumeLayout(false);
+ FlowLayoutPanelGeoAssets.PerformLayout();
+ FlowLayoutPanelGeoAssets2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)CustomNumericUpDownGeoAssetsUpdate).EndInit();
TabPageSettingsCPU.ResumeLayout(false);
TabPageSettingsCPU.PerformLayout();
((System.ComponentModel.ISupportInitialize)CustomNumericUpDownUpdateAutoDelayMS).EndInit();
@@ -5844,12 +6122,6 @@ private void InitializeComponent()
private CustomControls.CustomButton CustomButtonSettingUninstallCertificate;
private CustomControls.CustomLabel CustomLabelAboutCopyright;
private CustomControls.CustomRadioButton CustomRadioButtonConnectFakeProxyDohViaProxyDPI;
- private CustomControls.CustomTextBox CustomTextBoxSettingProxyCfCleanIP;
- private CustomControls.CustomCheckBox CustomCheckBoxSettingProxyCfCleanIP;
- private CustomControls.CustomCheckBox CustomCheckBoxSettingProxyEnableRules;
- private CustomControls.CustomLabel CustomLabelSettingProxyRules;
- private CustomControls.CustomButton CustomButtonSettingProxyRules;
- private CustomControls.CustomLabel CustomLabelSettingShareSeparator1;
private TabPage TabPageSettingsFakeProxy;
private CustomControls.CustomLabel CustomLabelSettingFakeProxyInfo;
private CustomControls.CustomLabel CustomLabelSettingFakeProxyDohCleanIP;
@@ -5861,7 +6133,6 @@ private void InitializeComponent()
private CustomControls.CustomButton CustomButtonWriteSavedServersDelay;
private CustomControls.CustomTabControl CustomTabControlSettingProxy;
private TabPage TabPageSettingProxyBasic;
- private TabPage TabPageSettingProxyAdvanced;
private CustomControls.CustomCheckBox CustomCheckBoxSettingProxyUpstream;
private CustomControls.CustomComboBox CustomComboBoxSettingProxyUpstreamMode;
private CustomControls.CustomLabel CustomLabelSettingProxyUpstreamPort;
@@ -5987,10 +6258,33 @@ private void InitializeComponent()
private CustomControls.CustomLabel CustomLabelSetDnsSpacer1;
private CustomControls.CustomLabel CustomLabelSetDnsSpacer2;
private CustomControls.CustomButton CustomButtonEnableDisableNicIPv6;
- private CustomControls.CustomCheckBox CustomCheckBoxSettingDnsEnableRules;
- private CustomControls.CustomButton CustomButtonSettingDnsRules;
private CustomControls.CustomCheckBox CustomCheckBoxDnsEventShowRequest;
private LinkLabel LinkLabelStNonbarbari;
private CustomControls.CustomCheckBox CustomCheckBoxSettingConnectRetry;
+ private TabPage TabPageSettingsGeoAssets;
+ private FlowLayoutPanel FlowLayoutPanelGeoAssets;
+ private CustomControls.CustomLabel CustomLabelGeoAssetsSpacer1;
+ private CustomControls.CustomCheckBox CustomCheckBoxGeoAsset_IR_Domains;
+ private CustomControls.CustomCheckBox CustomCheckBoxGeoAsset_IR_CIDRs;
+ private CustomControls.CustomCheckBox CustomCheckBoxGeoAsset_IR_ADS;
+ private CustomControls.CustomLabel CustomLabelGeoAssetsSpacer2;
+ private CustomControls.CustomNumericUpDown CustomNumericUpDownGeoAssetsUpdate;
+ private TableLayoutPanel TableLayoutPanelGeoAssets;
+ private CustomControls.CustomLabel CustomLabelGeoAssetsSpacer3;
+ private FlowLayoutPanel FlowLayoutPanelGeoAssets2;
+ private CustomControls.CustomCheckBox CustomCheckBoxGeoAssetUpdate;
+ private TabPage TabPageSettingsRules;
+ private FlowLayoutPanel FlowLayoutPanelRules;
+ private FlowLayoutPanel FlowLayoutPanelRules2;
+ private CustomControls.CustomCheckBox CustomCheckBoxSettingProxyCfCleanIP;
+ private CustomControls.CustomTextBox CustomTextBoxSettingProxyCfCleanIP;
+ private FlowLayoutPanel FlowLayoutPanelRules3;
+ private CustomControls.CustomCheckBox CustomCheckBoxSettingEnableRules;
+ private CustomControls.CustomButton CustomButtonSettingRules;
+ private CustomControls.CustomTextBox CustomTextBoxSettingUnsetDnsIPv6_1;
+ private CustomControls.CustomLabel CustomLabelSettingUnsetDnsIPv6_2;
+ private CustomControls.CustomLabel CustomLabelSettingUnsetDnsIPv6_1;
+ private CustomControls.CustomTextBox CustomTextBoxSettingUnsetDnsIPv6_2;
+ private LinkLabel LinkLabelSettingRulesHelp;
}
}
\ No newline at end of file
diff --git a/SecureDNSClient/Forms/FormMain.cs b/SecureDNSClient/Forms/FormMain.cs
index e7d4c30..3d85e98 100644
--- a/SecureDNSClient/Forms/FormMain.cs
+++ b/SecureDNSClient/Forms/FormMain.cs
@@ -115,8 +115,9 @@ static string getArchText(Architecture archOs, Architecture archProcess)
// Set NotifyIcon Text
NotifyIconMain.Text = Text;
- // Create User Dir if not Exist
+ // Create UserData & Assets Dir If Not Exist
FileDirectory.CreateEmptyDirectory(SecureDNS.UserDataDirPath);
+ FileDirectory.CreateEmptyDirectory(SecureDNS.AssetDirPath);
// Move User Data and Certificate to the new location
await MoveToNewLocationAsync();
@@ -138,10 +139,10 @@ static string getArchText(Architecture archOs, Architecture archProcess)
SplitContainerMain.BackColor = Color.IndianRed; // Drag Bar Color
CustomTextBoxHTTPProxy.Enabled = true; // Connect -> Method 4
CustomCheckBoxSettingQcSetProxy.Enabled = CustomCheckBoxSettingQcStartProxyServer.Checked; // Setting -> Qc -> Set Proxy
- CustomTextBoxSettingProxyCfCleanIP.Enabled = CustomCheckBoxSettingProxyCfCleanIP.Checked; // Setting -> Share -> Advanced -> Cf Clean IP
// Convert Old Proxy ProxyRules To New
- OldProxyRulesToNew();
+ await OldProxyRulesToNewAsync();
+ await MergeOldDnsAndProxyRulesAsync();
// Initialize Status
InitializeStatus(CustomDataGridViewStatus);
@@ -238,11 +239,11 @@ private void ShowLabelMain(string text)
this.InvokeIt(() =>
{
if (!IsAppReady) text = "Getting Ready...";
- SplitContainerMain.Visible = false;
LabelMain.Text = text;
LabelMain.Visible = true;
LabelMain.BringToFront();
LabelMainStopWatch.Restart();
+ SplitContainerMain.Visible = false;
});
}
@@ -265,9 +266,9 @@ private void HideLabelMain()
if (!LabelMain.Visible) return;
this.InvokeIt(() =>
{
+ SplitContainerMain.Visible = true;
LabelMain.Visible = false;
LabelMain.SendToBack();
- SplitContainerMain.Visible = true;
});
}
@@ -585,10 +586,42 @@ private void CustomCheckBoxSettingQcStartProxyServer_CheckedChanged(object sende
this.InvokeIt(() => CustomCheckBoxSettingQcSetProxy.Enabled = CustomCheckBoxSettingQcStartProxyServer.Checked);
}
- // Settings -> Share -> Advanced
- private void CustomCheckBoxSettingProxyCfCleanIP_CheckedChanged(object sender, EventArgs e)
+ // Settings -> Rules
+ private void LinkLabelSettingRulesHelp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
- this.InvokeIt(() => CustomTextBoxSettingProxyCfCleanIP.Enabled = CustomCheckBoxSettingProxyCfCleanIP.Checked);
+ OpenLinks.OpenUrl("https://github.com/msasanmh/SecureDNSClient/blob/main/README.md#sdc-text-based-rules");
+ }
+
+ // Settings -> Geo Assets
+ private async void CustomCheckBoxGeoAsset_GeoAssets_CheckedChanged(object sender, EventArgs e)
+ {
+ try
+ {
+ if (sender is not CustomCheckBox ccb) return;
+ if (ccb.Checked)
+ {
+ // Get Controls
+ List controls = Controllers.GetChildControls(FlowLayoutPanelGeoAssets);
+
+ this.InvokeIt(() =>
+ {
+ foreach (Control control in controls)
+ if (control is CustomCheckBox cb) cb.Enabled = false;
+ });
+
+ await Assets_Download_Async();
+
+ this.InvokeIt(() =>
+ {
+ foreach (Control control in controls)
+ if (control is CustomCheckBox cb) cb.Enabled = true;
+ });
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("CustomCheckBoxGeoAsset_GeoAssets_CheckedChanged: " + ex.Message);
+ }
}
// Settings -> CPU
@@ -695,4 +728,5 @@ private void LinkLabelStNonbarbari_LinkClicked(object sender, LinkLabelLinkClick
{
OpenLinks.OpenUrl("https://github.com/nonbarbari");
}
+
}
\ No newline at end of file
diff --git a/SecureDNSClient/Forms/FormMain.resx b/SecureDNSClient/Forms/FormMain.resx
index 7300a97..22ebbde 100644
--- a/SecureDNSClient/Forms/FormMain.resx
+++ b/SecureDNSClient/Forms/FormMain.resx
@@ -117,22 +117,6 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- Syntax example:
-
- // Fake DNS:
- dns.google.com|8.8.8.8;
- // DNS:
- *.example.com|dns:udp://1.1.1.1;
- // Fake SNI:
- youtube.com|sni:google.com;
- // Block a domain:
- example.com|-;
- // Don't Bypass
- stackoverflow.com|--;
- // Mix Rules:
- *|dns:tcp://8.8.8.8:53; sni:speedtest.com;
-
563, 2237
diff --git a/SecureDNSClient/Forms/InitializeStatements.cs b/SecureDNSClient/Forms/InitializeStatements.cs
index e93fb6d..8be65a2 100644
--- a/SecureDNSClient/Forms/InitializeStatements.cs
+++ b/SecureDNSClient/Forms/InitializeStatements.cs
@@ -102,7 +102,7 @@ public partial class FormMain : Form
private bool IsProxyDpiBypassActive { get; set; } = false;
private bool IsProxyFragmentActive { get; set; } = false;
private AgnosticProgram.Fragment.Mode ProxyFragmentMode { get; set; } = AgnosticProgram.Fragment.Mode.Disable;
- private AgnosticProgram.ProxyRules.Mode ProxyRulesMode { get; set; } = AgnosticProgram.ProxyRules.Mode.Disable;
+ private AgnosticProgram.Rules.Mode RulesMode { get; set; } = AgnosticProgram.Rules.Mode.Disable;
private bool IsProxySSLDecryptionActive { get; set; } = false;
private bool IsProxySSLChangeSniActive { get; set; } = false;
private bool IsProxySet { get; set; } = false;
@@ -111,9 +111,9 @@ public partial class FormMain : Form
private static bool UpdateProxyBools { get; set; } = true;
private string LastFragmentProgramCommand { get; set; } = string.Empty;
private string LastDefaultSni { get; set; } = string.Empty;
- private AgnosticProgram.ProxyRules CheckProxyRules { get; set; } = new();
- private string LastProxyRulesPath { get; set; } = string.Empty;
- private string LastProxyRulesContent { get; set; } = string.Empty;
+ private AgnosticProgram.Rules CheckRules { get; set; } = new();
+ private string LastRulesPath { get; set; } = string.Empty;
+ private string LastRulesContent { get; set; } = string.Empty;
// GoodbyeDPI
private static int PIDGoodbyeDPIBasic { get; set; } = -1;
diff --git a/SecureDNSClient/Forms/Methods.cs b/SecureDNSClient/Forms/Methods.cs
index 39f0367..e40aeef 100644
--- a/SecureDNSClient/Forms/Methods.cs
+++ b/SecureDNSClient/Forms/Methods.cs
@@ -1,7 +1,9 @@
using CustomControls;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.Win32;
using Microsoft.Win32.TaskScheduler;
using MsmhToolsClass;
+using MsmhToolsClass.MsmhAgnosticServer;
using MsmhToolsWinFormsClass;
using MsmhToolsWinFormsClass.Themes;
using SecureDNSClient.DPIBasic;
@@ -9,7 +11,6 @@
using System.Net;
using System.Reflection;
using System.Text;
-using System.Threading;
using Task = System.Threading.Tasks.Task;
namespace SecureDNSClient;
@@ -24,39 +25,46 @@ private async Task LogToDebugFileAsync(string message)
private async Task LoadThemeAsync()
{
- if (!IsThemeApplied || !IsScreenHighDpiScaleApplied)
+ try
{
- Theme.LoadTheme(this, Theme.Themes.Dark);
- Theme.SetColors(LabelMain);
- CustomMessageBox.FormIcon = Properties.Resources.SecureDNSClient_Icon_Multi;
- await Task.Delay(10);
- List controls = Controllers.GetAllControls(this);
- for (int i = 0; i < controls.Count; i++)
+ if (!IsThemeApplied || !IsScreenHighDpiScaleApplied)
{
- Control c = controls[i];
- if (c is SplitContainer sc)
- if (sc.Name.EndsWith("Main"))
- this.InvokeIt(() => sc.Panel2.BackColor = BackColor.ChangeBrightness(-0.2f));
- }
- this.InvokeIt(() => CustomCheckBoxSettingQcOnStartup.BackColor = BackColor.ChangeBrightness(-0.2f));
- await ScreenHighDpiScaleStartup(this);
+ Theme.LoadTheme(this, Theme.Themes.Dark);
+ Theme.SetColors(LabelMain);
+ CustomMessageBox.FormIcon = Properties.Resources.SecureDNSClient_Icon_Multi;
+ await Task.Delay(10);
+ List controls = Controllers.GetAllControls(this);
+ for (int i = 0; i < controls.Count; i++)
+ {
+ Control c = controls[i];
+ if (c is SplitContainer sc)
+ if (sc.Name.EndsWith("Main"))
+ this.InvokeIt(() => sc.Panel2.BackColor = BackColor.ChangeBrightness(-0.2f));
+ }
+ this.InvokeIt(() => CustomCheckBoxSettingQcOnStartup.BackColor = BackColor.ChangeBrightness(-0.2f));
+ await ScreenHighDpiScaleStartup(this);
- // Add colors and texts to About page
- this.InvokeIt(() =>
- {
- CustomLabelAboutThis.ForeColor = Color.DodgerBlue;
- string aboutVer = $"v{Info.GetAppInfo(Assembly.GetExecutingAssembly()).ProductVersion} ({ArchProcess.ToString().ToLower()})";
- CustomLabelAboutVersion.Text = aboutVer;
- CustomLabelAboutThis2.ForeColor = Color.IndianRed;
- });
+ // Add colors and texts to About page
+ this.InvokeIt(() =>
+ {
+ CustomLabelAboutThis.ForeColor = Color.DodgerBlue;
+ string aboutVer = $"v{Info.GetAppInfo(Assembly.GetExecutingAssembly()).ProductVersion} ({ArchProcess.ToString().ToLower()})";
+ CustomLabelAboutVersion.Text = aboutVer;
+ CustomLabelAboutThis2.ForeColor = Color.IndianRed;
+ });
- Controllers.SetDarkControl(this);
+ Controllers.SetDarkControl(this);
- // Wait
- //Debug.WriteLine("All Controls: " + controls.Count);
- await Task.Delay(controls.Count);
+ // Wait
+ //Debug.WriteLine("All Controls: " + controls.Count);
+ await Task.Delay(controls.Count);
- IsThemeApplied = true;
+ IsThemeApplied = true;
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Methods LoadThemeAsync: " + ex.Message);
}
}
@@ -112,73 +120,87 @@ public async void GetAppReady()
{
await Task.Run(async () =>
{
- IsAppReady = false;
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"Waiting For Network...{NL}", Color.Gray));
- while (true)
+ try
{
- await Task.Delay(1000);
- IPAddress bootstrapIP = GetBootstrapSetting(out _);
- await UpdateBoolInternetStateAsync();
- IsAppReady = NetState == NetworkTool.InternetState.Online;
- if (IsAppReady) break;
+ IsAppReady = false;
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"Waiting For Network...{NL}", Color.Gray));
+ while (true)
+ {
+ await Task.Delay(1000);
+ IPAddress bootstrapIP = GetBootstrapSetting(out _);
+ await UpdateBoolInternetStateAsync();
+ IsAppReady = NetState == NetworkTool.InternetState.Online;
+ if (IsAppReady) break;
+ }
+ string msgReady = $"Network Detected (Up Time: {ConvertTool.TimeSpanToHumanRead(AppUpTime.Elapsed, true)}){NL}";
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgReady, Color.Gray));
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Methods GetAppReady: " + ex.Message);
}
- string msgReady = $"Network Detected (Up Time: {ConvertTool.TimeSpanToHumanRead(AppUpTime.Elapsed, true)}){NL}";
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgReady, Color.Gray));
});
}
public async void StartupTask()
{
- StartupTaskExecuted = true;
+ try
+ {
+ StartupTaskExecuted = true;
- string msgStartup = $"Startup Task Executed (Up Time: {ConvertTool.TimeSpanToHumanRead(AppUpTime.Elapsed, true)}){NL}";
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgStartup, Color.Orange));
+ string msgStartup = $"Startup Task Executed (Up Time: {ConvertTool.TimeSpanToHumanRead(AppUpTime.Elapsed, true)}){NL}";
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgStartup, Color.Orange));
- Hide();
- Opacity = 0;
- bool cancel = false;
+ Hide();
+ Opacity = 0;
+ bool cancel = false;
- // Wait for Startup Delay
- Task wait = Task.Run(async () =>
- {
- while (true)
+ // Wait for Startup Delay
+ Task wait = Task.Run(async () =>
{
- if (IsCheckingStarted || IsConnecting || IsQuickConnecting || IsExiting)
+ while (true)
{
- cancel = true;
- break;
+ if (IsCheckingStarted || IsConnecting || IsQuickConnecting || IsExiting)
+ {
+ cancel = true;
+ break;
+ }
+ await Task.Delay(100);
}
- await Task.Delay(100);
- }
- });
- if (Program.StartupDelaySec > 0)
- try { await wait.WaitAsync(TimeSpan.FromSeconds(Program.StartupDelaySec)); } catch (Exception) { }
+ });
+ if (Program.StartupDelaySec > 0)
+ try { await wait.WaitAsync(TimeSpan.FromSeconds(Program.StartupDelaySec)); } catch (Exception) { }
- if (cancel) return;
+ if (cancel) return;
- // Wait Until App Is Ready
- Task waitNet = Task.Run(async () =>
- {
- while (true)
+ // Wait Until App Is Ready
+ Task waitNet = Task.Run(async () =>
{
- if (IsAppReady) break;
- if (IsCheckingStarted || IsConnecting || IsQuickConnecting || IsExiting)
+ while (true)
{
- cancel = true;
- break;
+ if (IsAppReady) break;
+ if (IsCheckingStarted || IsConnecting || IsQuickConnecting || IsExiting)
+ {
+ cancel = true;
+ break;
+ }
+ await Task.Delay(500);
}
- await Task.Delay(500);
- }
- });
- try { await waitNet.WaitAsync(CancellationToken.None); } catch (Exception) { }
+ });
+ try { await waitNet.WaitAsync(CancellationToken.None); } catch (Exception) { }
- if (cancel) return;
+ if (cancel) return;
- // Update NICs
- await SetDnsOnNic_.UpdateNICs(CustomComboBoxNICs, GetBootstrapSetting(out int port), port);
+ // Update NICs
+ await SetDnsOnNic_.UpdateNICs(CustomComboBoxNICs, GetBootstrapSetting(out int port), port);
- // Start Quick Connect (To User AgnosticSettings)
- QcToUserSetting_Click(null, EventArgs.Empty);
+ // Start Quick Connect (To User AgnosticSettings)
+ QcToUserSetting_Click(null, EventArgs.Empty);
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Methods StartupTask: " + ex.Message);
+ }
}
public static bool IsAppOnWindowsStartup(out bool isPathOk)
@@ -232,7 +254,7 @@ public static bool IsAppOnWindowsStartup(out bool isPathOk)
}
catch (Exception ex)
{
- Debug.WriteLine("IsAppOnWindowsStartup: " + ex.Message);
+ Debug.WriteLine("Methods IsAppOnWindowsStartup: " + ex.Message);
}
return isTaskExist;
@@ -266,51 +288,67 @@ public static void ActivateWindowsStartup(bool active)
}
catch (Exception ex)
{
- Debug.WriteLine("ActivateWindowsStartup: " + ex.Message);
+ Debug.WriteLine("Methods ActivateWindowsStartup: " + ex.Message);
}
}
public static bool IsAppOnWindowsStartupRegistry(out bool isPathOk)
{
isPathOk = false;
- string appName = "SecureDnsClient";
- string prefix = "cmd /c start \"SDC\" /b ";
- string appPath = $"\"{Path.GetFullPath(Application.ExecutablePath)}\"";
- string regPath = "Software\\Microsoft\\Windows\\CurrentVersion\\Run";
- RegistryKey? registry = Registry.CurrentUser.OpenSubKey(regPath, false);
- if (registry == null) return false;
- object? exist = registry.GetValue(appName, "false");
- if (exist == null) return false;
- if (exist.Equals("false")) return false;
- string? existStr = exist as string;
- if (!string.IsNullOrEmpty(existStr))
+
+ try
+ {
+ string appName = "SecureDnsClient";
+ string prefix = "cmd /c start \"SDC\" /b ";
+ string appPath = $"\"{Path.GetFullPath(Application.ExecutablePath)}\"";
+ string regPath = "Software\\Microsoft\\Windows\\CurrentVersion\\Run";
+ RegistryKey? registry = Registry.CurrentUser.OpenSubKey(regPath, false);
+ if (registry == null) return false;
+ object? exist = registry.GetValue(appName, "false");
+ if (exist == null) return false;
+ if (exist.Equals("false")) return false;
+ string? existStr = exist as string;
+ if (!string.IsNullOrEmpty(existStr))
+ {
+ if (existStr.StartsWith(prefix)) existStr = existStr[prefix.Length..];
+ if (existStr.Contains("\" "))
+ existStr = $"{existStr.Split("\" ")[0]}\"";
+ if (existStr.Equals(appPath)) isPathOk = true;
+ }
+
+ try { registry.Dispose(); } catch (Exception) { }
+ }
+ catch (Exception ex)
{
- if (existStr.StartsWith(prefix)) existStr = existStr[prefix.Length..];
- if (existStr.Contains("\" "))
- existStr = $"{existStr.Split("\" ")[0]}\"";
- if (existStr.Equals(appPath)) isPathOk = true;
+ Debug.WriteLine("Methods IsAppOnWindowsStartupRegistry: " + ex.Message);
}
- try { registry.Dispose(); } catch (Exception) { }
return true;
}
public static void ActivateWindowsStartupRegistry(bool active)
{
- int startupDelay = 5;
- string appName = "SecureDnsClient";
- string prefix = "cmd /c start \"SDC\" /b ";
- string args = $"{prefix}\"{Path.GetFullPath(Application.ExecutablePath)}\" startup {startupDelay}";
- string regPath = "Software\\Microsoft\\Windows\\CurrentVersion\\Run";
- RegistryKey? registry = Registry.CurrentUser.OpenSubKey(regPath, true);
- if (registry != null)
+ try
{
- if (active)
- registry.SetValue(appName, args);
- else
- registry.DeleteValue(appName, false);
+ int startupDelay = 5;
+ string appName = "SecureDnsClient";
+ string prefix = "cmd /c start \"SDC\" /b ";
+ string args = $"{prefix}\"{Path.GetFullPath(Application.ExecutablePath)}\" startup {startupDelay}";
+ string regPath = "Software\\Microsoft\\Windows\\CurrentVersion\\Run";
+ RegistryKey? registry = Registry.CurrentUser.OpenSubKey(regPath, true);
+ if (registry != null)
+ {
+ if (active)
+ registry.SetValue(appName, args);
+ else
+ registry.DeleteValue(appName, false);
- try { registry.Dispose(); } catch (Exception) { }
+ try { registry.Dispose(); } catch (Exception) { }
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Methods ActivateWindowsStartupRegistry: " + ex.Message);
}
}
@@ -419,92 +457,108 @@ private static void DeleteFileOnSize(string filePath, int sizeKB)
}
catch (Exception ex)
{
- Debug.WriteLine($"Delete {Path.GetFileName(filePath)} File: {ex.Message}");
+ Debug.WriteLine($"Methods DeleteFileOnSize {Path.GetFileName(filePath)} File: {ex.Message}");
}
}
private async Task FlushDNSAsync(bool flush, bool register, bool release, bool renew, bool showMsg)
{
- if (IsFlushingDns) return;
- if (flush == false && register == false && release == false && renew == false) return;
- IsFlushingDns = true;
- string remove = "Windows IP Configuration";
- await Task.Run(async () =>
+ try
{
- string msg = $"{NL}Flushing DNS...{NL}";
- if (showMsg) this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msg, Color.MediumSeaGreen));
-
- if (flush)
+ if (IsFlushingDns) return;
+ if (flush == false && register == false && release == false && renew == false) return;
+ IsFlushingDns = true;
+ string remove = "Windows IP Configuration";
+ await Task.Run(async () =>
{
- msg = await ProcessManager.ExecuteAsync("ipconfig", null, "/flushdns", true, true);
- if (showMsg)
- {
- if (msg.Contains(remove)) msg = msg.Replace(remove, string.Empty);
- msg = msg.Replace(Environment.NewLine, string.Empty);
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"Flush: ", Color.DodgerBlue));
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"{msg}{NL}", Color.LightGray));
- }
-
- if (IsDNSConnected && !IsExiting) await DnsConsole.SendCommandAsync("flush");
- if (IsProxyRunning && !IsExiting)
+ string msg = $"{NL}Flushing DNS...{NL}";
+ if (showMsg) this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msg, Color.MediumSeaGreen));
+
+ if (flush)
{
- UpdateProxyBools = false;
- await ProxyConsole.SendCommandAsync("flush");
- UpdateProxyBools = true;
+ msg = await ProcessManager.ExecuteAsync("ipconfig", null, "/flushdns", true, true);
+ if (showMsg)
+ {
+ if (msg.Contains(remove)) msg = msg.Replace(remove, string.Empty);
+ msg = msg.Replace(Environment.NewLine, string.Empty);
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"Flush: ", Color.DodgerBlue));
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"{msg}{NL}", Color.LightGray));
+ }
+
+ if (IsDNSConnected && !IsExiting) await DnsConsole.SendCommandAsync("flush");
+ if (IsProxyRunning && !IsExiting)
+ {
+ UpdateProxyBools = false;
+ await ProxyConsole.SendCommandAsync("flush");
+ UpdateProxyBools = true;
+ }
}
- }
-
- if (register)
- {
- msg = await ProcessManager.ExecuteAsync("ipconfig", null, "/registerdns", true, true);
- if (showMsg)
+
+ if (register)
{
- if (msg.Contains(remove)) msg = msg.Replace(remove, string.Empty);
- msg = msg.Replace(Environment.NewLine, string.Empty);
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"Register: ", Color.DodgerBlue));
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"{msg}{NL}", Color.LightGray));
+ msg = await ProcessManager.ExecuteAsync("ipconfig", null, "/registerdns", true, true);
+ if (showMsg)
+ {
+ if (msg.Contains(remove)) msg = msg.Replace(remove, string.Empty);
+ msg = msg.Replace(Environment.NewLine, string.Empty);
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"Register: ", Color.DodgerBlue));
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"{msg}{NL}", Color.LightGray));
+ }
}
- }
-
- if (release)
- {
- msg = await ProcessManager.ExecuteAsync("ipconfig", null, "/release", true, true);
- if (showMsg)
+
+ if (release)
{
- if (msg.Contains(remove)) msg = msg.Replace(remove, string.Empty);
- msg = msg.Replace(Environment.NewLine, string.Empty);
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"Release: ", Color.DodgerBlue));
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"{msg}{NL}", Color.LightGray));
+ msg = await ProcessManager.ExecuteAsync("ipconfig", null, "/release", true, true);
+ if (showMsg)
+ {
+ if (msg.Contains(remove)) msg = msg.Replace(remove, string.Empty);
+ msg = msg.Replace(Environment.NewLine, string.Empty);
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"Release: ", Color.DodgerBlue));
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"{msg}{NL}", Color.LightGray));
+ }
}
- }
-
- if (renew)
- {
- msg = await ProcessManager.ExecuteAsync("ipconfig", null, "/renew", true, true);
- if (showMsg)
+
+ if (renew)
{
- if (msg.Contains(remove)) msg = msg.Replace(remove, string.Empty);
- msg = msg.Replace(Environment.NewLine, string.Empty);
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"Renew: ", Color.DodgerBlue));
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"{msg}{NL}", Color.LightGray));
+ msg = await ProcessManager.ExecuteAsync("ipconfig", null, "/renew", true, true);
+ if (showMsg)
+ {
+ if (msg.Contains(remove)) msg = msg.Replace(remove, string.Empty);
+ msg = msg.Replace(Environment.NewLine, string.Empty);
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"Renew: ", Color.DodgerBlue));
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText($"{msg}{NL}", Color.LightGray));
+ }
}
- }
-
- //ProcessManager.Execute("netsh", "winsock reset"); // Needs PC Restart
- msg = $"Dns Flushed Successfully.{NL}";
- if (showMsg) this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msg, Color.MediumSeaGreen));
- });
- IsFlushingDns = false;
+ //ProcessManager.Execute("netsh", "winsock reset"); // Needs PC Restart
+
+ msg = $"Dns Flushed Successfully.{NL}";
+ if (showMsg) this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msg, Color.MediumSeaGreen));
+ });
+ IsFlushingDns = false;
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Methods FlushDNSAsync: " + ex.Message);
+ }
}
public static List GetPids(bool includeGoodbyeDpi)
{
List list = new();
- int[] pids = { Environment.ProcessId, PIDDnsServer, PIDProxyServer };
- int[] pidsGD = { PIDGoodbyeDPIBasic, PIDGoodbyeDPIAdvanced, PIDGoodbyeDPIBypass };
- list.AddRange(pids);
- if (includeGoodbyeDpi) list.AddRange(pidsGD);
+
+ try
+ {
+ int[] pids = { Environment.ProcessId, PIDDnsServer, PIDProxyServer };
+ int[] pidsGD = { PIDGoodbyeDPIBasic, PIDGoodbyeDPIAdvanced, PIDGoodbyeDPIBypass };
+ list.AddRange(pids);
+ if (includeGoodbyeDpi) list.AddRange(pidsGD);
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Methods GetPids: " + ex.Message);
+ }
+
return list.Distinct().ToList();
}
@@ -542,323 +596,370 @@ await Task.Run(async () =>
}
catch (Exception ex)
{
- Debug.WriteLine("KillAll: " + ex.Message);
+ Debug.WriteLine("Methods KillAll: " + ex.Message);
}
});
}
public ProcessPriorityClass GetCPUPriority()
{
- if (CustomRadioButtonSettingCPUHigh.Checked)
- return ProcessPriorityClass.High;
- else if (CustomRadioButtonSettingCPUAboveNormal.Checked)
- return ProcessPriorityClass.AboveNormal;
- else if (CustomRadioButtonSettingCPUNormal.Checked)
- return ProcessPriorityClass.Normal;
- else if (CustomRadioButtonSettingCPUBelowNormal.Checked)
- return ProcessPriorityClass.BelowNormal;
- else if (CustomRadioButtonSettingCPULow.Checked)
- return ProcessPriorityClass.Idle;
- else
+ try
+ {
+ if (CustomRadioButtonSettingCPUHigh.Checked)
+ return ProcessPriorityClass.High;
+ else if (CustomRadioButtonSettingCPUAboveNormal.Checked)
+ return ProcessPriorityClass.AboveNormal;
+ else if (CustomRadioButtonSettingCPUNormal.Checked)
+ return ProcessPriorityClass.Normal;
+ else if (CustomRadioButtonSettingCPUBelowNormal.Checked)
+ return ProcessPriorityClass.BelowNormal;
+ else if (CustomRadioButtonSettingCPULow.Checked)
+ return ProcessPriorityClass.Idle;
+ else
+ return ProcessPriorityClass.Normal;
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Methods GetCPUPriority: " + ex.Message);
return ProcessPriorityClass.Normal;
+ }
}
public static bool IsDnsProtocolSupported(string dns)
{
- dns = dns.Trim();
- StringComparison sc = StringComparison.OrdinalIgnoreCase;
- if (dns.StartsWith("udp://", sc) || dns.StartsWith("tcp://", sc) || dns.StartsWith("http://", sc) || dns.StartsWith("https://", sc) ||
- dns.StartsWith("h3://", sc) || dns.StartsWith("tls://", sc) || dns.StartsWith("quic://", sc) || dns.StartsWith("sdns://", sc))
- return true;
- else
- return isPlainDnsWithUnusualPort(dns);
-
- static bool isPlainDnsWithUnusualPort(string dns) // Support for plain DNS with unusual port
+ try
{
- if (dns.Contains(':'))
+ dns = dns.Trim();
+ StringComparison sc = StringComparison.OrdinalIgnoreCase;
+ if (dns.StartsWith("udp://", sc) || dns.StartsWith("tcp://", sc) || dns.StartsWith("http://", sc) || dns.StartsWith("https://", sc) ||
+ dns.StartsWith("h3://", sc) || dns.StartsWith("tls://", sc) || dns.StartsWith("quic://", sc) || dns.StartsWith("sdns://", sc))
+ return true;
+ else
+ return isPlainDnsWithUnusualPort(dns);
+
+ static bool isPlainDnsWithUnusualPort(string dns) // Support for plain DNS with unusual port
{
- NetworkTool.GetUrlDetails(dns, 53, out _, out string ipStr, out _, out _, out int port, out _, out _);
- if (NetworkTool.IsIp(ipStr, out _)) return port >= 1 && port <= 65535;
+ if (dns.Contains(':'))
+ {
+ NetworkTool.GetUrlDetails(dns, 53, out _, out string ipStr, out _, out _, out int port, out _, out _);
+ if (NetworkTool.IsIP(ipStr, out _)) return port >= 1 && port <= 65535;
+ }
+ return false;
}
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Methods IsDnsProtocolSupported: " + ex.Message);
return false;
}
}
private void InitializeStatus(CustomDataGridView dgv)
{
- dgv.SelectionChanged += (s, e) => dgv.ClearSelection();
- dgv.CellBorderStyle = DataGridViewCellBorderStyle.None;
- dgv.BorderStyle = BorderStyle.None;
- List rList = new();
- for (int n = 0; n < 15; n++)
+ try
{
- DataGridViewRow row = new();
- row.CreateCells(dgv, "cell0", "cell1");
- row.Height = TextRenderer.MeasureText("It doesn't matter what we write here!", dgv.Font).Height + 7;
-
- string cellName = n switch
+ dgv.SelectionChanged += (s, e) => dgv.ClearSelection();
+ dgv.CellBorderStyle = DataGridViewCellBorderStyle.None;
+ dgv.BorderStyle = BorderStyle.None;
+ List rList = new();
+ for (int n = 0; n < 15; n++)
{
- 0 => "Internet Status",
- 1 => "Working Servers",
- 2 => "Is Connected",
- 3 => "Local DNS",
- 4 => "Local DNS Latency",
- 5 => "Local DoH",
- 6 => "Local DoH Latency",
- 7 => "Is DNS Set",
- 8 => "Is Sharing",
- 9 => "Proxy Requests",
- 10 => "Is Proxy Set",
- 11 => "Proxy DPI Bypass",
- 12 => "GoodbyeDPI",
- 13 => "CPU",
- 14 => "",
- _ => string.Empty
- };
+ DataGridViewRow row = new();
+ row.CreateCells(dgv, "cell0", "cell1");
+ row.Height = TextRenderer.MeasureText("It doesn't matter what we write here!", dgv.Font).Height + 7;
- if (n % 2 == 0)
- row.DefaultCellStyle.BackColor = BackColor;
- else
- row.DefaultCellStyle.BackColor = BackColor.ChangeBrightness(-0.2f);
+ string cellName = n switch
+ {
+ 0 => "Internet Status",
+ 1 => "Working Servers",
+ 2 => "Is Connected",
+ 3 => "Local DNS",
+ 4 => "Local DNS Latency",
+ 5 => "Local DoH",
+ 6 => "Local DoH Latency",
+ 7 => "Is DNS Set",
+ 8 => "Is Sharing",
+ 9 => "Proxy Requests",
+ 10 => "Is Proxy Set",
+ 11 => "Proxy DPI Bypass",
+ 12 => "GoodbyeDPI",
+ 13 => "CPU",
+ 14 => "",
+ _ => string.Empty
+ };
+
+ if (n % 2 == 0)
+ row.DefaultCellStyle.BackColor = BackColor;
+ else
+ row.DefaultCellStyle.BackColor = BackColor.ChangeBrightness(-0.2f);
- row.Cells[0].Value = cellName;
- row.Cells[1].Value = string.Empty;
- rList.Add(row);
+ row.Cells[0].Value = cellName;
+ row.Cells[1].Value = string.Empty;
+ rList.Add(row);
+ }
+
+ dgv.Rows.AddRange(rList.ToArray());
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Methods InitializeStatus: " + ex.Message);
}
-
- dgv.Rows.AddRange(rList.ToArray());
}
private void InitializeNicStatus(CustomDataGridView dgv)
{
- ToolStripMenuItem toolStripMenuItemCopy = new();
- toolStripMenuItemCopy.Text = "Copy Value";
- toolStripMenuItemCopy.Click += (s, e) =>
+ try
{
- if (dgv.SelectedCells.Count > 0)
+ ToolStripMenuItem toolStripMenuItemCopy = new();
+ toolStripMenuItemCopy.Text = "Copy Value";
+ toolStripMenuItemCopy.Click += (s, e) =>
{
- string? value = dgv.CurrentRow.Cells[1].Value.ToString();
- if (!string.IsNullOrEmpty(value))
+ if (dgv.SelectedCells.Count > 0)
{
- Clipboard.SetText(value);
+ string? value = dgv.CurrentRow.Cells[1].Value.ToString();
+ if (!string.IsNullOrEmpty(value))
+ {
+ Clipboard.SetText(value);
+ }
}
- }
- };
- CustomContextMenuStrip cms = new();
- cms.Items.Add(toolStripMenuItemCopy);
+ };
+ CustomContextMenuStrip cms = new();
+ cms.Items.Add(toolStripMenuItemCopy);
- dgv.MouseClick += (s, e) =>
- {
- if (e.Button == MouseButtons.Right)
+ dgv.MouseClick += (s, e) =>
{
- dgv.Select(); // Set Focus on Control
- int currentMouseOverRow = dgv.HitTest(e.X, e.Y).RowIndex;
- if (currentMouseOverRow != -1)
+ if (e.Button == MouseButtons.Right)
{
- dgv.Rows[currentMouseOverRow].Cells[0].Selected = true;
- dgv.Rows[currentMouseOverRow].Selected = true;
+ dgv.Select(); // Set Focus on Control
+ int currentMouseOverRow = dgv.HitTest(e.X, e.Y).RowIndex;
+ if (currentMouseOverRow != -1)
+ {
+ dgv.Rows[currentMouseOverRow].Cells[0].Selected = true;
+ dgv.Rows[currentMouseOverRow].Selected = true;
- Theme.SetColors(cms);
- cms.RoundedCorners = 5;
- cms.Show(dgv, e.X, e.Y);
- }
+ Theme.SetColors(cms);
+ cms.RoundedCorners = 5;
+ cms.Show(dgv, e.X, e.Y);
+ }
- }
- };
-
- //dgv.SelectionChanged += (s, e) => dgv.ClearSelection();
- dgv.CellBorderStyle = DataGridViewCellBorderStyle.None;
- dgv.BorderStyle = BorderStyle.None;
- dgv.ShowCellToolTips = true;
- List rList = new();
- for (int n = 0; n < 14; n++)
- {
- DataGridViewRow row = new();
- row.CreateCells(dgv, "cell0", "cell1");
- row.Height = TextRenderer.MeasureText("It doesn't matter what we write here!", dgv.Font).Height + 4;
+ }
+ };
- string cellName = n switch
+ //dgv.SelectionChanged += (s, e) => dgv.ClearSelection();
+ dgv.CellBorderStyle = DataGridViewCellBorderStyle.None;
+ dgv.BorderStyle = BorderStyle.None;
+ dgv.ShowCellToolTips = true;
+ List rList = new();
+ for (int n = 0; n < 14; n++)
{
- 0 => "Name",
- 1 => "Description",
- 2 => "Adapter Type",
- 3 => "Availability",
- 4 => "Status",
- 5 => "Net Status",
- 6 => "DNS Addresses",
- 7 => "Is IPv6 Enabled",
- 8 => "MAC Address",
- 9 => "Manufacturer",
- 10 => "Is Physical Adapter",
- 11 => "ServiceName",
- 12 => "Max Speed",
- 13 => "Time Of Last Reset",
- _ => string.Empty
- };
+ DataGridViewRow row = new();
+ row.CreateCells(dgv, "cell0", "cell1");
+ row.Height = TextRenderer.MeasureText("It doesn't matter what we write here!", dgv.Font).Height + 4;
- if (n % 2 == 0)
- row.DefaultCellStyle.BackColor = BackColor.ChangeBrightness(-0.2f);
- else
- row.DefaultCellStyle.BackColor = BackColor;
+ string cellName = n switch
+ {
+ 0 => "Name",
+ 1 => "Description",
+ 2 => "Adapter Type",
+ 3 => "Availability",
+ 4 => "Status",
+ 5 => "Net Status",
+ 6 => "DNS Addresses",
+ 7 => "Is IPv6 Enabled",
+ 8 => "MAC Address",
+ 9 => "Manufacturer",
+ 10 => "Is Physical Adapter",
+ 11 => "ServiceName",
+ 12 => "Max Speed",
+ 13 => "Time Of Last Reset",
+ _ => string.Empty
+ };
+
+ if (n % 2 == 0)
+ row.DefaultCellStyle.BackColor = BackColor.ChangeBrightness(-0.2f);
+ else
+ row.DefaultCellStyle.BackColor = BackColor;
- row.Cells[0].Value = cellName;
- row.Cells[1].Value = string.Empty;
- row.Cells[0].ToolTipText = string.Empty;
- row.Cells[1].ToolTipText = string.Empty;
- rList.Add(row);
- }
+ row.Cells[0].Value = cellName;
+ row.Cells[1].Value = string.Empty;
+ row.Cells[0].ToolTipText = string.Empty;
+ row.Cells[1].ToolTipText = string.Empty;
+ rList.Add(row);
+ }
- dgv.Rows.AddRange(rList.ToArray());
+ dgv.Rows.AddRange(rList.ToArray());
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Methods InitializeNicStatus: " + ex.Message);
+ }
}
private async Task CheckDPIWorksAsync(string host, int timeoutSec = 30) // Default .NET Timeout: 100 Sec
{
- if (IsDisconnecting || IsDisconnectingAll || StopQuickConnect) return;
- if (CheckDpiBypassCTS.IsCancellationRequested) return;
- UpdateProxyBools = false;
-
- // Cancel Previous Task
- CheckDpiBypassCTS.Cancel();
- Task cancelWait = Task.Run(async () =>
- {
- while (true)
- {
- await Task.Delay(100);
- if (CheckDpiBypass == null) break;
- if (CheckDpiBypass.Status == TaskStatus.Canceled) break;
- if (CheckDpiBypass.Status == TaskStatus.Faulted) break;
- if (CheckDpiBypass.Status == TaskStatus.RanToCompletion) break;
- }
-
- if (CheckDpiBypass != null)
- {
- string msgCancel = $"Previous Check DPI Bypass: {CheckDpiBypass.Status}{NL}";
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgCancel, Color.DodgerBlue));
- }
- });
- try { await cancelWait.WaitAsync(TimeSpan.FromSeconds(10)); } catch (Exception) { }
-
- CheckDpiBypassCTS = new();
- CheckDpiBypass = Task.Run(async () =>
+ try
{
- if (string.IsNullOrWhiteSpace(host)) return;
-
- // If there is no internet conectivity return
- if (!IsInternetOnline) return;
-
- // If In Action return
- if (IsInAction(false, false, false, true, true, true, true, true, true, true, true, out _)) return;
-
- // Write start DPI checking to log
- string msgDPI = $"Checking DPI Bypass ({host})...{NL}";
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI, Color.LightGray));
+ if (IsDisconnecting || IsDisconnectingAll || StopQuickConnect) return;
+ if (CheckDpiBypassCTS.IsCancellationRequested) return;
+ UpdateProxyBools = false;
- // Don't Update Bools Here!!
-
- // Wait for IsDPIActive
- Task wait1 = Task.Run(async () =>
+ // Cancel Previous Task
+ CheckDpiBypassCTS.Cancel();
+ Task cancelWait = Task.Run(async () =>
{
while (true)
{
- if (IsDPIActive) break;
await Task.Delay(100);
+ if (CheckDpiBypass == null) break;
+ if (CheckDpiBypass.Status == TaskStatus.Canceled) break;
+ if (CheckDpiBypass.Status == TaskStatus.Faulted) break;
+ if (CheckDpiBypass.Status == TaskStatus.RanToCompletion) break;
}
- });
- try { await wait1.WaitAsync(TimeSpan.FromSeconds(5), CheckDpiBypassCTS.Token); } catch (Exception) { }
- try
- {
- if (!IsDPIActive)
+ if (CheckDpiBypass != null)
{
- // Write activate DPI first to log
- string msgDPI1 = $"Check DPI Bypass: ";
- string msgDPI2 = $"Activate DPI Bypass To Check.{NL}";
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI1, Color.LightGray));
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI2, Color.IndianRed));
-
- return;
+ string msgCancel = $"Previous Check DPI Bypass: {CheckDpiBypass.Status}{NL}";
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgCancel, Color.DodgerBlue));
}
+ });
+ try { await cancelWait.WaitAsync(TimeSpan.FromSeconds(10)); } catch (Exception) { }
- if (!IsDNSSet)
- {
- // Write set DNS first to log
- string msgDPI1 = $"Check DPI Bypass: ";
- string msgDPI2 = $"Set DNS To Check.{NL}";
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI1, Color.LightGray));
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI2, Color.Orange));
-
- return;
- }
+ CheckDpiBypassCTS = new();
+ CheckDpiBypass = Task.Run(async () =>
+ {
+ if (string.IsNullOrWhiteSpace(host)) return;
- string url = $"https://{host}/";
- Uri uri = new(url, UriKind.Absolute);
-
- bool isProxyPortOpen = NetworkTool.IsPortOpen(ProxyPort);
- Debug.WriteLine($"Is Proxy Port Open: {isProxyPortOpen}, Port: {ProxyPort}");
+ // If there is no internet conectivity return
+ if (!IsInternetOnline) return;
- if (isProxyPortOpen && IsProxyDpiBypassActive)
- {
- Debug.WriteLine("Proxy");
+ // If In Action return
+ if (IsInAction(false, false, false, true, true, true, true, true, true, true, true, out _)) return;
- string proxyScheme = $"http://{IPAddress.Loopback}:{ProxyPort}";
+ // Write start DPI checking to log
+ string msgDPI = $"Checking DPI Bypass ({host})...{NL}";
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI, Color.LightGray));
- msgDPI = $"Selecting DPI Bypass Method...{NL}";
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI, Color.LightGray));
+ // Don't Update Bools Here!!
- StopWatchCheckDPIWorks.Restart();
- HttpStatusCode hsc = await NetworkTool.GetHttpStatusCodeAsync(url, null, timeoutSec * 1000, false, false, proxyScheme, null, null, CheckDpiBypassCTS.Token);
- StopWatchCheckDPIWorks.Stop();
- Debug.WriteLine(hsc);
- if (hsc == HttpStatusCode.OK || hsc == HttpStatusCode.NotFound || hsc == HttpStatusCode.Forbidden)
+ // Wait for IsDPIActive
+ Task wait1 = Task.Run(async () =>
+ {
+ while (true)
{
- msgSuccess();
+ if (IsDPIActive) break;
+ await Task.Delay(100);
}
- else msgFailed(hsc);
- }
- else
- {
- Debug.WriteLine("No Proxy");
+ });
+ try { await wait1.WaitAsync(TimeSpan.FromSeconds(5), CheckDpiBypassCTS.Token); } catch (Exception) { }
- StopWatchCheckDPIWorks.Restart();
- HttpStatusCode hsc = await NetworkTool.GetHttpStatusCodeAsync(url, null, timeoutSec * 1000, false, false, null, null, null, CheckDpiBypassCTS.Token);
- StopWatchCheckDPIWorks.Stop();
-
- if (hsc == HttpStatusCode.OK || hsc == HttpStatusCode.NotFound || hsc == HttpStatusCode.Forbidden)
+ try
+ {
+ if (!IsDPIActive)
{
- msgSuccess();
+ // Write activate DPI first to log
+ string msgDPI1 = $"Check DPI Bypass: ";
+ string msgDPI2 = $"Activate DPI Bypass To Check.{NL}";
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI1, Color.LightGray));
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI2, Color.IndianRed));
+
+ return;
}
- else msgFailed(hsc);
- }
- void msgSuccess()
- {
- // Write Success to log
- if (IsDPIActive)
+ if (!IsDNSSet)
{
- TimeSpan eTime = StopWatchCheckDPIWorks.Elapsed;
- eTime = TimeSpan.FromMilliseconds(Math.Round(eTime.TotalMilliseconds, 2));
- string eTimeStr = eTime.Seconds > 9 ? $"{eTime:ss\\.ff}" : $"{eTime:s\\.ff}";
+ // Write set DNS first to log
string msgDPI1 = $"Check DPI Bypass: ";
- string msgDPI2 = $"Successfully opened {host} in {eTimeStr} seconds.{NL}";
+ string msgDPI2 = $"Set DNS To Check.{NL}";
this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI1, Color.LightGray));
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI2, Color.MediumSeaGreen));
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI2, Color.Orange));
+
+ return;
+ }
+
+ string url = $"https://{host}/";
+ Uri uri = new(url, UriKind.Absolute);
+
+ bool isProxyPortOpen = NetworkTool.IsPortOpen(ProxyPort);
+ Debug.WriteLine($"Is Proxy Port Open: {isProxyPortOpen}, Port: {ProxyPort}");
+
+ if (isProxyPortOpen && IsProxyDpiBypassActive)
+ {
+ Debug.WriteLine("Proxy");
+
+ string proxyScheme = $"http://{IPAddress.Loopback}:{ProxyPort}";
+
+ msgDPI = $"Selecting DPI Bypass Method...{NL}";
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI, Color.LightGray));
+
+ StopWatchCheckDPIWorks.Restart();
+ HttpStatusCode hsc = await NetworkTool.GetHttpStatusCodeAsync(url, null, timeoutSec * 1000, false, false, proxyScheme, null, null, CheckDpiBypassCTS.Token);
+ StopWatchCheckDPIWorks.Stop();
+ Debug.WriteLine(hsc);
+ if (hsc == HttpStatusCode.OK || hsc == HttpStatusCode.NotFound || hsc == HttpStatusCode.Forbidden)
+ {
+ msgSuccess();
+ }
+ else msgFailed(hsc);
}
else
{
- string msgCancel = $"Check DPI Bypass: Canceled.{NL}";
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgCancel, Color.LightGray));
+ Debug.WriteLine("No Proxy");
+
+ StopWatchCheckDPIWorks.Restart();
+ HttpStatusCode hsc = await NetworkTool.GetHttpStatusCodeAsync(url, null, timeoutSec * 1000, false, false, null, null, null, CheckDpiBypassCTS.Token);
+ StopWatchCheckDPIWorks.Stop();
+
+ if (hsc == HttpStatusCode.OK || hsc == HttpStatusCode.NotFound || hsc == HttpStatusCode.Forbidden)
+ {
+ msgSuccess();
+ }
+ else msgFailed(hsc);
}
- }
- void msgFailed(HttpStatusCode hsc)
+ void msgSuccess()
+ {
+ // Write Success to log
+ if (IsDPIActive)
+ {
+ TimeSpan eTime = StopWatchCheckDPIWorks.Elapsed;
+ eTime = TimeSpan.FromMilliseconds(Math.Round(eTime.TotalMilliseconds, 2));
+ string eTimeStr = eTime.Seconds > 9 ? $"{eTime:ss\\.ff}" : $"{eTime:s\\.ff}";
+ string msgDPI1 = $"Check DPI Bypass: ";
+ string msgDPI2 = $"Successfully opened {host} in {eTimeStr} seconds.{NL}";
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI1, Color.LightGray));
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI2, Color.MediumSeaGreen));
+ }
+ else
+ {
+ string msgCancel = $"Check DPI Bypass: Canceled.{NL}";
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgCancel, Color.LightGray));
+ }
+ }
+
+ void msgFailed(HttpStatusCode hsc)
+ {
+ // Write Status to log
+ if (IsDPIActive && !CheckDpiBypassCTS.IsCancellationRequested)
+ {
+ string msgDPI1 = $"Check DPI Bypass: ";
+ string msgDPI2 = $"{hsc}{NL}";
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI1, Color.LightGray));
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI2, Color.IndianRed));
+ }
+ else
+ {
+ string msgCancel = $"Check DPI Bypass: Canceled.{NL}";
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgCancel, Color.LightGray));
+ }
+ }
+ }
+ catch (Exception ex)
{
- // Write Status to log
+ // Write Failed to log
if (IsDPIActive && !CheckDpiBypassCTS.IsCancellationRequested)
{
- string msgDPI1 = $"Check DPI Bypass: ";
- string msgDPI2 = $"{hsc}{NL}";
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI1, Color.LightGray));
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI2, Color.IndianRed));
+ string msgDPI1 = $"Check DPI Bypass:{ex.Message}{NL}";
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI1, Color.IndianRed));
}
else
{
@@ -866,32 +967,22 @@ void msgFailed(HttpStatusCode hsc)
this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgCancel, Color.LightGray));
}
}
- }
- catch (Exception ex)
- {
- // Write Failed to log
- if (IsDPIActive && !CheckDpiBypassCTS.IsCancellationRequested)
- {
- string msgDPI1 = $"Check DPI Bypass:{ex.Message}{NL}";
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgDPI1, Color.IndianRed));
- }
- else
- {
- string msgCancel = $"Check DPI Bypass: Canceled.{NL}";
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgCancel, Color.LightGray));
- }
- }
- UpdateProxyBools = true;
- });
+ UpdateProxyBools = true;
+ });
- try { await CheckDpiBypass.WaitAsync(CheckDpiBypassCTS.Token); } catch (Exception) { }
+ try { await CheckDpiBypass.WaitAsync(CheckDpiBypassCTS.Token); } catch (Exception) { }
- string msgTask = $"Check DPI Bypass: {CheckDpiBypass.Status}{NL}";
- this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgTask, Color.DodgerBlue));
+ string msgTask = $"Check DPI Bypass: {CheckDpiBypass.Status}{NL}";
+ this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msgTask, Color.DodgerBlue));
- StopWatchCheckDPIWorks.Reset();
- UpdateProxyBools = true;
+ StopWatchCheckDPIWorks.Reset();
+ UpdateProxyBools = true;
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Methods CheckDPIWorksAsync: " + ex.Message);
+ }
}
private static async Task WarmUpProxyAsync(string host, string proxyScheme, int timeoutSec, CancellationToken ct)
@@ -919,7 +1010,7 @@ private static async Task WarmUpProxyAsync(string host, string proxyScheme
}
catch (Exception ex)
{
- Debug.WriteLine("WarmUpProxyAsync: " + ex.Message);
+ Debug.WriteLine("Methods WarmUpProxyAsync: " + ex.Message);
return false;
}
@@ -939,11 +1030,11 @@ private static async Task MoveToNewLocationAsync()
}
catch (Exception ex)
{
- Debug.WriteLine("MoveToNewLocation: " + ex.Message);
+ Debug.WriteLine("Methods MoveToNewLocation: " + ex.Message);
}
}
- public async void OldProxyRulesToNew()
+ public async Task OldProxyRulesToNewAsync()
{
try
{
@@ -1134,12 +1225,8 @@ public async void OldProxyRulesToNew()
{
// Save ProxyRules To File
await proxyRules.SaveToFileAsync(SecureDNS.ProxyRulesPath);
-
- // Enable ProxyRules CheckBox
- this.InvokeIt(() => CustomCheckBoxSettingProxyEnableRules.Checked = true);
}
-
try
{
File.Delete(SecureDNS.BlackWhiteListPath);
@@ -1151,7 +1238,48 @@ public async void OldProxyRulesToNew()
}
catch (Exception ex)
{
- Debug.WriteLine("OldProxyRulesToNew: " + ex.Message);
+ Debug.WriteLine("Methods OldProxyRulesToNew: " + ex.Message);
+ }
+ }
+
+ public async Task MergeOldDnsAndProxyRulesAsync()
+ {
+ try
+ {
+ if (File.Exists(SecureDNS.RulesPath)) return;
+
+ bool dnsRulesExist = File.Exists(SecureDNS.DnsRulesPath);
+ bool proxyRulesExist = File.Exists(SecureDNS.ProxyRulesPath);
+
+ if (dnsRulesExist && !proxyRulesExist)
+ {
+ File.Copy(SecureDNS.DnsRulesPath, SecureDNS.RulesPath, false);
+ File.Move(SecureDNS.DnsRulesPath, Path.GetFullPath(Path.ChangeExtension(SecureDNS.DnsRulesPath, ".BAK")), true);
+ this.InvokeIt(() => CustomCheckBoxSettingEnableRules.Checked = true);
+ return;
+ }
+ else if (!dnsRulesExist && proxyRulesExist)
+ {
+ File.Copy(SecureDNS.ProxyRulesPath, SecureDNS.RulesPath, false);
+ File.Move(SecureDNS.ProxyRulesPath, Path.GetFullPath(Path.ChangeExtension(SecureDNS.ProxyRulesPath, ".BAK")), true);
+ this.InvokeIt(() => CustomCheckBoxSettingEnableRules.Checked = true);
+ return;
+ }
+ else if (dnsRulesExist && proxyRulesExist)
+ {
+ var merged = await AgnosticProgram.Rules.MergeAsync(AgnosticProgram.Rules.Mode.File, SecureDNS.DnsRulesPath, AgnosticProgram.Rules.Mode.File, SecureDNS.ProxyRulesPath);
+ List rules = await AgnosticProgram.Rules.ConvertToTextRulesAsync(merged.Variables, merged.Defaults, merged.MainRulesList);
+
+ await rules.SaveToFileAsync(SecureDNS.RulesPath);
+ File.Move(SecureDNS.DnsRulesPath, Path.GetFullPath(Path.ChangeExtension(SecureDNS.DnsRulesPath, ".BAK")), true);
+ File.Move(SecureDNS.ProxyRulesPath, Path.GetFullPath(Path.ChangeExtension(SecureDNS.ProxyRulesPath, ".BAK")), true);
+ this.InvokeIt(() => CustomCheckBoxSettingEnableRules.Checked = true);
+ return;
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Methods MergeOldDnsAndProxyRulesAsync: " + ex.Message);
}
}
diff --git a/SecureDNSClient/Forms/QuickConnect.cs b/SecureDNSClient/Forms/QuickConnect.cs
index 8b052c1..ca4f6b9 100644
--- a/SecureDNSClient/Forms/QuickConnect.cs
+++ b/SecureDNSClient/Forms/QuickConnect.cs
@@ -343,7 +343,7 @@ async Task runStartConnect()
async Task runSetDns()
{
- await SetDNS(nicNameList);
+ await SetDnsAsync(nicNameList);
// Wait until DNS is set
QuickConnectTimeout.Restart();
@@ -409,7 +409,7 @@ async Task runSetDns()
async Task runStartProxy()
{
// Start Proxy
- await StartProxy(false, false);
+ await StartProxyAsync(false, false);
// Wait for Proxy
QuickConnectTimeout.Restart();
@@ -762,7 +762,7 @@ private async Task QuickDisconnectInternal(bool stopCheck, bool disconnect, bool
// Stop Proxy
if (stopProxy && (IsProxyActivated || IsProxyActivating))
{
- await StartProxy(true);
+ await StartProxyAsync(true);
// Wait
QuickConnectTimeout.Restart();
diff --git a/SecureDNSClient/Forms/ScreenHighDpiScale.cs b/SecureDNSClient/Forms/ScreenHighDpiScale.cs
index dfedb9c..b20cb84 100644
--- a/SecureDNSClient/Forms/ScreenHighDpiScale.cs
+++ b/SecureDNSClient/Forms/ScreenHighDpiScale.cs
@@ -699,12 +699,6 @@ public async void ScreenFixControlsLocations(Form form)
CustomCheckBoxDnsEventShowRequest.Left = CustomCheckBoxSettingConnectRetry.Left;
CustomCheckBoxDnsEventShowRequest.Top = CustomCheckBoxSettingConnectRetry.Bottom + spaceV;
- CustomCheckBoxSettingDnsEnableRules.Left = CustomCheckBoxDnsEventShowRequest.Left;
- CustomCheckBoxSettingDnsEnableRules.Top = CustomCheckBoxDnsEventShowRequest.Bottom + spaceV;
-
- CustomButtonSettingDnsRules.Left = CustomCheckBoxSettingDnsEnableRules.Right + spaceH2;
- CustomButtonSettingDnsRules.Top = CustomCheckBoxSettingDnsEnableRules.Top - 2;
-
//// Settings Set/Unset DNS
spaceV = 30;
CustomRadioButtonSettingUnsetDnsToDhcp.Location = new Point(spaceHH, 35);
@@ -725,6 +719,18 @@ public async void ScreenFixControlsLocations(Form form)
CustomTextBoxSettingUnsetDns2.Left = CustomTextBoxSettingUnsetDns1.Left;
CustomTextBoxSettingUnsetDns2.Top = CustomLabelSettingUnsetDns2.Top - 2;
+ CustomLabelSettingUnsetDnsIPv6_1.Left = CustomLabelSettingUnsetDns2.Left;
+ CustomLabelSettingUnsetDnsIPv6_1.Top = CustomLabelSettingUnsetDns2.Bottom + spaceV;
+
+ CustomTextBoxSettingUnsetDnsIPv6_1.Left = CustomTextBoxSettingUnsetDns2.Left;
+ CustomTextBoxSettingUnsetDnsIPv6_1.Top = CustomLabelSettingUnsetDnsIPv6_1.Top - 2;
+
+ CustomLabelSettingUnsetDnsIPv6_2.Left = CustomLabelSettingUnsetDnsIPv6_1.Left;
+ CustomLabelSettingUnsetDnsIPv6_2.Top = CustomLabelSettingUnsetDnsIPv6_1.Bottom + spaceV;
+
+ CustomTextBoxSettingUnsetDnsIPv6_2.Left = CustomTextBoxSettingUnsetDnsIPv6_1.Left;
+ CustomTextBoxSettingUnsetDnsIPv6_2.Top = CustomLabelSettingUnsetDnsIPv6_2.Top - 2;
+
//// Settings Share Basic
CustomLabelSettingProxyPort.Location = new Point(spaceRight, 25);
@@ -776,20 +782,6 @@ public async void ScreenFixControlsLocations(Form form)
CustomTextBoxSettingProxyCfCleanIP.Left = CustomCheckBoxSettingProxyCfCleanIP.Right + spaceH;
CustomTextBoxSettingProxyCfCleanIP.Top = CustomCheckBoxSettingProxyCfCleanIP.Top - 2;
- CustomLabelSettingShareSeparator1.Left = spaceRight;
- CustomLabelSettingShareSeparator1.Top = CustomCheckBoxSettingProxyCfCleanIP.Bottom + spaceV;
- CustomLabelSettingShareSeparator1.Width = TabPageSettingProxyAdvanced.Width - (spaceRight * 2);
- CustomLabelSettingShareSeparator1.Height = 1;
-
- CustomCheckBoxSettingProxyEnableRules.Left = CustomCheckBoxSettingProxyCfCleanIP.Left;
- CustomCheckBoxSettingProxyEnableRules.Top = CustomLabelSettingShareSeparator1.Bottom + spaceV;
-
- CustomLabelSettingProxyRules.Left = spaceRight * 4;
- CustomLabelSettingProxyRules.Top = CustomCheckBoxSettingProxyEnableRules.Bottom + (spaceV / 2);
-
- CustomButtonSettingProxyRules.Left = CustomLabelSettingProxyRules.Right + spaceHH;
- CustomButtonSettingProxyRules.Top = CustomCheckBoxSettingProxyEnableRules.Bottom + 5;
-
//// Settings Fake Proxy
spaceV = 50;
CustomLabelSettingFakeProxyInfo.Location = new Point(20, 10);
diff --git a/SecureDNSClient/Forms/SetDNS.cs b/SecureDNSClient/Forms/SetDNS.cs
index 3ed32b3..03f4d19 100644
--- a/SecureDNSClient/Forms/SetDNS.cs
+++ b/SecureDNSClient/Forms/SetDNS.cs
@@ -8,7 +8,7 @@ namespace SecureDNSClient;
public partial class FormMain
{
- private async Task SetDNS(List nicNameList, bool unset = false, bool limitLog = false)
+ private async Task SetDnsAsync(List nicNameList, bool unset = false, bool limitLog = false)
{
string loopbackIPv4 = IPAddress.Loopback.ToString();
string loopbackIPv6 = IPAddress.IPv6Loopback.ToString();
@@ -256,9 +256,11 @@ private async Task UnsetDNS(string nicName)
else
{
// Unset to Static
- string dns1 = CustomTextBoxSettingUnsetDns1.Text;
- string dns2 = CustomTextBoxSettingUnsetDns2.Text;
- await SetDnsOnNic_.UnsetDnsToStatic(dns1, dns2, nicName);
+ string dnsIPv4_1 = CustomTextBoxSettingUnsetDns1.Text;
+ string dnsIPv4_2 = CustomTextBoxSettingUnsetDns2.Text;
+ string dnsIPv6_1 = CustomTextBoxSettingUnsetDnsIPv6_1.Text;
+ string dnsIPv6_2 = CustomTextBoxSettingUnsetDnsIPv6_2.Text;
+ await SetDnsOnNic_.UnsetDnsToStatic(dnsIPv4_1, dnsIPv4_2, dnsIPv6_1, dnsIPv6_2, nicName);
}
}
diff --git a/SecureDNSClient/Forms/ShareViaProxy.cs b/SecureDNSClient/Forms/ShareViaProxy.cs
index 5119748..bc3604d 100644
--- a/SecureDNSClient/Forms/ShareViaProxy.cs
+++ b/SecureDNSClient/Forms/ShareViaProxy.cs
@@ -8,7 +8,7 @@ namespace SecureDNSClient;
public partial class FormMain
{
// ========================================== Start Proxy
- private async Task StartProxy(bool stop = false, bool limitLog = false)
+ private async Task StartProxyAsync(bool stop = false, bool limitLog = false)
{
await Task.Run(async () =>
{
@@ -65,7 +65,7 @@ await Task.Run(async () =>
dnss += ",system";
// Get Cloudflare Clean IPv4
- string cfCleanIPv4 = GetCfCleanIpSetting();
+ string cfCleanIP = GetCfCleanIpSetting();
// Get Bootstrap IP And Port
string bootstrapIp = GetBootstrapSetting(out int bootstrapPort).ToString();
@@ -83,6 +83,7 @@ await Task.Run(async () =>
// Kill If It's Already Running
await ProcessManager.KillProcessByPidAsync(PIDProxyServer);
bool isCmdSent = false;
+ int consoleDelayMs = 50, consoleTimeoutSec = 15;
PIDProxyServer = ProxyConsole.Execute(SecureDNS.AgnosticServerPath, null, true, true, SecureDNS.CurrentPath, GetCPUPriority());
await Task.Delay(100);
@@ -107,59 +108,62 @@ await Task.Run(async () =>
await UpdateStatusShortOnBoolsChangedAsync();
return;
}
-
+
// Send Set Profile
- isCmdSent = await ProxyConsole.SendCommandAsync("Profile Proxy");
+ string setProfileCommand = "Profile Proxy";
+ isCmdSent = await ProxyConsole.SendCommandAsync(setProfileCommand, consoleDelayMs, consoleTimeoutSec, "Confirmed: Profile");
if (!isCmdSent)
{
- await FaildSendCommandMessageAsync();
+ await FaildSendCommandMessageAsync(setProfileCommand);
return;
}
// Send Settings
string settingsCmd = $"Setting -Port={proxyPort} -WorkingMode=DnsAndProxy -MaxRequests={maxRequests} -DnsTimeoutSec=5 -ProxyTimeoutSec={proxyTimeoutSec}";
- settingsCmd += $" -KillOnCpuUsage={killOnCpuUsage} -BlockPort80={blockPort80} -AllowInsecure=True -DNSs={dnss} -CfCleanIP={cfCleanIPv4}";
+ settingsCmd += $" -KillOnCpuUsage={killOnCpuUsage} -BlockPort80={blockPort80} -AllowInsecure=True -DNSs={dnss} -CfCleanIP={cfCleanIP}";
settingsCmd += $" -BootstrapIp={bootstrapIp} -BootstrapPort={bootstrapPort}";
settingsCmd += $" -ProxyScheme={upstream.ProxyScheme} -ProxyUser={upstream.ProxyUser} -ProxyPass={upstream.ProxyPass} -OnlyBlockedIPs={upstream.OnlyBlockedIPs}";
- isCmdSent = await ProxyConsole.SendCommandAsync(settingsCmd);
+ isCmdSent = await ProxyConsole.SendCommandAsync(settingsCmd, consoleDelayMs, consoleTimeoutSec, "Confirmed: Setting");
if (!isCmdSent)
{
- await FaildSendCommandMessageAsync();
+ await FaildSendCommandMessageAsync("Send Settings");
return;
}
// Send SSL Settings (HTTPS) / SSL Decryption / Fragment
- bool isDpiBypassApplied = await ApplyProxyDpiChanges();
+ bool isDpiBypassApplied = await ApplyProxyDpiChangesAsync();
if (!isDpiBypassApplied)
{
- await FaildSendCommandMessageAsync();
+ await FaildSendCommandMessageAsync("ApplyProxyDpiChanges");
return;
}
- // Send ProxyRules
- bool isRulesOk = await ApplyProxyRules();
+ // Send Rules
+ bool isRulesOk = await ApplyRulesToProxyAsync();
if (!isRulesOk)
{
- await FaildSendCommandMessageAsync();
+ await FaildSendCommandMessageAsync("ApplyRulesToProxy");
return;
}
// Send Write Requests To Log
if (CustomCheckBoxProxyEventShowRequest.Checked)
{
- isCmdSent = await ProxyConsole.SendCommandAsync("Requests True");
+ string showRequestsCommand = "Requests True";
+ isCmdSent = await ProxyConsole.SendCommandAsync(showRequestsCommand, consoleDelayMs, consoleTimeoutSec, "Confirmed: Requests True");
if (!isCmdSent)
{
- await FaildSendCommandMessageAsync();
+ await FaildSendCommandMessageAsync(showRequestsCommand);
return;
}
}
else
{
- isCmdSent = await ProxyConsole.SendCommandAsync("Requests False");
+ string showRequestsCommand = "Requests False";
+ isCmdSent = await ProxyConsole.SendCommandAsync(showRequestsCommand, consoleDelayMs, consoleTimeoutSec, "Confirmed: Requests False");
if (!isCmdSent)
{
- await FaildSendCommandMessageAsync();
+ await FaildSendCommandMessageAsync(showRequestsCommand);
return;
}
}
@@ -167,19 +171,21 @@ await Task.Run(async () =>
// Send Write Fragment Details To Log
if (CustomCheckBoxProxyEventShowChunkDetails.Checked)
{
- isCmdSent = await ProxyConsole.SendCommandAsync("FragmentDetails True");
+ string fragmentDetailsCommand = "FragmentDetails True";
+ isCmdSent = await ProxyConsole.SendCommandAsync(fragmentDetailsCommand, consoleDelayMs, consoleTimeoutSec, "Confirmed: FragmentDetails True");
if (!isCmdSent)
{
- await FaildSendCommandMessageAsync();
+ await FaildSendCommandMessageAsync(fragmentDetailsCommand);
return;
}
}
else
{
- isCmdSent = await ProxyConsole.SendCommandAsync("FragmentDetails False");
+ string fragmentDetailsCommand = "FragmentDetails False";
+ isCmdSent = await ProxyConsole.SendCommandAsync(fragmentDetailsCommand, consoleDelayMs, consoleTimeoutSec, "Confirmed: FragmentDetails False");
if (!isCmdSent)
{
- await FaildSendCommandMessageAsync();
+ await FaildSendCommandMessageAsync(fragmentDetailsCommand);
return;
}
}
@@ -187,21 +193,22 @@ await Task.Run(async () =>
// Send Parent Process Command
string parentCommand = $"ParentProcess -PID={Environment.ProcessId}";
Debug.WriteLine(parentCommand);
- isCmdSent = await ProxyConsole.SendCommandAsync(parentCommand);
+ isCmdSent = await ProxyConsole.SendCommandAsync(parentCommand, consoleDelayMs, consoleTimeoutSec, "Confirmed: ParentProcess");
if (!isCmdSent)
{
- await FaildSendCommandMessageAsync();
+ await FaildSendCommandMessageAsync(parentCommand);
return;
}
// Send Start Command
- await ProxyConsole.SendCommandAsync("Start");
+ await ProxyConsole.SendCommandAsync("Start", consoleDelayMs, 30, "Confirmed: Start");
await Task.Delay(200);
// Check For Successfull Communication With Console
- isCmdSent = await ProxyConsole.SendCommandAsync("Out Proxy"); // Out
+ string outCommand = "Out Proxy";
+ isCmdSent = await ProxyConsole.SendCommandAsync(outCommand); // Out
string confirmMsg = "details|true";
-
+
// Wait For Confirm Message
Task result = Task.Run(async () =>
{
@@ -213,10 +220,10 @@ await Task.Run(async () =>
}
});
try { await result.WaitAsync(TimeSpan.FromSeconds(10)); } catch (Exception) { }
-
+
if (!isCmdSent || !ProxyConsole.GetStdout.ToLower().StartsWith(confirmMsg))
{
- await FaildSendCommandMessageAsync();
+ await FaildSendCommandMessageAsync(outCommand);
return;
}
@@ -310,7 +317,7 @@ await Task.Run(async () =>
await UpdateStatusShortOnBoolsChangedAsync();
// Clear LastProxyRulesPath
- LastProxyRulesPath = string.Empty;
+ LastRulesPath = string.Empty;
// Write deactivated message to log
string msgDiactivated = $"Proxy Server Deactivated.{NL}";
@@ -348,12 +355,14 @@ await Task.Run(async () =>
// ========================================== Other Proxy Methods
- public async Task FaildSendCommandMessageAsync()
+ public async Task FaildSendCommandMessageAsync(string command)
{
if (!IsDisconnectingAll && !IsQuickConnecting)
{
string msg = $"Couldn't Communicate With Proxy Console.{NL}";
- msg += $"Please Make Sure You Have .NET Desktop v6 And ASP.NET Core v6 Installed On Your OS.{NL}";
+ msg += $"Command: {command}{NL}";
+ msg += $"1. Please Make Sure You Have .NET Desktop v6 And ASP.NET Core v6 Installed On Your OS.{NL}";
+ msg += $"2. White List \"{SecureDNS.AgnosticServerPath}\" In Your Anti-Virus Or Any Security Software You Have.{NL}";
this.InvokeIt(() => CustomRichTextBoxLog.AppendText(msg, Color.IndianRed));
}
@@ -363,7 +372,7 @@ public async Task FaildSendCommandMessageAsync()
await UpdateStatusShortOnBoolsChangedAsync();
}
- private async Task ApplyProxyDpiChanges()
+ private async Task ApplyProxyDpiChangesAsync()
{
// Return if DNS is setting or unsetting
if (IsDNSSetting || IsDNSUnsetting) return false;
@@ -371,13 +380,13 @@ private async Task ApplyProxyDpiChanges()
UpdateProxyBools = false;
string command = GetFragmentProgramCommand();
Debug.WriteLine(command);
- bool isCommandSent = await ProxyConsole.SendCommandAsync(command);
+ bool isCommandSent = await ProxyConsole.SendCommandAsync(command, 50, 15, "Confirmed: Fragment");
// Save LastFragmentProgramCommand
if (isCommandSent) LastFragmentProgramCommand = command;
// Apply SSL Decryption
- bool isSSLDecryptionOk = await ApplyProxySSLDecryption();
+ bool isSSLDecryptionOk = await ApplyProxySSLDecryptionAsync();
UpdateProxyBools = true;
if (!isCommandSent || !isSSLDecryptionOk) return false;
@@ -425,7 +434,7 @@ private void ApplyProxyDpiFragmentChangesOut(out AgnosticProgram.Fragment.Mode f
fragmentMode = enableFragment ? AgnosticProgram.Fragment.Mode.Program : AgnosticProgram.Fragment.Mode.Disable;
}
- public async Task ApplyProxySSLDecryption()
+ public async Task ApplyProxySSLDecryptionAsync()
{
bool changeSni = false;
this.InvokeIt(() => changeSni = CustomCheckBoxProxySSLChangeSni.Checked);
@@ -438,7 +447,7 @@ public async Task ApplyProxySSLDecryption()
string command = $"SSLSetting -Enable=True -RootCA_Path=\"{SecureDNS.IssuerCertPath}\" -RootCA_KeyPath=\"{SecureDNS.IssuerKeyPath}\" -Cert_Path=\"{SecureDNS.CertPath}\" -Cert_KeyPath=\"{SecureDNS.KeyPath}\" -ChangeSni={changeSni} -DefaultSni={defaultSni}";
Debug.WriteLine(command);
- bool isSuccess = await ProxyConsole.SendCommandAsync(command);
+ bool isSuccess = await ProxyConsole.SendCommandAsync(command, 50, 15, "Confirmed: SSLSetting");
if (isSuccess) LastDefaultSni = defaultSni;
return isSuccess;
@@ -447,22 +456,76 @@ public async Task ApplyProxySSLDecryption()
{
string command = $"SSLSetting -Enable=False";
Debug.WriteLine(command);
- return await ProxyConsole.SendCommandAsync(command);
+ return await ProxyConsole.SendCommandAsync(command, 50, 15, "Confirmed: SSLSetting");
}
}
- public async Task ApplyProxyRules()
+ public async Task ApplyRulesToProxyAsync()
{
- if (CustomCheckBoxSettingProxyEnableRules.Checked)
+ try
{
- string command = $"Programs ProxyRules -Mode=File -PathOrText=\"{SecureDNS.ProxyRulesPath}\"";
- Debug.WriteLine(command);
- bool success = await ProxyConsole.SendCommandAsync(command);
- if (success) LastProxyRulesPath = SecureDNS.ProxyRulesPath;
- return success;
- }
+ List rulesList = new();
- return true;
+ bool customRules = false;
+ bool ir_ADS = false, ir_Domains = false, ir_CIDRs = false;
+
+ this.InvokeIt(() =>
+ {
+ customRules = CustomCheckBoxSettingEnableRules.Checked;
+ ir_ADS = CustomCheckBoxGeoAsset_IR_ADS.Checked;
+ ir_Domains = CustomCheckBoxGeoAsset_IR_Domains.Checked;
+ ir_CIDRs = CustomCheckBoxGeoAsset_IR_CIDRs.Checked;
+ });
+
+ if (customRules && File.Exists(SecureDNS.RulesPath))
+ {
+ List customRulesList = new();
+ await customRulesList.LoadFromFileAsync(SecureDNS.RulesPath, true, true);
+ if (customRulesList.Count > 0) rulesList.AddRange(customRulesList);
+ }
+
+ // IR ADS Domains: Block
+ if (ir_ADS && File.Exists(SecureDNS.Asset_IR_ADS_Domains))
+ {
+ string rule = $"{SecureDNS.Asset_IR_ADS_Domains}|-;";
+ rulesList.Add(rule);
+ }
+
+ // IR Domains: Direct
+ if (ir_Domains && File.Exists(SecureDNS.Asset_IR_Domains))
+ {
+ string rule = $"{SecureDNS.Asset_IR_Domains}|--;";
+ rulesList.Add(rule);
+ rulesList.Add("*.ir|--;");
+ }
+
+ // IR CIDRs: Direct
+ if (ir_CIDRs && File.Exists(SecureDNS.Asset_IR_CIDRs))
+ {
+ string rule = $"{SecureDNS.Asset_IR_CIDRs}|--;";
+ rulesList.Add(rule);
+ }
+
+ if (rulesList.Count > 0)
+ {
+ // Save To Temp File
+ await rulesList.SaveToFileAsync(SecureDNS.Rules_Assets_Proxy);
+
+ // Send Command
+ string command = $"Programs Rules -Mode=File -PathOrText=\"{SecureDNS.Rules_Assets_Proxy}\"";
+ Debug.WriteLine(command);
+ bool success = await ProxyConsole.SendCommandAsync(command, 50, 30, "Confirmed: Rules");
+ if (success) LastRulesPath = SecureDNS.RulesPath;
+ return success;
+ }
+
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("ShareViaProxy ApplyRulesToProxyAsync: " + ex.Message);
+ return false;
+ }
}
}
\ No newline at end of file
diff --git a/SecureDNSClient/Forms/ShareViaProxy_RulesReader.cs b/SecureDNSClient/Forms/ShareViaProxy_RulesReader.cs
index 58eb954..5a69828 100644
--- a/SecureDNSClient/Forms/ShareViaProxy_RulesReader.cs
+++ b/SecureDNSClient/Forms/ShareViaProxy_RulesReader.cs
@@ -1,7 +1,6 @@
using CustomControls;
using MsmhToolsClass;
using MsmhToolsClass.MsmhAgnosticServer;
-using System.Diagnostics;
using System.Net;
namespace SecureDNSClient;
@@ -19,8 +18,8 @@ private async void ReadProxyRules()
this.InvokeIt(() => log.ResetText());
bool isRulesEnabled = false;
- this.InvokeIt(() => isRulesEnabled = CustomCheckBoxSettingProxyEnableRules.Checked);
- if (!isRulesEnabled && ProxyRulesMode == AgnosticProgram.ProxyRules.Mode.Disable)
+ this.InvokeIt(() => isRulesEnabled = CustomCheckBoxSettingEnableRules.Checked);
+ if (!isRulesEnabled && RulesMode == AgnosticProgram.Rules.Mode.Disable)
{
this.InvokeIt(() => log.AppendText("Proxy Rules Are Disabled.", Color.DarkOrange));
@@ -38,7 +37,7 @@ private async void ReadProxyRules()
NetworkTool.GetUrlDetails(url, 443, out _, out string host, out _, out _, out int port, out _, out _);
- string rulesPath = string.IsNullOrEmpty(LastProxyRulesPath) ? SecureDNS.ProxyRulesPath : LastProxyRulesPath;
+ string rulesPath = string.IsNullOrEmpty(LastRulesPath) ? SecureDNS.RulesPath : LastRulesPath;
if (!File.Exists(rulesPath))
{
this.InvokeIt(() => CustomButtonShareRulesStatusRead.Enabled = true);
@@ -49,14 +48,14 @@ private async void ReadProxyRules()
string content = string.Empty;
try { content = await File.ReadAllTextAsync(rulesPath); } catch (Exception) { }
- if (string.IsNullOrEmpty(LastProxyRulesPath) || !content.Equals(LastProxyRulesContent))
+ if (string.IsNullOrEmpty(LastRulesPath) || !content.Equals(LastRulesContent))
{
- LastProxyRulesContent = content;
+ LastRulesContent = content;
// Reapply ProxyRules To Proxy Server
- if (IsProxyActivated && !IsProxyActivating) await ApplyProxyRules();
+ if (IsProxyActivated && !IsProxyActivating) await ApplyRulesToProxyAsync();
- CheckProxyRules.Set(AgnosticProgram.ProxyRules.Mode.Text, LastProxyRulesContent);
+ await CheckRules.SetAsync(AgnosticProgram.Rules.Mode.Text, LastRulesContent);
}
AgnosticSettings agnosticSettings = new()
@@ -65,7 +64,7 @@ private async void ReadProxyRules()
DnsTimeoutSec = 5,
CloudflareCleanIP = GetCfCleanIpSetting()
};
- AgnosticProgram.ProxyRules.ProxyRulesResult prr = await CheckProxyRules.GetAsync(IPAddress.Loopback.ToString(), host, port, agnosticSettings);
+ AgnosticProgram.Rules.RulesResult prr = await CheckRules.GetAsync(IPAddress.Loopback.ToString(), host, port, agnosticSettings);
this.InvokeIt(() => log.AppendText($"Domain:{NL}"));
this.InvokeIt(() => log.AppendText($"{host}{NL}", Color.DodgerBlue));
@@ -126,7 +125,7 @@ private async void ReadProxyRules()
this.InvokeIt(() => log.AppendText($"None{NL}", Color.DodgerBlue));
}
- bool isIp = NetworkTool.IsIp(prr.Dns, out _);
+ bool isIp = NetworkTool.IsIP(prr.Dns, out _);
if (isIp)
{
this.InvokeIt(() => log.AppendText($"IP: "));
@@ -138,9 +137,9 @@ private async void ReadProxyRules()
this.InvokeIt(() => log.AppendText($"Couldn't Get DNS Message{NL}", Color.DarkOrange));
}
- // DPI Bypass
- this.InvokeIt(() => log.AppendText($"{NL}Apply DPI Bypass: "));
- this.InvokeIt(() => log.AppendText($"{prr.ApplyDpiBypass.ToString().CapitalizeFirstLetter()}{NL}", Color.DodgerBlue));
+ // Is Direct
+ this.InvokeIt(() => log.AppendText($"{NL}Is Direct: "));
+ this.InvokeIt(() => log.AppendText($"{prr.IsDirect.ToString().CapitalizeFirstLetter()}{NL}", Color.DodgerBlue));
if (!host.Equals(prr.Sni))
{
diff --git a/SecureDNSClient/Forms/UpdateStatusAuto.cs b/SecureDNSClient/Forms/UpdateStatusAuto.cs
index 7b44f3c..9f3b8d7 100644
--- a/SecureDNSClient/Forms/UpdateStatusAuto.cs
+++ b/SecureDNSClient/Forms/UpdateStatusAuto.cs
@@ -158,12 +158,14 @@ await Task.Run(async () =>
private void CheckUpdateAuto()
{
if (!Program.IsStartup) Task.Run(async () => await CheckUpdateAsync());
+ Task.Run(async () => await Assets_Download_Async());
System.Timers.Timer timer = new();
timer.Interval = TimeSpan.FromHours(1).TotalMilliseconds;
timer.Elapsed += (s, e) =>
{
Task.Run(async () => await CheckUpdateAsync());
+ Task.Run(async () => await Assets_Download_Async());
};
timer.Start();
}
@@ -557,12 +559,12 @@ await Task.Run(async () =>
IsProxyRunning = false; ProxyRequests = 0; ProxyMaxRequests = 1000; IsProxyFragmentActive = false;
IsProxySSLDecryptionActive = false; IsProxySSLChangeSniActive = false;
ProxyFragmentMode = AgnosticProgram.Fragment.Mode.Disable;
- ProxyRulesMode = AgnosticProgram.ProxyRules.Mode.Disable;
+ RulesMode = AgnosticProgram.Rules.Mode.Disable;
}
else if (line.StartsWith("details"))
{
string[] split = line.Split('|');
- if (split.Length > 10)
+ if (split.Length > 9)
{
if (bool.TryParse(split[1].ToLower(), out bool sharing)) IsProxyRunning = sharing;
if (int.TryParse(split[2].ToLower(), out int port)) ProxyPort = port;
@@ -577,9 +579,9 @@ await Task.Run(async () =>
if (split[8].ToLower().Equals("disable")) ProxyFragmentMode = AgnosticProgram.Fragment.Mode.Disable;
else if (split[8].ToLower().Equals("program")) ProxyFragmentMode = AgnosticProgram.Fragment.Mode.Program;
- if (split[10].ToLower().Equals("disable")) ProxyRulesMode = AgnosticProgram.ProxyRules.Mode.Disable;
- else if (split[10].ToLower().Equals("file")) ProxyRulesMode = AgnosticProgram.ProxyRules.Mode.File;
- else if (split[10].ToLower().Equals("text")) ProxyRulesMode = AgnosticProgram.ProxyRules.Mode.Text;
+ if (split[9].ToLower().Equals("disable")) RulesMode = AgnosticProgram.Rules.Mode.Disable;
+ else if (split[9].ToLower().Equals("file")) RulesMode = AgnosticProgram.Rules.Mode.File;
+ else if (split[9].ToLower().Equals("text")) RulesMode = AgnosticProgram.Rules.Mode.Text;
}
}
@@ -1271,12 +1273,12 @@ private async Task GetCpuUsageAsync(int delay)
float sdc = -1, dnsserver = -1, proxyServer = -1;
float goodbyeDpiBasic = -1, goodbyeDpiAdvanced = -1, goodbyeDpiBypass = -1;
- Task a = Task.Run(async () => sdc = await ProcessManager.GetCpuUsage(Environment.ProcessId, delay));
- Task b = Task.Run(async () => dnsserver = await ProcessManager.GetCpuUsage(PIDDnsServer, delay));
- Task c = Task.Run(async () => proxyServer = await ProcessManager.GetCpuUsage(PIDProxyServer, delay));
- Task d = Task.Run(async () => goodbyeDpiBasic = await ProcessManager.GetCpuUsage(PIDGoodbyeDPIBasic, delay));
- Task e = Task.Run(async () => goodbyeDpiAdvanced = await ProcessManager.GetCpuUsage(PIDGoodbyeDPIAdvanced, delay));
- Task f = Task.Run(async () => goodbyeDpiBypass = await ProcessManager.GetCpuUsage(PIDGoodbyeDPIBypass, delay));
+ Task a = Task.Run(async () => sdc = await ProcessManager.GetCpuUsageAsync(Environment.ProcessId, delay));
+ Task b = Task.Run(async () => dnsserver = await ProcessManager.GetCpuUsageAsync(PIDDnsServer, delay));
+ Task c = Task.Run(async () => proxyServer = await ProcessManager.GetCpuUsageAsync(PIDProxyServer, delay));
+ Task d = Task.Run(async () => goodbyeDpiBasic = await ProcessManager.GetCpuUsageAsync(PIDGoodbyeDPIBasic, delay));
+ Task e = Task.Run(async () => goodbyeDpiAdvanced = await ProcessManager.GetCpuUsageAsync(PIDGoodbyeDPIAdvanced, delay));
+ Task f = Task.Run(async () => goodbyeDpiBypass = await ProcessManager.GetCpuUsageAsync(PIDGoodbyeDPIBypass, delay));
List tasksList = new();
tasksList.Add(a);
diff --git a/SecureDNSClient/HostToCompany.txt b/SecureDNSClient/HostToCompany.txt
index 28cb558..b57af1e 100644
--- a/SecureDNSClient/HostToCompany.txt
+++ b/SecureDNSClient/HostToCompany.txt
@@ -1 +1,1611 @@
-Reducted!
\ No newline at end of file
+081735923.box.freepro.com|Jaguar Network SAS
+0ms.run|Cloudflare, Inc. (CDN)
+1.0.0.1|Cloudflare, Inc.
+1.1.1.1|Cloudflare, Inc.
+1.1.ad.ark.pch.net|WoodyNet, Inc.
+1.1.ad.beg.pch.net|WoodyNet, Inc.
+1.1.ad.bkk.pch.net|WoodyNet, Inc.
+1.1.ad.bos.pch.net|WoodyNet, Inc.
+1.1.ad.bvy.pch.net|WoodyNet, Inc.
+1.1.ad.edi.pch.net|WoodyNet, Inc.
+1.1.ad.fra2.pch.net|WoodyNet, Inc.
+1.1.ad.gza.pch.net|WoodyNet, Inc.
+1.1.ad.lad.pch.net|WoodyNet, Inc.
+1.1.ad.lim.pch.net|WoodyNet, Inc.
+1.1.ad.mba.pch.net|WoodyNet, Inc.
+1.1.ad.mex.pch.net|WoodyNet, Inc.
+1.1.ad.sxf.pch.net|WoodyNet, Inc.
+1.1.ad.tmp.pch.net|WoodyNet, Inc.
+1.192.137.123|Luoyang, Henan Province, P.R.China. Warning: Don't use.
+1.192.192.206|Luoyang, Henan Province, P.R.China. Warning: Don't use.
+101.198.0.72|IDC, China Telecommunications Corporation
+101.198.191.132|Beijing Qihu Technology Company Limited
+101.198.191.134|Beijing Qihu Technology Company Limited
+101.199.254.118|China Unicom Beijing Province Network. Warning: Don't use.
+101.32.212.226|Tencent Building, Kejizhongyi Avenue
+101.32.30.247|Tencent Building, Kejizhongyi Avenue
+101.35.152.155|Shenzhen Tencent Computer Systems Company Limited
+101.36.166.17|China Mobile Communicaitons Corporation
+101.6.6.6|China Education and Research Network Center. Warning: Don't use.
+101.89.47.67|China Telecom (Group). Warning: Don't use.
+102.37.108.139|Microsoft Corporation
+103.14.26.190|Latitude.sh
+103.140.78.30|PT GREEN NET INDONESIA
+103.149.46.217|Datacamp Limited
+103.153.73.188|VIETNAM POSTS AND TELECOMMUNICATIONS GROUP
+103.161.196.196|CV Linkmedia Nusantara
+103.237.147.61|Long Van Soft Solution JSC
+103.247.36.150|DNSFilter, Inc.
+103.247.37.150|DNSFilter, Inc.
+103.254.108.74|BGPNET Global ASN
+103.56.78.11|China Mobile communications corporation. Warning: Don't use.
+103.6.212.123|Rimu Hosting Limited
+103.6.212.123|RIMU HOSTING LIMITED
+103.83.157.252|8 Burn Road , # 15-13, Trivex
+104.16.0.132|Cloudflare, Inc. (CDN)
+104.21.6.215|Cloudflare, Inc. (CDN)
+104.21.83.46|Cloudflare, Inc. (CDN)
+104.225.11.36|NetActuate, Inc
+104.225.12.223|NetActuate, Inc
+104.225.12.24|NetActuate, Inc
+104.225.216.146|HIVELOCITY, Inc.
+104.238.186.192|The Constant Company, LLC
+104.26.3.137|Cloudflare, Inc. (CDN)
+106.11.37.100|Hangzhou Alibaba Advertising Co.,Ltd. China.
+106.11.37.96|Hangzhou Alibaba Advertising Co.,Ltd. China.
+106.14.221.10|Hangzhou Alibaba Advertising Co.,Ltd. China.
+106.14.73.186|Alibaba Cloud. China.
+107.162.133.99|Defense.Net, Inc
+107.182.22.203.16clouds.com|IT7 Networks Inc
+109.24.72.11|Societe Francaise Du Radiotelephone - SFR SA
+109.24.72.150|Societe Francaise Du Radiotelephone - SFR SA
+109.27.84.62|Societe Francaise Du Radiotelephone - SFR SA
+109.68.215.50|TimeWeb Ltd.
+110.43.53.226|CHINANET Guangdong province network
+111.206.170.220|China Unicom Beijing Province Network. Warning: Don't use.
+111.206.170.68|China Unicom Beijing Province Network. Warning: Don't use.
+111.206.170.77|China Unicom Beijing Province Network. Warning: Don't use.
+111.206.170.78|China Unicom Beijing Province Network. Warning: Don't use.
+111.235.248.121|Taiwan Intelligent Fiber Optic Network Co.,Ltd.
+112.213.32.219|Mammoth Media Pty Ltd
+113.31.103.21|Shanghai UCloud Information Technology Company Limited
+114-34-116-139.hinet-ip.hinet.net|Data Communication Business Group
+114.132.58.149|Tencent cloud computing (Beijing) Co., Ltd. China.
+116.0.2.86|PT Wifiku Indonesia
+116.12.51.216|Exabytes Network (Singapore) Pte. Ltd.
+116.202.103.81|Hetzner Online GmbH
+116.202.176.26|Hetzner Online GmbH
+116.202.5.154|AdGuard Hetzner Online GmbH
+116.203.115.225|Hetzner Online GmbH
+116.203.252.132|Argon Hetzner Online GmbH
+116.203.84.65|Hetzner Online GmbH
+116.204.133.163|Beijing Xiangyun Youxin Network Technology Co., Ltd China
+116.251.216.207|OneAsiaHost
+117.121.132.21|CHINA UNICOM China169 Backbone. Warning: Don't use.
+118.163.170.2|Chunghwa Telecom Co., Ltd.
+118.27.108.140|GMO Internet, Inc.
+118.31.37.173|Hangzhou Alibaba Advertising Co.,Ltd. China.
+119.147.179.244|CHINANET-BACKBONE
+119.28.59.205|Tencent Building, Kejizhongyi Avenue
+119.28.63.83|Tencent Building, Kejizhongyi Avenue
+119.28.74.44|Tencent Building, Kejizhongyi Avenue
+12.20.116.40|AT&T Services, Inc.
+121.196.195.196|Hangzhou Alibaba Advertising Co.,Ltd. China.
+121.196.222.74|Hangzhou Alibaba Advertising Co.,Ltd. China.
+121.199.79.161|Hangzhou Alibaba Advertising Co.,Ltd. China.
+122.194.14.150|CHINA UNICOM China169 Backbone. Warning: Don't use.
+122.47.239.35.bc.googleusercontent.com|Google LLC
+128.140.15.70|Hetzner Online GmbH
+128.199.154.113|DigitalOcean, LLC
+129.204.180.173|Shenzhen Tencent Computer Systems Company Limited
+129.226.3.121|Tencent Building, Kejizhongyi Avenue
+129.232.183.24|Xneelo (Pty) Ltd
+13.86.5.235|Microsoft Corporation
+130.162.152.54|Oracle Corporation. Korea
+130.61.69.193|Oracle Corporation
+130.61.93.4|Oracle Corporation
+130.81.190.35.bc.googleusercontent.com|Google LLC
+131.100.2.149|ANEXIA Internetdienstleistungs GmbH
+132.145.125.32|Oracle Corporation. Japan
+132.145.80.242|Oracle Corporation
+133.130.118.103|GMO Internet, Inc.
+133.130.98.250|GMO Internet, Inc.
+134.169.34.57|Technische Universitaet Carolo-Wilhelmina zu Braunschweig
+136.244.97.114|The Constant Company, LLC
+137.66.6.146|Fly.io, Inc.
+137.66.7.89|Fly.io, Inc.
+137.74.29.10|OVH SAS
+138.122.197.208|EDGE4M CONSULTORIA EM INFRAESTRUTURA LTDA.
+138.122.197.217|EDGE4M CONSULTORIA EM INFRAESTRUTURA LTDA.
+138.2.123.220|Oracle Corporation. Korea
+138.2.70.22|Oracle Corporation. Singapore
+138.236.128.100|Gustavus Adolphus College
+138.68.197.35.bc.googleusercontent.com|Google LLC
+138.69.200.32|Atos IT Solutions and Services Inc
+139.1.158.81|operational services GmbH & Co. KG
+139.199.193.210|Shenzhen Tencent Computer Systems Company Limited
+139.199.33.37|Shenzhen Tencent Computer Systems Company Limited
+139.59.223.113|DigitalOcean, LLC
+14.238.212.91.rev.sfr.net|Avions Transport Regional
+140.238.10.79|Oracle Public Cloud
+140.238.122.203|Oracle Corporation
+140.238.159.230|Oracle Corporation
+140.238.174.12|Oracle Corporation
+140.238.21.36|Oracle Corporation. Korea
+140.238.215.120|Oracle Corporation
+140.238.220.58|Oracle Corporation
+140.238.228.220|Oracle Corporation
+140.238.28.191|Oracle Corporation
+140.238.3.36|Oracle Corporation
+140.238.53.212|Oracle Corporation
+140.83.53.18|Oracle Corporation. Japan
+140.83.85.107|Oracle Corporation
+141.144.198.86|Oracle Corporation. United Kingdom
+141.147.102.224|Oracle Corporation. United Kingdom
+141.94.89.163|OVH SAS
+142.93.248.50|DigitalOcean, LLC
+143.244.33.74|Datacamp Limited
+144.172.119.31|Data Ideas llc.
+144.178.199.16.static.ef-service.nl|Eurofiber Nederland BV
+144.24.195.236|Oracle Corporation. France
+146.112.41.2|Cisco OpenDNS LLC
+146.112.41.4|Cisco OpenDNS LLC
+146.56.176.39|Oracle Corporation
+146.70.31.43|M247 LTD
+146.70.66.227|M247 Europe SRL
+147.139.198.66|Alibaba (US) Technology Co., Ltd. China.
+147.87.0.11|SWITCH
+147.87.0.14|SWITCH
+149.112.112.10|Quad9
+149.112.112.112|Quad9
+149.112.112.11|Quad9
+149.112.112.12|Quad9
+149.112.112.13|Quad9
+149.112.112.9|Quad9
+149.112.149.112|Quad9
+149.129.124.211|Alibaba (US) Technology Co., Ltd. China.
+149.129.239.2|Alibaba (US) Technology Co., Ltd. China.
+149.28.101.119|The Constant Company, LLC
+149.56.228.45|OVH SAS
+15.165.113.96|AWS Asia Pacific (Seoul) Region
+15.204.209.29|OVH US LLC
+15.235.141.22|OVH Singapore PTE. LTD
+150.136.50.17|Oracle Corporation
+150.230.147.2|Oracle Corporation
+150.230.232.136|Oracle Corporation
+150.230.8.60|Oracle Corporation
+150.25.83.34.bc.googleusercontent.com|Google LLC
+151.181.237.20|I-Evolve Technology Services
+151.181.237.21|I-Evolve Technology Services
+152.67.10.83|Oracle Public Cloud
+152.67.114.17|Oracle Corporation
+152.67.199.120|Oracle Corporation
+152.67.223.4|Oracle Corporation. Korea
+152.67.229.20|Oracle Corporation
+152.69.197.76|Oracle Corporation. Japan
+152.69.198.226|Oracle Corporation
+152.69.204.152|Oracle Corporation
+152.70.110.254|Oracle Corporation
+154.121.2.53|Telecom Algeria
+155.254.21.250|H4Y Technologies LLC
+156.251.165.134|CNSERVERS LLC
+157.245.36.211|DigitalOcean, LLC
+157.90.124.62|Hetzner Online GmbH
+158.101.195.71|Oracle Corporation
+158.101.2.228|Oracle Corporation
+158.101.3.197|Oracle Corporation
+160.119.253.209|Host Africa (Pty) Ltd
+160.119.72.32|Per-Ola Kjell Hammar
+160.156.229.35.bc.googleusercontent.com|Google LLC
+160.16.53.149|SAKURA Internet Inc.
+161.210.250.2|Des Moines Area Community College
+161.210.250.7|Des Moines Area Community College
+161.210.250.8|Des Moines Area Community College
+162.159.36.1|Cloudflare, Inc.
+163.47.117.176|Network Presence
+164.90.161.84|DigitalOcean, LLC
+164.90.253.10|DigitalOcean, LLC
+165.231.253.163|Fiber Grid INC. India
+165.232.130.184|DigitalOcean, LLC
+165.232.162.84|DigitalOcean, LLC
+167-222-145-85.ftth.glasoperator.nl|tmobile thuis
+167.114.220.125|OVH Hosting, Inc.
+167.16.33.136|Fiserv Solutions, LLC
+167.16.33.165|Fiserv Solutions, LLC
+167.16.34.150|Fiserv Solutions, LLC
+167.16.34.154|Fiserv Solutions, LLC
+167.16.34.171|Fiserv Solutions, LLC
+167.16.66.134|Fiserv Solutions, LLC
+167.172.40.40|DigitalOcean, LLC
+167.235.155.255|Hetzner Online GmbH
+167.6.236.224|International Truck and Engine Corp
+168.119.160.80|Hetzner Online GmbH
+168.138.192.72|Oracle Corporation
+168.138.209.89|Oracle Corporation
+168.138.210.32|Oracle Corporation
+168.138.250.131|Oracle Corporation
+168.235.64.166|InMotion Hosting, Inc.
+17.253.96.85|Apple Inc.
+170.10.136.54|Mimecast North America Inc
+170.10.144.54|Mimecast North America Inc
+170.176.145.150|InTouch Health
+170.176.148.150|InTouch Health
+172.104.113.58|Linode
+172.104.205.174|Akamai Technologies, Inc. Germany
+172.105.52.109|Akamai Technologies, Inc. India
+172.107.154.211|Psychz Networks. South Korea
+172.65.220.168|Cloudflare, Inc.
+172.67.137.18|Cloudflare, Inc. (CDN)
+172.67.149.152|Cloudflare, Inc. (CDN)
+172.81.108.146|Zenlayer Inc
+172.83.159.59|Spartan Host Ltd
+172.93.220.162|Owl Limited
+175.176.163.240|Varnion Technology Semesta, PT
+175.24.154.191|Shenzhen Tencent Computer Systems Company Limited
+176.103.130.130|AdGuard. Filter: Default
+176.103.130.131|AdGuard.
+176.103.130.132|AdGuard.
+176.103.130.134|AdGuard.
+176.125.239.112|Windscribe
+176.125.239.113|Windscribe
+176.125.239.115|Windscribe
+176.125.239.11|Windscribe
+176.125.239.140|Windscribe
+176.125.239.159|Windscribe
+176.125.239.165|Windscribe
+176.125.239.167|Windscribe
+176.125.239.170|Windscribe
+176.125.239.174|Windscribe
+176.125.239.179|Windscribe
+176.125.239.180|Windscribe
+176.125.239.185|Windscribe
+176.125.239.195|Windscribe
+176.125.239.198|Windscribe
+176.125.239.203|Windscribe
+176.125.239.219|Windscribe
+176.125.239.227|Windscribe
+176.125.239.228|Windscribe
+176.125.239.229|Windscribe
+176.125.239.22|Windscribe
+176.125.239.230|Windscribe
+176.125.239.239|Windscribe
+176.125.239.246|Windscribe
+176.125.239.249|Windscribe
+176.125.239.253|Windscribe
+176.125.239.39|Windscribe
+176.125.239.52|Windscribe
+176.125.239.63|Windscribe
+176.125.239.66|Windscribe
+176.125.239.87|Windscribe
+176.99.77.224|OtradnoeNet Ltd.
+178.175.129.16|Trabia SRL
+178.216.201.128|Beyond.pl sp. z o.o.
+179.221.73.86.rev.sfr.net|Societe Francaise Du Radiotelephone - SFR SA
+18.113.223.35.bc.googleusercontent.com|Google LLC
+180.163.223.231|China Telecom (Group). Warning: Don't use.
+180.163.223.233|China Telecom (Group). Warning: Don't use.
+180.163.223.236|China Telecom (Group). Warning: Don't use.
+180.163.249.75|China Telecom (Group). Warning: Don't use.
+183.171.200.172|Celcom Axiata Berhad
+185.103.117.76|1 Click Services Limited
+185.117.118.20|Oy Creanova Hosting Solutions Ltd.
+185.12.88.178|SWN Stadtwerke Neumuenster GmbH
+185.12.88.179|SWN Stadtwerke Neumuenster GmbH
+185.12.88.92|SWN Stadtwerke Neumuenster GmbH
+185.12.88.93|SWN Stadtwerke Neumuenster GmbH
+185.132.89.59.servers.ipv4.ticae.net|TICAE TELECOM S.L.
+185.134.196.54|Faelix Limited
+185.134.196.55|Faelix Limited
+185.137.83.14|Athora Netherlands N.V.
+185.156.205.20|Michael Kloos
+185.17.3.188|First Server Limited. Russia
+185.180.206.110|Cyber_Folks S.A.
+185.185.69.93|SPRINTHOST.RU LLC
+185.194.94.71|Luxembourg House of Cybersecurity
+185.204.2.8|First Server Limited
+185.210.2.70|Swisscom (Schweiz) AG
+185.210.2.71|Swisscom (Schweiz) AG
+185.22.154.19|LLC Baxet
+185.222.222.222|xTom
+185.223.163.53|Jeroen van Brink trading as Infrapod
+185.223.163.54|Jeroen van Brink trading as Infrapod
+185.223.163.55|Jeroen van Brink trading as Infrapod
+185.229.20.47|CloudCoCo Connect Limited
+185.229.226.28|O.M.C. COMPUTERS & COMMUNICATIONS LTD
+185.243.214.88|MVPS LTD
+185.244.27.53|vServer.site LTD
+185.247.117.121|LeaseWeb Netherlands B.V.
+185.247.225.17|Flokinet Ltd
+185.40.106.78|EdgeUno, Inc
+185.56.27.1|CSTI SA
+185.58.84.198|Mimecast Services Limited
+185.58.87.203|Mimecast Services Limited
+185.66.143.178|KnownSRV Ltd.
+185.88.160.25|Active business systems Ltd. Russia
+188.114.96.7|Cloudflare, Inc. (CDN)
+188.114.97.7|Cloudflare, Inc. (CDN)
+188.165.20.42|OVH SAS
+188.172.213.149|ANEXIA Internetdienstleistungs GmbH
+188.244.117.114|HostHatch LLC
+188.34.189.88|Hetzner Online GmbH
+188.68.33.96|netcup GmbH
+191-204-50-195.sta.estpak.ee|Telia Eesti AS
+192.73.252.11|NetActuate, Inc
+193.112.16.45|Tencent Cloud Computing (Beijing) Co., Ltd. China
+193.122.96.153|Oracle Corporation
+193.150.121.28|SIGTERM MIKAL VILLA
+193.180.80.10|Blocka AB
+193.189.171.12|Telekom Slovenije, d.d.
+193.190.182.53|Belnet Services
+193.190.198.16|BELNET
+193.70.85.11|OVH SAS FR
+194.0.5.3|Stichting Internet Domeinregistratie Nederland
+194.100.93.136|Lastentarvike Oy
+194.120.150.10|msg life central europe gmbh
+194.120.150.30|M-net Telekommunikations GmbH
+194.120.150.38|msg life central europe gmbh
+194.191.40.97|green.ch AG
+194.191.40.98|green.ch AG
+194.204.251.13|Sicpagss Morocco
+194.204.251.3|Sicpagss Morocco
+194.242.2.2|31173 Services AB
+194.87.238.247|JSC Mediasoft ekspert. Russia
+195.12.48.171|M247 Europe SRL
+195.161.115.16|JSC RTComm.RU
+195.186.208.42|Swisscom (Schweiz) AG
+195.186.208.53|Swisscom (Schweiz) AG
+195.20.240.100|IONOS SE
+195.222.59.86|BH Telecom d.d. Sarajevo
+195.228.221.131|Magyar Telekom plc.
+195.228.221.132|Magyar Telekom plc.
+195.228.221.3|Magyar Telekom plc.
+195.244.44.45|Netdirekt A.S.
+195.50.204.191|Telia Eesti AS
+196.20.72.29|Telecom Algeria
+197.227.1.202|Mauritius Telecom Ltd
+198.12.65.34.bc.googleusercontent.com|Google LLC
+198.211.105.28|DigitalOcean, LLC
+198.35.26.6|Wikimedia Foundation Inc.
+198.54.117.10|Namecheap
+198.7.58.227|Leaseweb USA, Inc.
+199.180.130.39|Wow Internet Indonesia
+199.219.227.35.bc.googleusercontent.com|Google LLC
+1a.ns.ozer.im|OVH SAS
+1dot1dot1dot1.cloudflare-dns.com|Cloudflare, Inc.
+2.1.ad.mrs.pch.net|WoodyNet, Inc.
+2.238.212.91.rev.sfr.net|Avions Transport Regional
+2.dnscrypt-cert.altername|Altername
+2.dnscrypt-cert.ams-dnscrypt-nl|Ams NL
+2.dnscrypt-cert.b33.network|OVH SAS DE
+2.dnscrypt-cert.blahdns.com|HostHatch, LLC. Switzerland
+2.dnscrypt-cert.browser.yandex.net|Yandex
+2.dnscrypt-cert.chewbacca.meganerd.nl|The Constant Company, LLC
+2.dnscrypt-cert.cryptostorm.is|Leaseweb Deutschland GmbH
+2.dnscrypt-cert.dct-at1|Hohl IT e.U. AT
+2.dnscrypt-cert.dct-nl1|Hohl IT e.U. NL
+2.dnscrypt-cert.dct-ru1|Hohl IT e.U. RU
+2.dnscrypt-cert.DeCloudUs-test|Hetzner Online GmbH
+2.dnscrypt-cert.deffer-dns.au|Amazon.com, Inc. AU
+2.dnscrypt-cert.dns.tiar.app|Myrepublic Limited. SG
+2.dnscrypt-cert.dnscrypt.be|BELNET BE
+2.dnscrypt-cert.dnscrypt.ca-1-ipv6|OVH SAS. CA IPv6
+2.dnscrypt-cert.dnscrypt.ca-1|OVH SAS. CA
+2.dnscrypt-cert.dnscrypt.ca-2-ipv6|OVH SAS. CA IPv6 2
+2.dnscrypt-cert.dnscrypt.ca-2|OVH SAS. CA 2
+2.dnscrypt-cert.dnscrypt.pl|Beyond.pl sp. z o.o. PL
+2.dnscrypt-cert.dnscrypt.uk|DigitalOcean, LLC. UK
+2.dnscrypt-cert.dnswarden-uncensored-anycast|Fly.io, Inc. Filter: Uncensored
+2.dnscrypt-cert.dnswarden-uncensored-swiss|DNS Warden. Filter: Uncensored Swiss
+2.dnscrypt-cert.ffmuc.net|Freie Netze Muenchen e.V.
+2.dnscrypt-cert.fr.dnscrypt.org|ONLINE S.A.S. FR
+2.dnscrypt-cert.helios.plan9-dns.com|The Constant Company, LLC. MX
+2.dnscrypt-cert.ibksturm|Datapark AG Switzerland
+2.dnscrypt-cert.jp.tiar.app|Myrepublic Limited. JP
+2.dnscrypt-cert.kronos.plan9-dns.com|The Constant Company, LLC. US
+2.dnscrypt-cert.opendns.com|Cisco Technology, Inc. US
+2.dnscrypt-cert.openinternet|Sonic.net, LLC
+2.dnscrypt-cert.oszx.co|OVH SAS
+2.dnscrypt-cert.pluton.plan9-dns.com|The Constant Company, LLC. US
+2.dnscrypt-cert.pryv8boi.org|Contabo GmbH
+2.dnscrypt-cert.quad9.net|Quad9
+2.dnscrypt-cert.rdns.faelix.net|Faelix Limited. Switzerland
+2.dnscrypt-cert.safesurfer.co.nz|Google Cloud
+2.dnscrypt-cert.saldns01.typeq.org|GMO Internet, Inc. JP 1
+2.dnscrypt-cert.saldns02.typeq.org|GMO Internet, Inc. JP 2
+2.dnscrypt-cert.saldns03.typeq.org|GMO Internet, Inc. JP 3
+2.dnscrypt-cert.sby-limotelu|Wow Internet Indonesia
+2.dnscrypt-cert.scaleway-ams|ONLINE S.A.S.
+2.dnscrypt-cert.secure.dns.test|Datacamp Limited
+2.dnscrypt-cert.serbica|KnownSRV Ltd. NL
+2.dnscrypt-cert.sfw.scaleway-fr|ONLINE S.A.S. FR
+2.dnscrypt-cert.shield-2.dnsbycomodo.com|Comodo DNS
+2.dnscrypt-cert.starrydns.planet|Amazon.com, Inc.
+2.dnscrypt-cert.sth-dnscrypt-se|MVPS LTD. SE
+2.dnscrypt-cert.techsaviours.org|netcup GmbH
+2.dnscrypt-cert.userspace-bne|Mammoth Media Pty Ltd
+2.dnscrypt-cert.userspace-mel|Mammoth Media Pty Ltd
+2.dnscrypt-cert.v.dnscrypt.uk|The Constant Company, LLC
+2.dnscrypt.default.ns1.adguard.com|AdGuard. Filter: Default
+2.dnscrypt.family.ns1.adguard.com|AdGuard. Filter: Family
+2.dnscrypt.unfiltered.ns1.adguard.com|AdGuard. Filter: Unfiltered
+20.186.51.78|Microsoft Corporation
+20.42.80.49|Microsoft Corporation
+202.123.24.197|Mauritius Telecom Ltd
+202.232.2.32|Internet Initiative Japan Inc.
+202.61.199.183|netcup GmbH
+203.162.172.59|VNPT Corp
+203.180.146.11|Internet Initiative Japan Inc.
+203.180.146.12|Internet Initiative Japan Inc.
+203.180.146.13|Internet Initiative Japan Inc.
+203.180.146.203|Internet Initiative Japan Inc.
+203.180.146.208|Internet Initiative Japan Inc.
+203.180.146.214|Internet Initiative Japan Inc.
+203.180.146.216|Internet Initiative Japan Inc.
+203.180.146.221|Internet Initiative Japan Inc.
+203.29.240.52|Mammoth Media Pty Ltd
+203.29.241.76|Mammoth Media Pty Ltd
+204.9.92.87|PBW Communications, LLC
+206.189.185.210|DigitalOcean, LLC
+207.154.225.150|DigitalOcean, LLC
+207.246.68.103|The Constant Company, LLC
+207.246.87.96|The Constant Company, LLC
+208.67.220.123|OpenDNS
+208.67.220.220|OpenDNS
+208.67.222.123|OpenDNS
+208.67.222.222|OpenDNS
+209.177.158.15|NetActuate, Inc
+209.177.158.248|NetActuate, Inc
+210.128.97.204|Internet Initiative Japan Inc.
+210.128.97.215|Internet Initiative Japan Inc.
+210.128.97.217|Internet Initiative Japan Inc.
+210.128.97.218|Internet Initiative Japan Inc.
+210.128.97.222|Internet Initiative Japan Inc.
+210.128.97.74|Internet Initiative Japan Inc.
+210.128.97.75|Internet Initiative Japan Inc.
+210.128.97.76|Internet Initiative Japan Inc.
+210.128.97.85|Internet Initiative Japan Inc.
+210.128.97.88|Internet Initiative Japan Inc.
+210.128.97.89|Internet Initiative Japan Inc.
+210.130.0.1|Internet Initiative Japan Inc.
+210.130.0.3|Internet Initiative Japan Inc.
+210.130.0.70|Internet Initiative Japan Inc.
+210.138.123.105|Internet Initiative Japan Inc.
+210.138.123.107|Internet Initiative Japan Inc.
+210.138.123.111|Internet Initiative Japan Inc.
+210.138.123.75|Internet Initiative Japan Inc.
+210.138.123.76|Internet Initiative Japan Inc.
+210.138.123.78|Internet Initiative Japan Inc.
+210.246.144.15|SAMART Corp (Excise-Direct Coding Data Center)
+212.129.233.158|Shenzhen Tencent Computer Systems Company Limited
+212.227.205.78|IONOS SE
+212.51.138.251|Init7 (Switzerland) Ltd.
+212.86.101.213|Zomro B.V.
+213.139.211.36|Beget LLC
+213.250.27.12|Telekom Slovenije, d.d.
+213.28.27.19|Telia Finland Oyj
+213.28.27.20|Telia Finland Oyj
+213.61.254.39|COLT Technology Services Group Limited
+213.61.254.40|COLT Technology Services Group Limited
+213.61.254.41|COLT Technology Services Group Limited
+213.61.254.42|COLT Technology Services Group Limited
+213.61.254.44|COLT Technology Services Group Limited
+216.145.220.15|Mimecast North America Inc
+216.145.223.15|Mimecast North America Inc
+216.238.80.219|The Constant Company, LLC
+216.98.99.105|Internet Initiative Japan Inc.
+216.98.99.110|Internet Initiative Japan Inc.
+217.0.43.114|Deutsche Telekom AG
+217.0.43.50|Deutsche Telekom AG
+217.0.43.66|Deutsche Telekom AG
+217.146.107.8|Merula Limited
+217.146.11.49|ANEXIA Internetdienstleistungs GmbH
+217.160.249.29|IONOS SE
+217.160.25.182|IONOS SE
+217.160.44.149|IONOS SE
+217.160.68.68|IONOS SE
+217.169.20.22|Andrews and Arnold LTD
+217.31.204.205|CZ.NIC, z.s.p.o.
+217.66.37.24|Hessischer Rundfunk
+217.66.37.27|Hessischer Rundfunk
+219.222.181.16|China Education and Research Network Center. Warning: Don't use.
+22.238.212.91.rev.sfr.net|Avions Transport Regional
+220-135-66-164.hinet-ip.hinet.net|Data Communication Business Group
+220.134.23.41|Chunghwa Telecom Co. Ltd.
+220.135.66.164|Chunghwa Telecom Co., Ltd.
+221.228.217.28|Chinanet Jiangsu. China
+222.124.173.197|PT Telekomunikasi Indonesia
+222.88.72.38|CHINANET-BACKBONE
+224.73.73.34.bc.googleusercontent.com|Google LLC
+225.99.198.104.bc.googleusercontent.com|Google LLC
+23.100.95.102|Microsoft Corporation
+23.129.64.123|Emerald Onion
+23.137.249.116|IncogNET LLC
+23.19.245.84|LeaseWeb USA, Inc. New York
+23.21.43.50|Smart DNS Proxy
+23.96.234.212|Microsoft Corporation
+232.ablak.arnes.si|ARNES
+236.162.211.35.bc.googleusercontent.com|Google LLC
+236.202.2.109.rev.sfr.net|Societe Francaise Du Radiotelephone - SFR SA
+24.238.212.91.rev.sfr.net|Avions Transport Regional
+24.245.113.167|BCI Mississippi Broadband, LLC
+240.159.72.34.bc.googleusercontent.com|Google LLC
+247.32.82.34.bc.googleusercontent.com|Google LLC
+3.10.65.124|Amazon Technologies Inc. (EC2)
+31.130.200.100|DataHata Ltd
+35.57.199.35.bc.googleusercontent.com|Google LLC
+36.110.215.164|IDC, China Telecommunications Corporation. Warning: Don't use.
+36.99.170.86|Luoyang, Henan Province, P.R.China. Warning: Don't use.
+37.120.183.220|netcup GmbH
+37.139.26.4|DigitalOcean, LLC
+38.147.175.191|XNNET LLC
+38.238.212.91.rev.sfr.net|Avions Transport Regional
+39.100.20.1|Hangzhou Alibaba Advertising Co.,Ltd. China.
+39.103.26.198|Hangzhou Alibaba Advertising Co.,Ltd. China.
+39.103.26.199|Hangzhou Alibaba Advertising Co.,Ltd. China.
+39.98.133.171|Hangzhou Alibaba Advertising Co.,Ltd. China.
+4.1.ad.iad.pch.net|WoodyNet, Inc.
+40.114.217.81|Microsoft Corporation
+40.142.96.34.bc.googleusercontent.com|Google LLC
+40.76.112.230|Microsoft Corporation
+41.203.89.3|Globacom Limited
+41.74.196.54|Mimecast South Africa
+41.76.40.254|EMTEL LIMITED
+41.76.43.96|EMTEL LIMITED
+41.76.44.108|EMTEL LIMITED
+43.218.93.13|Amazon Technologies Inc. (EC2)
+45.11.45.11|xTom
+45.117.103.234|xTom
+45.125.0.53|xTom
+45.125.0.88|xTom
+45.14.106.6|xTom
+45.151.167.2|Artikel10 e.V.
+45.151.175.112|Prager Connect GmbH
+45.153.187.96|MVPS LTD
+45.155.169.132|SERVERD SAS
+45.60.186.33|Incapsula Inc
+45.79.102.67|Akamai Technologies, Inc. USA
+45.90.29.0|nextdns, Inc.
+45.90.29.100|nextdns, Inc.
+45.90.29.101|nextdns, Inc.
+45.90.29.102|nextdns, Inc.
+45.90.29.103|nextdns, Inc.
+45.90.29.105|nextdns, Inc.
+45.90.29.106|nextdns, Inc.
+45.90.29.10|nextdns, Inc.
+45.90.29.112|nextdns, Inc.
+45.90.29.114|nextdns, Inc.
+45.90.29.116|nextdns, Inc.
+45.90.29.118|nextdns, Inc.
+45.90.29.119|nextdns, Inc.
+45.90.29.120|nextdns, Inc.
+45.90.29.122|nextdns, Inc.
+45.90.29.123|nextdns, Inc.
+45.90.29.124|nextdns, Inc.
+45.90.29.125|nextdns, Inc.
+45.90.29.126|nextdns, Inc.
+45.90.29.128|nextdns, Inc.
+45.90.29.129|nextdns, Inc.
+45.90.29.12|nextdns, Inc.
+45.90.29.130|nextdns, Inc.
+45.90.29.131|nextdns, Inc.
+45.90.29.132|nextdns, Inc.
+45.90.29.13|nextdns, Inc.
+45.90.29.140|nextdns, Inc.
+45.90.29.141|nextdns, Inc.
+45.90.29.142|nextdns, Inc.
+45.90.29.148|nextdns, Inc.
+45.90.29.149|nextdns, Inc.
+45.90.29.14|nextdns, Inc.
+45.90.29.155|nextdns, Inc.
+45.90.29.156|nextdns, Inc.
+45.90.29.15|nextdns, Inc.
+45.90.29.163|nextdns, Inc.
+45.90.29.167|nextdns, Inc.
+45.90.29.169|nextdns, Inc.
+45.90.29.16|nextdns, Inc.
+45.90.29.171|nextdns, Inc.
+45.90.29.174|nextdns, Inc.
+45.90.29.177|nextdns, Inc.
+45.90.29.178|nextdns, Inc.
+45.90.29.179|nextdns, Inc.
+45.90.29.17|nextdns, Inc.
+45.90.29.180|nextdns, Inc.
+45.90.29.181|nextdns, Inc.
+45.90.29.188|nextdns, Inc.
+45.90.29.190|nextdns, Inc.
+45.90.29.191|nextdns, Inc.
+45.90.29.192|nextdns, Inc.
+45.90.29.193|nextdns, Inc.
+45.90.29.195|nextdns, Inc.
+45.90.29.196|nextdns, Inc.
+45.90.29.197|nextdns, Inc.
+45.90.29.1|nextdns, Inc.
+45.90.29.203|nextdns, Inc.
+45.90.29.204|nextdns, Inc.
+45.90.29.207|nextdns, Inc.
+45.90.29.209|nextdns, Inc.
+45.90.29.20|nextdns, Inc.
+45.90.29.211|nextdns, Inc.
+45.90.29.212|nextdns, Inc.
+45.90.29.214|nextdns, Inc.
+45.90.29.215|nextdns, Inc.
+45.90.29.217|nextdns, Inc.
+45.90.29.223|nextdns, Inc.
+45.90.29.225|nextdns, Inc.
+45.90.29.229|nextdns, Inc.
+45.90.29.233|nextdns, Inc.
+45.90.29.234|nextdns, Inc.
+45.90.29.237|nextdns, Inc.
+45.90.29.23|nextdns, Inc.
+45.90.29.244|nextdns, Inc.
+45.90.29.245|nextdns, Inc.
+45.90.29.246|nextdns, Inc.
+45.90.29.248|nextdns, Inc.
+45.90.29.250|nextdns, Inc.
+45.90.29.251|nextdns, Inc.
+45.90.29.25|nextdns, Inc.
+45.90.29.27|nextdns, Inc.
+45.90.29.31|nextdns, Inc.
+45.90.29.33|nextdns, Inc.
+45.90.29.35|nextdns, Inc.
+45.90.29.36|nextdns, Inc.
+45.90.29.38|nextdns, Inc.
+45.90.29.44|nextdns, Inc.
+45.90.29.47|nextdns, Inc.
+45.90.29.50|nextdns, Inc.
+45.90.29.57|nextdns, Inc.
+45.90.29.62|nextdns, Inc.
+45.90.29.63|nextdns, Inc.
+45.90.29.67|nextdns, Inc.
+45.90.29.69|nextdns, Inc.
+45.90.29.71|nextdns, Inc.
+45.90.29.75|nextdns, Inc.
+45.90.29.76|nextdns, Inc.
+45.90.29.77|nextdns, Inc.
+45.90.29.79|nextdns, Inc.
+45.90.29.7|nextdns, Inc.
+45.90.29.85|nextdns, Inc.
+45.90.29.86|nextdns, Inc.
+45.90.29.88|nextdns, Inc.
+45.90.29.8|nextdns, Inc.
+45.90.29.90|nextdns, Inc.
+45.90.29.91|nextdns, Inc.
+45.90.29.93|nextdns, Inc.
+45.90.29.96|nextdns, Inc.
+45.90.29.98|nextdns, Inc.
+45.90.29.99|nextdns, Inc.
+45.90.31.102|nextdns, Inc.
+45.90.31.124|nextdns, Inc.
+45.90.31.125|nextdns, Inc.
+45.90.31.127|nextdns, Inc.
+45.90.31.128|nextdns, Inc.
+45.90.31.148|nextdns, Inc.
+45.90.31.14|nextdns, Inc.
+45.90.31.151|nextdns, Inc.
+45.90.31.160|nextdns, Inc.
+45.90.31.165|nextdns, Inc.
+45.90.31.16|nextdns, Inc.
+45.90.31.172|nextdns, Inc.
+45.90.31.179|nextdns, Inc.
+45.90.31.17|nextdns, Inc.
+45.90.31.182|nextdns, Inc.
+45.90.31.184|nextdns, Inc.
+45.90.31.185|nextdns, Inc.
+45.90.31.188|nextdns, Inc.
+45.90.31.199|nextdns, Inc.
+45.90.31.19|nextdns, Inc.
+45.90.31.203|nextdns, Inc.
+45.90.31.210|nextdns, Inc.
+45.90.31.213|nextdns, Inc.
+45.90.31.218|nextdns, Inc.
+45.90.31.220|nextdns, Inc.
+45.90.31.221|nextdns, Inc.
+45.90.31.222|nextdns, Inc.
+45.90.31.232|nextdns, Inc.
+45.90.31.234|nextdns, Inc.
+45.90.31.235|nextdns, Inc.
+45.90.31.240|nextdns, Inc.
+45.90.31.247|nextdns, Inc.
+45.90.31.253|nextdns, Inc.
+45.90.31.25|nextdns, Inc.
+45.90.31.2|nextdns, Inc.
+45.90.31.31|nextdns, Inc.
+45.90.31.35|nextdns, Inc.
+45.90.31.3|nextdns, Inc.
+45.90.31.41|nextdns, Inc.
+45.90.31.43|nextdns, Inc.
+45.90.31.44|nextdns, Inc.
+45.90.31.48|nextdns, Inc.
+45.90.31.59|nextdns, Inc.
+45.90.31.69|nextdns, Inc.
+45.90.31.73|nextdns, Inc.
+45.90.31.74|nextdns, Inc.
+45.90.31.9|nextdns, Inc.
+45.91.92.121|HostHatch, LLC
+46.101.126.246|DigitalOcean, LLC
+46.102.157.110|Hohl IT e.U.
+46.17.107.180|First Server Limited
+46.213.forpsi.net|INTERNET CZ, a.s.
+46.22.220.49|Aktsiaselts WaveCom
+46.226.108.173|GANDI SAS
+46.227.200.54|Faelix Limited
+46.38.234.60|netcup GmbH
+47.100.218.41|Hangzhou Alibaba Advertising Co.,Ltd. China.
+47.103.151.215|Hangzhou Alibaba Advertising Co.,Ltd. China.
+47.103.166.50|Hangzhou Alibaba Advertising Co.,Ltd. China.
+47.103.166.51|Hangzhou Alibaba Advertising Co.,Ltd. China.
+47.103.166.52|Hangzhou Alibaba Advertising Co.,Ltd. China.
+47.103.166.53|Hangzhou Alibaba Advertising Co.,Ltd. China.
+47.103.166.56|Hangzhou Alibaba Advertising Co.,Ltd. China.
+47.103.18.1|Hangzhou Alibaba Advertising Co.,Ltd. China.
+47.106.39.115|Alibaba Cloud. China
+47.108.0.45|Hangzhou Alibaba Advertising Co.,Ltd. China.
+47.108.0.57|Hangzhou Alibaba Advertising Co.,Ltd. China.
+47.108.0.58|Hangzhou Alibaba Advertising Co.,Ltd. China.
+47.108.130.22|Hangzhou Alibaba Advertising Co.,Ltd. China.
+47.241.168.38|Alibaba (US) Technology Co., Ltd. China.
+47.242.185.96|Alibaba (US) Technology Co., Ltd. China.
+47.243.107.132|Alibaba (US) Technology Co., Ltd. China.
+47.244.3.29|Alibaba (US) Technology Co., Ltd. China.
+47.254.160.160|Alibaba (US) Technology Co., Ltd. China.
+47.254.160.161|Alibaba (US) Technology Co., Ltd. China.
+47.254.64.251|Alibaba (US) Technology Co., Ltd. China.
+47.75.120.215|Alibaba (US) Technology Co., Ltd. China.
+49.229.0.115|Super Broadband Network
+49.229.0.46|Super Broadband Network
+5.1.32.212|Prisco Electronica S.L.
+5.1.32.33|Prisco Electronica S.L.
+5.1.84.150|meerfarbig GmbH & Co. KG
+5.2.72.7|Liteserver
+5.2.72.7|The Infrastructure Group B.V.
+5.2.75.75|The Infrastructure Group B.V.
+5.59.130.114|Timer, LLC
+5.61.37.171|Leaseweb Deutschland GmbH
+5.79.100.76|LeaseWeb Netherlands B.V.
+51-158-147-92.rev.poneytelecom.eu|ONLINE S.A.S.
+51.140.100.181|Microsoft Corporation
+51.140.186.154|Microsoft Corporation
+51.140.47.46|Microsoft Corporation
+51.158.147.92|Scaleway
+51.158.66.31|SCALEWAY S.A.S.
+51.159.67.129|SCALEWAY S.A.S.
+51.75.162.101|OVH SAS
+51.81.81.178|OVH SAS
+51.83.134.179|OVH Sp. z o. o
+51.83.70.82|AdGuard OVH SAS
+51.91.144.101|OVH SAS
+52.63.91.105|Amazon Technologies Inc
+54.229.171.243|Smart DNS Proxy
+54.79.3.18|Amazon Technologies Inc. (EC2)
+54.90.232.69|Amazon Technologies Inc. (EC2)
+56.70.66.34.bc.googleusercontent.com|Google LLC
+60.205.126.114|Hangzhou Alibaba Advertising Co.,Ltd. China.
+61-222-113-98.hinet-ip.hinet.net|Data Communication Business Group
+61.148.33.140|China Unicom Beijing Province Network. Warning: Don't use.
+62.84.27.109.rev.sfr.net|Societe Francaise Du Radiotelephone - SFR SA
+63.116.30.36|Conduent Business Services, LLC
+64.120.5.251|LeaseWeb USA, Inc. Seattle
+64.176.188.144|The Constant Company, LLC
+64.20.34.50|Interserver, Inc
+64.64.248.141.16clouds.com|Fiber Logic Inc.
+67.230.170.194.16clouds.com|IT7 Networks Inc
+67.230.177.135.16clouds.com|IT7 Networks Inc
+68.183.70.223|DigitalOcean, LLC
+68.95.199.107|AT&T Services, Inc.
+70.36.170.126|Sonic.net, LLC
+71.19.251.34|eSecureData
+72.44.207.101|Reliance Steel and Aluminum Co.
+72.44.68.88|MULTACOM CORPORATION
+75.75.77.23|Comcast Cable Communications, LLC
+75.75.77.24|Comcast Cable Communications, LLC
+75.75.77.25|Comcast Cable Communications, LLC
+75.75.77.28|Comcast Cable Communications, LLC
+75.75.77.2|Comcast Cable Communications, LLC
+75.75.77.31|Comcast Cable Communications, LLC
+75.75.77.32|Comcast Cable Communications, LLC
+75.75.77.36|Comcast Cable Communications, LLC
+75.75.77.4|Comcast Cable Communications, LLC
+75.75.77.5|Comcast Cable Communications, LLC
+75.75.77.6|Comcast Cable Communications, LLC
+76.76.10.0|CONTROLD INC.
+76.76.10.103|CONTROLD INC.
+76.76.10.119|CONTROLD INC.
+76.76.10.133|CONTROLD INC.
+76.76.10.134|CONTROLD INC.
+76.76.10.13|CONTROLD INC.
+76.76.10.157|CONTROLD INC.
+76.76.10.188|CONTROLD INC.
+76.76.10.197|CONTROLD INC.
+76.76.10.225|CONTROLD INC.
+76.76.10.234|CONTROLD INC.
+76.76.10.243|CONTROLD INC.
+76.76.10.248|CONTROLD INC.
+76.76.10.255|CONTROLD INC.
+76.76.10.33|CONTROLD INC.
+76.76.10.60|CONTROLD INC.
+76.76.10.66|CONTROLD INC.
+76.76.10.87|CONTROLD INC.
+76.76.10.89|CONTROLD INC.
+76.76.10.96|CONTROLD INC.
+76.76.2.11|CONTROLD INC.
+76.76.2.16|CONTROLD INC.
+76.76.2.215|CONTROLD INC.
+76.76.2.227|CONTROLD INC.
+76.76.2.248|CONTROLD INC.
+76.76.2.254|CONTROLD INC.
+76.76.2.27|CONTROLD INC.
+76.76.2.28|CONTROLD INC.
+76.76.2.30|CONTROLD INC.
+76.76.2.34|CONTROLD INC.
+76.76.2.47|CONTROLD INC.
+76.76.2.53|CONTROLD INC.
+76.76.2.55|CONTROLD INC.
+76.76.2.57|CONTROLD INC.
+76.76.2.67|CONTROLD INC.
+76.76.2.73|CONTROLD INC.
+76.76.2.85|CONTROLD INC.
+77.223.128.220|Netdirekt A.S.
+77.72.223.25|PFALZKOM GmbH
+77.88.8.78|Yandex LLC
+77.88.8.8|Yandex
+78.128.99.220|DA International Group Ltd.
+78.47.163.141|Hetzner Online GmbH
+79.110.170.43|Lasagna Ltd
+79.137.195.60|Aeza Group LLC
+79.143.181.69|Contabo GmbH
+8.129.77.255|Hangzhou Alibaba Advertising Co.,Ltd. China.
+8.131.52.117|Hangzhou Alibaba Advertising Co.,Ltd. China.
+8.208.2.64|Alibaba (US) Technology Co., Ltd. China.
+8.208.2.65|Alibaba (US) Technology Co., Ltd. China.
+8.210.73.205|Alibaba (US) Technology Co., Ltd. China.
+8.224.34.74|I-Evolve Technology Services
+8.238.212.91.rev.sfr.net|Avions Transport Regional
+8.8.4.4|Google LLC
+8.8.8.8|Google LLC
+80.124.140.158|Societe Francaise Du Radiotelephone - SFR SA
+80.124.140.240|Societe Francaise Du Radiotelephone - SFR SA
+80.125.161.101|Societe Francaise Du Radiotelephone - SFR SA
+80.149.229.107|Deutsche Telekom AG
+80.251.201.59|Hi3G Access AB
+80.251.201.7|Hi3G Access AB
+81-7-14-252.blue.kundencontroller.de|ISPpro Internet KG
+81.236.54.163|Telia Company AB
+81.236.54.167|Telia Company AB
+82-148-223-159.network.unet.nl|Eurofiber UNET
+82-148-223-195.network.unet.nl|Eurofiber UNET
+82-64-163-190.subs.proxad.net|Free SAS
+82-64-205-253.subs.proxad.net|Free SAS
+82.118.227.235|DA International Group Ltd.
+82.165.108.24|IONOS SE
+82.165.167.96|IONOS SE
+82.221.128.44|Icenetworks Ltd
+82.65.209.69|Proxad / Free SAS
+82.66.195.182|Proxad / Free SAS
+83.69.169.222|New-Com Trade Ltd. Russia
+83.69.169.69|New-Com Trade Ltd. Russia
+83.69.229.35.bc.googleusercontent.com|Google LLC
+85-206-156-199.static.zebra.lt|Telia Lietuva, AB
+85.19.227.35.bc.googleusercontent.com|Google LLC
+85.202.163.84|RadioBotsEU UG (haftungsbeschrankt)
+87.106.168.61|IONOS SE
+87.98.175.85|OVH SAS
+88.202.239.100|Free Pro SAS
+89.116.247.119|Limestone Networks, Inc.
+89.17.159.213|Hringdu ehf
+89.233.105.6|HIVELOCITY, Inc.
+89.38.131.38|MVPS LTD
+89.58.6.169|netcup GmbH
+9.9.9.10|Quad9
+9.9.9.11|Quad9
+9.9.9.12|Quad9
+9.9.9.9|Quad9
+91.198.156.20|Institute of Mathematics and Computer Science of University of Latvia
+91.205.230.224|HostRoyale Technologies Pvt Ltd
+91.217.86.4|Baumann Technologie GmbH
+91.230.110.173|Contabo GmbH
+92.223.109.19|EdgeCenter LLC Russia
+92.255.74.20|LLC "Lenvendo-Soft"
+92.63.32.2|MGK Rafal Chmielewski
+92.63.32.3|MGK Rafal Chmielewski
+93.55.192.228|Fastweb SpA
+94.130.135.203|Hetzner Online GmbH
+94.140.14.140:5443|AdGuard. Filter: Unfiltered
+94.140.14.14:5443|AdGuard. Filter: Default
+94.198.41.235|M247 Vienna
+94.249.164.188|GHOSTnet GmbH
+95.209.200.69|Hi3G Access AB
+95.216.138.8|HETZNER-DC. Finland
+95.216.161.62|Hetzner Online GmbH
+95.216.184.241|Hetzner Online GmbH
+95.216.209.165|BELNET
+95.216.74.89|Hetzner Online GmbH
+99.215.102.34.bc.googleusercontent.com|Google LLC
+a-bld.sys-adm.in|Vdsina Hosting technology LTD
+a.hdns.io|Mach Dilemma, LLC
+a104-72-79-18.deploy.static.akamaitechnologies.com|Akamai International B.V.
+a104-72-79-34.deploy.static.akamaitechnologies.com|Akamai International B.V.
+a104-72-79-41.deploy.static.akamaitechnologies.com|Akamai International B.V.
+a104-72-79-8.deploy.static.akamaitechnologies.com|Akamai International B.V.
+a42b07755bff06f8f.awsglobalaccelerator.com|Amazon.com, Inc.
+abbott.hubwoo.com|PROACTIS SA
+abel.waringer-atg.de|netcup GmbH
+access.snapon.com|Incapsula Inc
+ada.openbld.net|DA International Group Ltd
+adb-home.xaoimoon.fr|Free SAS
+adblock.doh.mullvad.net|Mullvad VPN AB. Filter: Adblock
+addguard.greenet.id|PT GREEN NET INDONESIA
+addns.jpr.space|Greek Research and Technology Network S.A
+adfree.usableprivacy.net|Hetzner Online GmbH
+adg.geili.me|ShenZhen QiTeng technology company limited
+adg.jnorton.us|Linode
+adguard-dns.rouga.ch|Oracle Corporation
+adguard.avdkishore.dev|Akamai Technologies, Inc. IN
+adguard.beliefanx.cn|Aliyun Computing Co., LTD
+adguard.bitteeinbyte.de|1&1 Telecom GmbH
+adguard.dekonix.ru|Zomro B.V.
+adguard.depieri.net|Vodafone Italia S.p.A.
+adguard.dessoi.cloud|Cloudflare, Inc. (CDN)
+adguard.ender.fr|OVH SAS
+adguard.fresh-waffles.online|Host Europe GmbH
+adguard.haneulo.com|Oracle Corporation KR
+adguard.ihatemy.live|Hetzner Online GmbH
+adguard.jfchenier.ca|Videotron Telecom Ltee
+adguard.konikoni428.com|TYO Vultr
+adguard.lege.despagne.net|Free SAS
+adguard.piekacz.pl|Liberty Global B.V.
+adguard.rowdyengeesje.nl|OVH SAS
+adguard.shuting.idv.tw|Chunghwa Telecom Co., Ltd.
+adguard1.jsanagustin.net|The Constant Company, LLC
+adguard1.leadmon.net|PBW Communications, LLC
+adl.adfilter.net|Network Presence
+alekberg.net|MVPS LTD
+ams01.ns.cbws.xyz|The Constant Company, LLC
+ant.dns.qwer.pw|Oracle Corporation
+anycast.dns.nextdns.io|nextdns, Inc
+anycast.uncensoreddns.org|Thomas Steen Rasmussen
+api.securenova.cf|Cloudflare, Inc.
+apne1.dns.terumi.club|Amazon Technologies Inc.
+aqua.el.erdc.dren.mil|DoD Network Information Center
+armorrush.eu.org|Microsoft Corporation Japan
+atlantic.dyn1.de|Atlantic.net, Inc.
+au01.dns4me.net|Amazon Technologies Inc. (EC2)
+au02.dns4me.net|Amazon Technologies Inc
+ausyd2-doh-002.aaplimg.com|Apple Inc.
+b-nxr-a02.isp.t-ipnet.de|Deutsche Telekom AG
+bad.dns.ipbx4rent.com|Quad9
+basic.rethinkdns.com|Cloudflare, Inc. (CDN)
+bcandrade.ml|Oracle Corporation
+bcfv.org|Cloudflare, Inc.
+bdns.aeins.at|Hetzner Online GmbH
+bg-sof-fe-01.swiftycdn.net|Melbikomas UAB
+blackhole.myon.lu|netcup GmbH
+bld.sys-adm.in|OVH SAS
+blitz.ahadns.com|Cloudflare, Inc. (CDN)
+blockerads.multimediaconcept.fr|Bouygues Telecom SA
+browsebeta.snapon.com|AT&T Services, Inc.
+c.hdns.io|Mach Dilemma, LLC
+ca01.dns4me.net|Amazon Technologies Inc
+ca02.dns4me.net|Amazon Technologies Inc
+cache2.alidns.com|Hangzhou Alibaba Advertising Co.,Ltd. China.
+cache2.trouble-free.net|Interserver, Inc
+camilasyd1.zdns.pw|OVH SAS
+carbon.junesta.net|The Constant Company, LLC
+catalog.proactishosting.com|PROACTIS SA
+catalog.uat.perfect.com|PROACTIS SA
+chaos-system.de|Hetzner Online GmbH
+chewbacca.meganerd.nl|The Constant Company, LLC
+chrometr-discovery.snapon.com|AT&T Services, Inc.
+clientdns3.softcom.net|Softcom Internet Communications, Inc.
+cloud.tezoi.com|ProXad network / Free SA
+cloudflare-dns.com|Cloudflare, Inc.
+cloudns.bosco.ovh|OVH SAS
+cloudyfalcon.com|DigitalOcean, LLC
+cluster-1.gac.edu|Gustavus Adolphus College
+cm-24-245-113-167.maxxsouthbb.net|BCI Mississippi Broadband,LLC
+cns2-test.unet.nl|Eurofiber UNET
+com.alidns.com|Hangzhou Alibaba Advertising Co.,Ltd. China.
+cor-pure010.cns.2iij.net|Internet Initiative Japan Inc.
+cor-pure011.cns.2iij.net|Internet Initiative Japan Inc.
+cor-pure1601.cns.2iij.net|Internet Initiative Japan Inc.
+cor-pure1610.cns.2iij.net|Internet Initiative Japan Inc.
+cor-pure221.cns.2iij.net|Internet Initiative Japan Inc.
+cor-pure91.cns.2iij.net|Internet Initiative Japan Inc.
+cor-secure01.cns.2iij.net|Internet Initiative Japan Inc.
+cor-secure011.cns.2iij.net|Internet Initiative Japan Inc.
+cor-secure160.cns.2iij.net|Internet Initiative Japan Inc.
+cor-secure1600.cns.2iij.net|Internet Initiative Japan Inc.
+cor-secure161.cns.2iij.net|Internet Initiative Japan Inc.
+cor-secure1611.cns.2iij.net|Internet Initiative Japan Inc.
+cor-secure21.cns.2iij.net|Internet Initiative Japan Inc.
+cor-secure22.cns.2iij.net|Internet Initiative Japan Inc.
+cor-secure220.cns.2iij.net|Internet Initiative Japan Inc.
+cor-secure911.cns.2iij.net|Internet Initiative Japan Inc.
+cor171.cns.2iij.net|Internet Initiative Japan Inc.
+corrin.geekwu.org|OVH SAS
+cossxiu.ga|GMO Internet, Inc
+cpc75651-alde5-2-0-cust54.6-2.cable.virginm.net|Virgin Media Limited
+cpe-70-113-111-13.austin.res.rr.com|Charter Communications Inc
+craft.vps.pw|DigitalOcean, LLC
+crmtrain.snapon.com|AT&T Services, Inc.
+csikx006029-eu-fr-ikdc2-z5-basic.ikexpress.com|Ikoula Net SAS
+cv-dns-on-ca-1.cloudveil.org|DigitalOcean, LLC
+cv-dns-on-ca-2.cloudveil.org|DigitalOcean, LLC
+d-nxr-a02.isp.t-ipnet.de|Deutsche Telekom AG
+d.toairs.com|Oracle Corporation JP
+d4s.j1ang.top|The Constant Company, LLC
+dart.kpsn.org|Hetzner Online GmbH
+dashboard.erdc.dren.mil|DoD Network Information Center
+de-dus01.adm.moulticast.net|Securebit AG
+de.teradns.org|netcup GmbH
+defra3-doh-003.aaplimg.com|Apple Inc.
+demo.cor.fja.com|M-net Telekommunikations GmbH
+demolight.cc-hubwoo.com|PROACTIS SA
+dev.ahadns.net|HostHatch, LLC
+dgca.myds.me|PT. TIME EXCELINDO
+diagnosticlinkbeta.snapon.com|AT&T Services, Inc.
+dns-2.zfn.uni-bremen.de|Verein zur Foerderung eines Deutschen Forschungsnetzes e.V.
+dns-a.wizint.net|Merula Limited
+dns-cache.switch.ch|SWITCH
+dns-cache2.switch.ch|SWITCH
+dns-doh-1.belnet.be|BELNET
+dns-doh-2.belnet.be|BELNET
+dns-doh-no-safe-search.dnsforfamily.com|DNS For Family (No Safe Search)
+dns-doh.dnsforfamily.com|DNS For Family
+dns-family.adguard.com|AdGuard Software Limited
+dns-nyc.aaflalo.me|InMotion Hosting, Inc.
+dns-public.ibakerserver.pt|Oracle Corporation FR
+dns-unfiltered.adguard.com|AdGuard. Filter: Unfiltered
+dns.0ooo.icu|Cloudflare, Inc. (CDN)
+dns.403.online|Private network
+dns.403.online|Private network RFC 1918
+dns.52306.org|Oracle Corporation
+dns.5ososea.com|netcup GmbH
+dns.7vpn.com|The Constant Company, LLC
+dns.886886886.xyz|XNNET LLC
+dns.aa.net.uk|Andrews & Arnold Ltd
+dns.adguard.com|AdGuard Software Limited
+dns.alexc.hu|Deninet KFT
+dns.alidns.com|Alibaba China. DNS. Warning: Don't use.
+dns.apigw.online|PT JARINGANKU SARANA NUSANTARA
+dns.artikel10.org|Artikel10 e.V.
+dns.b33.space|OVH SAS
+dns.b612.me|Shenzhen Tencent Computer Systems Company Limited. China
+dns.bebasid.com|Alibaba China. (US) Technology Co., Ltd.
+dns.belnet.be|Belnet Services
+dns.bitdefender.net|Google Cloud
+dns.blokada.org|Blocka AB
+dns.brahma.world|Amazon.com, Inc. SE
+dns.bw.i81.ru|Firstbyte Hosting
+dns.chenu.ch|Oracle Corporation
+dns.chromeina.top|Oracle Public Cloud
+dns.circl.lu|Luxembourg House of Cybersecurity
+dns.clanless.ovh|IONOS SE
+dns.cloudflare.com|Cloudflare
+dns.comss.one|EdgeCenter LLC
+dns.cretu.xyz|Hosterion SRL
+dns.cryptomize.com|HIVELOCITY, Inc.
+dns.cynthialabs.net|Cloudflare, Inc. (CDN)
+dns.d94.xyz|Oracle Public Cloud
+dns.daw.dev|Hetzner Online GmbH
+dns.dgea.fr|Cogent Communications
+dns.digitale-gesellschaft.ch|CommunityRack.org Verein. Switzerland
+dns.digitalsize.net|Hetzner Online GmbH
+dns.dnswarden.com/adultfilter|Fly.io, Inc. Filter: Adult
+dns.dnswarden.com|Fly.io, Inc.
+dns.doh.best|OVH Singapore PTE. LTD
+dns.east.comss.one|EdgeCenter LLC
+dns.fancyorg.at|conova communications GmbH
+dns.faze.dev|Hetzner Online GmbH
+dns.flymc.cc|Shenzhen Tencent Computer Systems Company Limited
+dns.freyja.pw|OVH SAS
+dns.front1.hostux.net|GANDI SAS
+dns.froth.zone|Hetzner Online GmbH
+dns.futa.gg|Cloudflare, Inc.
+dns.glorydns.com|Varnion Technology Semesta, PT
+dns.gnb09.id|PT Dewa Bisnis Digital
+dns.goldplate.org|Amazon Technologies Inc. (EC2)
+dns.google.com|Google LLC
+dns.google|Google LLC
+dns.hanahira.dev|ADVANCED WIRELESS NETWORK COMPANY LIMITED
+dns.hinet.net|Data Communication Business Group
+dns.iamninja.ru|First Server Limited
+dns.ikataruto.com|Hangzhou Alibaba Advertising Co.,Ltd. China.
+dns.imaicool.com|Hangzhou Alibaba Advertising Co.,Ltd. China.
+dns.invisv.com|Google Cloud
+dns.itdept.pro|OVH SAS
+dns.jinwoo.dev|Oracle Corporation KR
+dns.joey01245.nl|Vultr Holdings LLC Amsterdam
+dns.jstockley.com|CloudFlare, Inc. (CDN)
+dns.kamilszczepanski.com|INEA sp. z o.o.
+dns.kernel-error.de|netcup GmbH
+dns.kescher.at|netcup GmbH
+dns.keweon.center|Leaseweb Deutschland GmbH
+dns.lars-lehmann.net|noris network AG
+dns.lars-lehmann.net|oneCorp GmbH
+dns.linkr.ninja|Oracle Corporation
+dns.maolaohei.xyz|Shenzhen Tencent Computer Systems Company Limited
+dns.meeo.win|Oracle Public Cloud
+dns.mikeliu.org|Oracle Corporation JP
+dns.molinero.dev|Hetzner Online GmbH
+dns.moonssif.com|Oracle Corporation KR
+dns.murgi.de|netcup GmbH
+dns.muxinghe.cn|Shenzhen Tencent Computer Systems Company Limited
+dns.mzrme.cn|Microsoft Corporation
+dns.nas-server.ru|First Server Limited
+dns.neubsi.at|Hetzner Online GmbH
+dns.nextdns.io|nextdns, Inc
+dns.nguyendn.com|Long Van Soft Solution JSC
+dns.njal.la|ab stract SE
+dns.novali.date|ColoCrossing
+dns.novg.net|SCALEWAY S.A.S.
+dns.nullgate.net|HOSTKEY B.V.
+dns.opnsource.com.au|Oracle Corporation
+dns.p55k.com|Akamai Technologies, Inc.
+dns.paesa.es|Cloudflare, Inc. (CDN)
+dns.panszelescik.pl|OVH SAS
+dns.privado.ovh|SERVERD SAS
+dns.privilab.net|IONOS SE
+dns.quad9.net|Quad9
+dns.rin.sh|Hetzner Online GmbH
+dns.ronc.ru|Ilbit Telecom Ltd.
+dns.rotunneling.net|Cloudflare, Inc. (CDN)
+dns.sellan.fr|Free SAS
+dns.sev.monster|RamNode LLC
+dns.silen.org|Cloudflare, Inc. (CDN)
+dns.silentlybren.com|Cloudflare, Inc. (CDN)
+dns.simplylinux.ch|OVH SAS
+dns.siry.de|Strato AG
+dns.skrep.eu|The Infrastructure Group B.V.
+dns.slinkyman.net|Mammoth Media Pty Ltd
+dns.spil.co.id|CV Linkmedia Nusantara
+dns.startupstack.tech|Akamai Technologies, Inc. US
+dns.switch.ch|SWITCH
+dns.syaifullah.com|The Mastermind Holding B.V.
+dns.techcpu.net|The Constant Company, LLC
+dns.telekom.de|Deutsche Telekom AG
+dns.therifleman.name|Akamai Technologies, Inc. IN
+dns.tipsy.coffee|Chunghwa Telecom Co., Ltd.
+dns.tls-data.de|Ritter Technologie GmbH
+dns.truong.fi|Hetzner Online GmbH FI
+dns.twnic.tw|Taiwan Network Information Center
+dns.udenscollege.nl|DataWeb B.V.
+dns.youni.win|Oracle Corporation KR
+dns.zfsystem.tech|Cambo Technology Company Ltd.
+dns.zxi7.cn|Hangzhou Alibaba Advertising Co.,Ltd. China
+dns0.btnet.de|Ritter Technologie GmbH
+dns0.eu|GANDI SAS
+dns01.flm9.net|Hetzner Online GmbH
+dns01.klink.co.jp|SAKURA Internet Inc.
+dns1-chi.securd.com|NetActuate, Inc
+dns1-hkg.securd.com|NetActuate, Inc
+dns1-iad.securd.com|NetActuate, Inc
+dns1-lax.securd.com|NetActuate, Inc
+dns1-lga.securd.com|NetActuate, Inc
+dns1-lhr.securd.com|NetActuate, Inc
+dns1-sea.securd.com|NetActuate, Inc
+dns1-sin.securd.com|NetActuate, Inc
+dns1.dnscrypt.ca:453|OVH SAS. CA
+dns1.dnscrypt.ca|OVH SAS. CA
+dns1.in-berlin.de|Individual Network Berlin e.V.
+dns1.ipv6.dnscrypt.ca:453|OVH SAS. CA IPv6
+dns1.ipv6.dnscrypt.ca|OVH SAS. CA IPv6
+dns1.nextdns.io|Hetzner Online GmbH
+dns1.nielsdb.be|Misaka Network, Inc
+dns1.ord.hv.nominum.cloud|NetActuate, Inc
+dns1.ryan-palmer.com|DigitalOcean, LLC. UK
+dns1.sjc.hv.nominum.cloud|NetActuate, Inc
+dns1.techeasy.org|Oracle Corporation JP
+dns10.quad9.net|Quad9
+dns11.quad9.net|Quad9
+dns12.quad9.net|Quad9
+dns1awi.infowest.com|InfoWest
+dns2-cdg.securd.com|NetActuate, Inc
+dns2-chi.securd.com|NetActuate, Inc
+dns2-dfw.securd.com|NetActuate, Inc
+dns2-iad.securd.com|NetActuate, Inc
+dns2-lga.securd.com|NetActuate, Inc
+dns2-lhr.securd.com|NetActuate, Inc
+dns2-sea.securd.com|NetActuate, Inc
+dns2.cbio.top|Oracle Corporation
+dns2.digitale-gesellschaft.ch|CommunityRack.org Verein
+dns2.dnscrypt.ca:453|OVH SAS. CA 2
+dns2.dnscrypt.ca|OVH SAS. CA 2
+dns2.iad3.hv.nominum.cloud|NetActuate, Inc
+dns2.in-berlin.de|Individual Network Berlin e.V.
+dns2.ipv6.dnscrypt.ca:453|OVH SAS. CA IPv6 2
+dns2.ipv6.dnscrypt.ca|OVH SAS. CA IPv6 2
+dns2.nextdns.io|Akenes SA
+dns2.prisconetworks.com|Prisco Electronica S.L.
+dns3.iad3.hv.nominum.cloud|NetActuate, Inc
+dns3.ord.hv.nominum.cloud|NetActuate, Inc
+dns3.sjc.hv.nominum.cloud|NetActuate, Inc
+dns8.org|Vultr Holdings, LLC
+dns9.quad9.net|Quad9
+dnscache-32-2.mgk.pl|MGK Rafal Chmielewski
+dnscache-32-3.mgk.pl|MGK Rafal Chmielewski
+dnsforfamily.com|DNS For Family
+dnsforge.de|Hetzner Online GmbH
+dnsg.northmeadowmedical.com|Charter Communications Inc
+dnslow.me|Microsoft Corporation
+dnsnl-noads.alekberg.net|MVPS LTD
+dnsnl.alekberg.net|MVPS LTD NL
+dnsproxy.safebr.mcafee.com|Amazon.com, Inc.
+dnsse-noads.alekberg.net|MVPS LTD. Filter: No Ads
+dnsse.alekberg.net|MVPS LTD
+dnstls.mobik.com|Mobik d.o.o.
+dnx.niko-sem.com|Data Communication Business Group
+dog.dns.qwer.pw|Oracle Corporation
+doh-2.seby.io|OVH SAS. AU
+doh-a.simpledns.xyz|1 Click Services Limited
+doh-ipv6.crypto.sx|Crypto IPv6
+doh-tel-alpha.mimecast.com|Mimecast Services Limited
+doh.360.cn|Beijing Qihu Technology Company Limited. Warning: Don't use.
+doh.apad.pro|Apad with Cloudflare CDN.
+doh.apple.pch.net|WoodyNet, Inc.
+doh.appliedprivacy.net|Nessus GmbH. AT
+doh.argh.in|DigitalOcean, LLC
+doh.bortzmeyer.fr|OVH SAS. FR
+doh.bt.com|British Telecommunications PLC
+doh.ccb-net.it|Cloudflare, Inc. (CDN)
+doh.cleanbrowsing.org|Daniel Cid
+doh.crypto.sx|Crypto
+doh.datacore.ch|Init7 (Switzerland) Ltd.
+doh.dht.prd.live.c2szps.akadns.net|NetActuate, Inc
+doh.dns.apple.com.v.aaplimg.com|WoodyNet, Inc.
+doh.dns4all.eu|Stichting Internet Domeinregistratie Nederland
+doh.dnslify.com|PEERIX LTD
+doh.dscloud.me|The Constant Company, LLC
+doh.ffmuc.net|Freie Netze Muenchen e.V.
+doh.futa.gg|Cloudflare, Inc. (CDN)
+doh.ibr.cs.tu-bs.de|Verein zur Foerderung eines Deutschen Forschungsnetzes e.V.
+doh.killtw.im|Cloudflare, Inc. (CDN)
+doh.la.ahadns.net|HostHatch, LLC
+doh.lacontrevoie.fr|SERVERD SAS
+doh.libredns.gr|Hetzner Online GmbH
+doh.li|DigitalOcean, LLC
+doh.luigi.nexific.it|Hetzner Online GmbH
+doh.lv|Institute of Mathematics and Computer Science of University of Latvia
+doh.mullvad.net|Mullvad VPN AB.
+doh.nic.lv|Institute of Mathematics and Computer Science of University of Latvia
+doh.niyawe.de|Hetzner Online GmbH
+doh.nl.ahadns.net|HostHatch, LLC
+doh.onedns.net|Beijing Guanghuan Xinwang Digital
+doh.opendns.com|Cisco Technology, Inc. US
+doh.pub|Beijing Founder Broadband Network Technology Co., Ltd. Warning: Don't use.
+doh.pyry.me|Elisa Oyj
+doh.rezhajul.io|Amazon Technologies Inc.
+doh.safesurfer.io|Google Cloud
+doh.sungai.stream|Oracle Corporation SG
+doh.tiar.app|Myrepublic Limited. SG
+doh.tiarap.org|Myrepublic Limited with Cloudflare CDN. SG
+doh.xcom.pro|OVH SAS
+doh003.280blocker.net|The Constant Company, LLC
+doh2.gslb2.xfinity.com|Comcast Cable Communications, LLC
+doh3001.wikimedia.org|Wikimedia Foundation Inc.
+doh4002.wikimedia.org|Wikimedia Foundation Inc.
+dohtrial.att.net|Microsoft Corporation US
+dotdns.cryptroute.com|Amazon.com, Inc.
+doth.huque.com|Amazon Technologies Inc. (EC2)
+dubov.xyz|Contabo GmbH
+dukun.de|netcup GmbH
+ec2-18-139-84-250.ap-southeast-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-18-158-69-254.eu-central-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-18-195-203-141.eu-central-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-18-210-8-52.compute-1.amazonaws.com|Amazon.com, Inc.
+ec2-18-216-182-207.us-east-2.compute.amazonaws.com|Amazon.com, Inc.
+ec2-3-10-65-124.eu-west-2.compute.amazonaws.com|Amazon.com, Inc.
+ec2-3-112-124-189.ap-northeast-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-3-128-212-186.us-east-2.compute.amazonaws.com|Amazon.com, Inc.
+ec2-3-143-134-80.us-east-2.compute.amazonaws.com|Amazon.com, Inc.
+ec2-3-208-47-162.compute-1.amazonaws.com|Amazon.com, Inc.
+ec2-3-209-17-34.compute-1.amazonaws.com|Amazon.com, Inc.
+ec2-3-224-109-152.compute-1.amazonaws.com|Amazon.com, Inc.
+ec2-3-232-78-158.compute-1.amazonaws.com|Amazon.com, Inc.
+ec2-3-248-149-109.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-3-7-176-123.ap-south-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-34-197-6-94.compute-1.amazonaws.com|Amazon.com, Inc.
+ec2-34-247-230-158.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-35-154-138-96.ap-south-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-44-196-1-61.compute-1.amazonaws.com|Amazon.com, Inc.
+ec2-44-233-140-212.us-west-2.compute.amazonaws.com|Amazon.com, Inc.
+ec2-44-241-0-134.us-west-2.compute.amazonaws.com|Amazon.com, Inc.
+ec2-52-16-163-185.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-52-17-180-181.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-52-18-44-241.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-52-19-206-74.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-52-198-13-66.ap-northeast-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-52-209-174-126.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-52-215-49-128.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-52-31-171-166.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-52-31-191-149.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-52-43-41-34.us-west-2.compute.amazonaws.com|Amazon.com, Inc.
+ec2-52-44-142-142.compute-1.amazonaws.com|Amazon.com, Inc.
+ec2-52-48-147-197.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-52-49-195-5.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-52-76-245-252.ap-southeast-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-54-155-209-93.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-54-169-113-231.ap-southeast-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-54-171-175-41.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-54-172-110-180.compute-1.amazonaws.com|Amazon.com, Inc.
+ec2-54-189-234-230.us-west-2.compute.amazonaws.com|Amazon.com, Inc.
+ec2-54-194-121-142.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-54-227-13-144.compute-1.amazonaws.com|Amazon.com, Inc.
+ec2-54-237-181-250.compute-1.amazonaws.com|Amazon.com, Inc.
+ec2-54-246-187-60.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-54-72-41-135.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-54-73-239-183.eu-west-1.compute.amazonaws.com|Amazon.com, Inc.
+ec2-54-79-3-18.ap-southeast-2.compute.amazonaws.com|Amazon.com, Inc.
+echoe1yidzu4ioo5.myfritz.net|Deutsche Telekom AG
+edgy-dns.com|Amazon Technologies Inc.
+esel.stusta.mhn.de|Leibniz-Rechenzentrum
+esourcing.hubwoo.com|PROACTIS SA
+every1dns.com|Cloudflare Proxy
+externalmobiel.lekdijk.online|IONOS SE
+family.5ososea.com|netcup GmbH
+family.canadianshield.cira.ca|CIRA Canadian Internet Registration Authority Autorit Canadienne pour les enregistrements Internet
+family.cloudflare-dns.com|Cloudflare Family
+fio.ze1.org|Hetzner Online GmbH
+free.shecan.ir|AsiaTech (WARNING: DO NOT USE THIS SERVER)
+freedns.controld.com|CONTROLD INC.
+freedom.mydns.network|Cloudflare, Inc. (CDN)
+frog.dns.qwer.pw|Oracle Corporation
+fuchur.pentament.de|Hetzner Online GmbH
+galileo.math.unipd.it|Consortium GARR
+gateway.fomichev.cloud|Vultr Holdings, LLC
+gmbeta.snapon.com|AT&T Services, Inc.
+gztech.me|Cloudflare, Inc. (CDN)
+h202-218-2-19.ablenetvps.ne.jp|IDC Frontier Inc.
+helios.plan9-dns.com|The Constant Company, LLC
+help.avantec.ch|green.ch AG
+hitian.me|Akamai Technologies, Inc.
+hkhkg1-doh-002.aaplimg.com|Apple Inc.
+honeywell.hubwoo.com|PROACTIS SA
+host-203-204-102-17.static.kbtelecom.net|Confluence Networks Inc
+host-83-69-169-222.ncp.ru|New-Com Trade Ltd.
+host-83-69-169-69.ncp.ru|New-Com Trade Ltd.
+host86-159-144-0.range86-159.btcentralplus.com|British Telecommunications PLC
+ibksturm.synology.me|Datapark AG Switzerland
+ibuy-nationwide.hubwoo.com|PROACTIS SA
+ihctw.synology.me|Chunghwa Telecom Co., Ltd.
+in.ahadns.net|Akamai Technologies, Inc.
+ines.zfn.uni-bremen.de|Verein zur Foerderung eines Deutschen Forschungsnetzes e.V.
+ip186.ip-176-31-83.eu|OVH SAS
+ip195.ip-178-32-196.eu|OVH SAS
+ip232.ip-51-81-224.us|OVH SAS
+ipv4-zepto-mci-1.edge.nextdns.io|Misaka Network, Inc.
+iris.woozeno.eu|GANDI SAS
+ivnkn.xyz|Cloudflare, Inc. (CDN)
+jackyes.ovh|Contabo GmbH
+jiratest.app.msg-life.com|M-net Telekommunikations GmbH
+jp.68360612.xyz|xTom GmbH
+jp.tiar.app|Myrepublic Limited. JP
+jp.tiarap.org|Myrepublic Limited with Cloudflare CDN
+jurre-home.duckdns.org|Vodafone Libertel B.V.
+kaitain.restena.lu|Fondation RESTENA
+kids.5ososea.com|netcup GmbH
+kids.dns0.eu|GANDI SAS
+kronos.plan9-dns.com|The Constant Company, LLC
+labs.syshero.org|DigitalOcean, LLC
+lastentarvike.fi|DNA Oyj
+laureline.eu.org|Hivane
+leecurrylawfirm.com|Cloudflare, Inc. (CDN)
+link.altapo.ru|JSC IOT Russia
+lion.dns.qwer.pw|Oracle Corporation
+lion.yazilimatolye.com|IONOS SE
+ll194-11-251-204-194.ll194.iam.net.ma|Office National des Postes et Telecommunications ONPT (Maroc Telecom) / IAM
+ll194-13-251-204-194.ll194.iam.net.ma|Office National des Postes et Telecommunications ONPT (Maroc Telecom) / IAM
+lon.ns.junesta.net|The Constant Company, LLC
+mail.data.haus|Hetzner Online GmbH
+mail.dnswl.org|Bradler & Krantz GmbH & Co. KG
+mail.jabber-germany.de|netcup GmbH
+mail.masters-of-cloud.de|netcup GmbH
+mail21.es.34web.net|acens Technologies, S.L.
+mailer.amlegion.org|OVH SAS
+majesty.trez0r.eu|OVH SAS
+manta.offline.net|ONLINE S.A.S.
+max.rethinkdns.com|Fly.io, Inc.
+mozilla.cloudflare-dns.com|Cloudflare, Inc.
+msccbeta.snapon.com|AT&T Services, Inc.
+muli.stusta.mhn.de|Leibniz-Rechenzentrum
+n0.eu|The Constant Company, LLC
+n5.lsasss.com|NetOne Rus JSC
+nagios.snapon.com|Incapsula Inc
+nl-ams01.dns.moulticast.net|The Constant Company, LLC
+noads.imbuffering.com|Oracle Corporation UK
+notmike.dev|Michael Jones
+ns-p-ep-c.raclus.net|Prisco Electronica S.L.
+ns.doh-ns.de|Hetzner Online GmbH
+ns0.servus.at|ACONET
+ns01.iij4u.or.jp|Internet Initiative Japan Inc.
+ns02.iij4u.or.jp|Internet Initiative Japan Inc.
+ns03.iij4u.or.jp|Internet Initiative Japan Inc.
+ns05.iij.ad.jp|Internet Initiative Japan Inc.
+ns1.dotls.org|DMIT Cloud Services
+ns1.flodns.net|VeryGames
+ns1.highnet.com|Highland Network Ltd
+ns1.netent.co.nz|Vocus Group NZ
+ns14.iij.ad.jp|Internet Initiative Japan Inc.
+ns15.iij.ad.jp|Internet Initiative Japan Inc.
+ns2-r.primary.net.ua|"DV CLOUD" LLC
+ns2.cloudwebservices.nl|Bryan Barbolina trading as Cloudwebservices
+ns2.flodns.net|VeryGames
+ns2.highnet.com|Highland Network Ltd
+ns2.nodefield.net|Suomi Communications Oy
+ns2.tausch.co|Hetzner Online GmbH
+ns22.iij.ad.jp|Internet Initiative Japan Inc.
+ns3.bit-trail.nl|Cldin B.V
+ns3.com|Google LLC (CDN)
+ns3.cx|Google LLC (CDN)
+ns3.i-evolve.net|I-Evolve Technology Services
+ns3.link|Google LLC (CDN)
+ns4.highnet.com|Highland Network Ltd
+ns4.iij.ad.jp|Internet Initiative Japan Inc.
+ns51.iij.ad.jp|Internet Initiative Japan Inc.
+ns53.iij.ad.jp|Internet Initiative Japan Inc.
+ns70.iij.ad.jp|Internet Initiative Japan Inc.
+nsb.tul.cz|CESNET z.s.p.o.
+nsc.torgues.net|MilkyWan Association
+nz01.dns4me.net|RIMU HOSTING LIMITED
+o.rsaikat.com|Oracle Public Cloud
+o1.lt|Oracle Corporation NL
+odoh-target-se.alekberg.net|MVPS LTD
+odoh-target.alekberg.net|MVPS LTD
+odoh.cloudflare-dns.com|Cloudflare, Inc.
+odvr-b-99.nic.cz|CZ.NIC, z.s.p.o.
+odvr.nic.cz|CZ.NIC, z.s.p.o.
+one.one.one.one|Cloudflare, Inc.
+oraclejp2.chungyu.com|Oracle Corporation
+orau.lz0724.com|Oracle Corporation
+ordns.he.net|Hurricane Electric LLC
+os-ns2.fbi.h-da.de|Man-da.de GmbH
+pacte.int.hubwoo.com|PROACTIS SA
+pair01-02.ihatemy.live|Hetzner Online GmbH
+pates.services.sfr.fr.casepp.sfr.fr|Societe Francaise Du Radiotelephone - SFR SA
+paymentsbeta.snapon.com|AT&T Services, Inc.
+per-pure01.cns.2iij.net|Internet Initiative Japan Inc.
+per-pure011.cns.2iij.net|Internet Initiative Japan Inc.
+per-pure211.cns.2iij.net|Internet Initiative Japan Inc.
+per-pure220.cns.2iij.net|Internet Initiative Japan Inc.
+per-secure011.cns.2iij.net|Internet Initiative Japan Inc.
+per-secure210.cns.2iij.net|Internet Initiative Japan Inc.
+per.adfilter.net|Mammoth Media Pty Ltd
+per1711.cns.2iij.net|Internet Initiative Japan Inc.
+pi1.node15.com|Microsoft Corporation
+pihole.aws.ketan.dev|Amazon Technologies Inc.
+pihole.datamatter.co.za|Xneelo (Pty) Ltd
+pihole1.hoerli.net|Hetzner Online GmbH
+pihole1.tvk.rwth-aachen.de|RWTH Aachen University
+pihole2.hoerli.net|active 1 GmbH
+pl.ahadns.net|HostHatch, LLC
+pluton.plan9-dns.com|The Constant Company, LLC
+pope.cnblw.me|Hetzner Online GmbH
+porschebeta.snapon.com|AT&T Services, Inc.
+premium.dns.controld.com|CONTROLD INC.
+pro.shecan.ir|AsiaTech (WARNING: DO NOT USE THIS SERVER)
+prod-ssa.hubwoo.com|PROACTIS SA
+project-evoex.de|IONOS SE
+protected.canadianshield.cira.ca|CIRA Canadian Internet Registration Authority Autorit Canadienne pour les enregistrements Internet
+ptr.ruvds.com|JSC Mediasoft ekspert
+pub-fsr1600.cns.2iij.net|Internet Initiative Japan Inc.
+pub-fsr1601.cns.2iij.net|Internet Initiative Japan Inc.
+pub-fsr1611.cns.2iij.net|Internet Initiative Japan Inc.
+pub-fsr211.cns.2iij.net|Internet Initiative Japan Inc.
+pub1.sdns.360.cn|IDC, China Telecommunications Corporation. Warning: Don't use.
+public.dns.iij.jp|Internet Initiative Japan Inc.
+punono.duckdns.org|Celcom Axiata Berhad
+puredns.org|Amazon Technologies Inc.
+qlf-doh.inria.fr|Renater
+recursive2.go6lab.si|NET42, svetovanje in razvoj internetnih resitev, d.o.o.
+redirekcija.t-com.me|Crnogorski Telekom a.d.Podgorica
+res-acst1.absolight.net|SARL T1
+res-acst2.absolight.net|SARL T2
+res-acst3.absolight.net|SARL T3
+res110.fra.rrdns.pch.net|WoodyNet, Inc.
+resolver.r0cket.net|QuxLabs UG
+resolver.rferee.dev|Hetzner Online GmbH
+resolver.unstoppable.io|Cloudflare, Inc. (CDN)
+resolver1.absolight.net|SARL 1
+resolver2.absolight.net|SARL 2
+resolver3.absolight.net|SARL 3
+ric.openbld.net|Hetzner Online GmbH
+riv1-ns01.monzoon.net|Monzoon Networks AG
+rn1.pcextreme.nl|CLDIN B.V.
+rns.im.spb.ru|Active business systems Ltd.
+rpz-public-resolver2.rrdns.pch.net|Quad9
+s81-7-14-159.blue.kundencontroller.de|ISPpro Internet KG
+s81-7-14-191.blue.kundencontroller.de|ISPpro Internet KG
+s81-7-14-215.blue.kundencontroller.de|ISPpro Internet KG
+s81-7-14-52.blue.kundencontroller.de|ISPpro Internet KG
+s81-7-14-83.blue.kundencontroller.de|ISPpro Internet KG
+s81-7-14-85.blue.kundencontroller.de|ISPpro Internet KG
+sa01.dns4me.net|Xneelo (Pty) Ltd
+safe.kswro.web.id|ColoCrossing
+safeservedns.com|Namecheap, Inc.
+sbdns.co.in|Oracle Corporation
+sby-doh.limotelu.org|Wow Internet Indonesia
+secure.onedns.cc|Amazon Technologies Inc. (EC2)
+security.cloudflare-dns.com|Cloudflare, Inc.
+seppmail.avantec.ch|green.ch AG
+servicerangerbeta.snapon.com|AT&T Services, Inc.
+sg01.dns4me.net|Amazon Technologies Inc
+sgsin3-doh-001.aaplimg.com|Apple Inc.
+sgsin3-doh-002.aaplimg.com|Apple Inc.
+sgsin3-doh-004.aaplimg.com|Apple Inc.
+shalenkov.dev|Hetzner Online GmbH
+sink.nolo.ltd|Linode, LLC
+sky.rethinkdns.com|Cloudflare, Inc. (CDN)
+smtp.mousepanic.de|IONOS SE
+sn22.isp.telecom.li|Telecom Liechtenstein AG
+snake.ukrnet.net|ADAMANT, Ltd.
+snf-880622.vm.okeanos.grnet.gr|National Infrastructures for Research and Technology S.A.
+static-108-40-78-219.bltmmd.fios.verizon.net|Verizon Business
+static.110.131.203.116.clients.your-server.de|Hetzner Online GmbH
+static.225.115.203.116.clients.your-server.de|Hetzner Online GmbH
+static.4.105.47.78.clients.your-server.de|Hetzner Online GmbH
+static.80.160.119.168.clients.your-server.de|Hetzner Online GmbH
+static.81.103.202.116.clients.your-server.de|Hetzner Online GmbH
+static.94.213.217.95.clients.your-server.de|Hetzner Online GmbH
+static.98.186.34.188.clients.your-server.de|Hetzner Online GmbH
+static.98.30.203.116.clients.your-server.de|Hetzner Online GmbH
+steering.nextdns.io|Hetzner Online GmbH
+storydoh.kinergetica.com|JSC Mediasoft ekspert
+syd.adfilter.net|Mammoth Media Pty Ltd
+syd01.ns.cbws.xyz|The Constant Company, LLC
+techinfobeta.snapon.com|AT&T Services, Inc.
+testaghome.meshkov.info|Serveroid, LLC
+tj.jamesxue.xyz|IT7 Networks Inc
+tk2-202-10895.vs.sakura.ne.jp|SAKURA Internet Inc.
+tk31z.com|GMO Internet, Inc.
+tor.vasi.li|The Constant Company, LLC
+toyotaadebeta.snapon.com|AT&T Services, Inc.
+ttag.dns.nomu.pw|Oracle Corporation
+tuandns.duckdns.org|Oracle Corporation
+twg001.timmes.nl|LeaseWeb Netherlands B.V.
+typaza.com|Akamai Technologies, Inc. DE
+ueni.dyndns.org|ONLINE S.A.S.
+uk01.dns4me.net|Amazon Technologies Inc. (EC2)
+uklon5-doh-002.aaplimg.com|Apple Inc.
+ultimator3dbeta.snapon.com|AT&T Services, Inc.
+unassigned.psychz.net|Psychz Networks
+unicast.censurfridns.dk|Telia Company AB
+unicast.uncensoreddns.org|Telia Company AB
+unova.kescher.at|Contabo GmbH
+uranus.plonknet.com|Hetzner Online GmbH
+us1.blissdns.net|Linode
+usatl4-doh-003.aaplimg.com|Apple Inc.
+usbos3-doh-001.aaplimg.com|Apple Inc.
+usbos3-doh-002.aaplimg.com|Apple Inc.
+uschi5-doh-002.aaplimg.com|Apple Inc.
+uschi5-doh-003.aaplimg.com|Apple Inc.
+uschi5-doh-004.aaplimg.com|Apple Inc.
+usdal4-doh-002.aaplimg.com|Apple Inc.
+usden5-doh-002.aaplimg.com|Apple Inc.
+uslax1-doh-001.aaplimg.com|Apple Inc.
+uslax1-doh-003.aaplimg.com|Apple Inc.
+usmia1-doh-002.aaplimg.com|Apple Inc.
+usmia1-doh-006.aaplimg.com|Apple Inc.
+usscz2-doh-001.aaplimg.com|Apple Inc.
+ussea4-doh-003.aaplimg.com|Apple Inc.
+uXdns.google|Google LLC
+vendorportal-testpp.fbijobs.gov|FBI Criminal Justice Information Systems
+vierhoek.student.utwente.nl|SURF B.V.
+void-gate.irre.li|Vodafone GmbH
+vpn.gosami.xyz|Akamai Technologies, Inc.
+vps-0ad116e1.vps.ovh.ca|OVH SAS
+vps-77f564f3.vps.ovh.us|OVH SAS
+webreportsbeta.snapon.com|AT&T Services, Inc.
+www.c-dns.com|China Unicom Shanghai network
+www.dnsadguard.co.uk|Linode, LLC
+www.morbitzer.de|netcup GmbH
+www.muxyuji.ru|AEZA GROUP Ltd
+www.nilanjan.rocks|The Constant Company, LLC
+wyx.cloud|The Constant Company, LLC
+xc.dnsseed.bluematt.me|Windstream Communications LLC
+xmission-slc-1.edge.nextdns.io|XMission, L.C.
+yarp.lefolgoc.net|OVH SAS
+yovbak.com|Amazon Technologies Inc.
+zepto-sto-1.edge.nextdns.io|Misaka Network, Inc
+zero.dns0.eu|GANDI SAS
+zougloub.eu|Videotron Telecom Ltee
+zrh1-ns01.monzoon.net|Monzoon Networks AG
+[2001:41d0:302:2200::180]|OVH SAS FR IPv6
\ No newline at end of file
diff --git a/SecureDNSClient/NecessaryFiles/Resource1.Designer.cs b/SecureDNSClient/NecessaryFiles/Resource1.Designer.cs
index 576b5e9..6d848d2 100644
--- a/SecureDNSClient/NecessaryFiles/Resource1.Designer.cs
+++ b/SecureDNSClient/NecessaryFiles/Resource1.Designer.cs
@@ -131,12 +131,12 @@ internal static byte[] SDCLookup_X86 {
}
///
- /// Looks up a localized string similar to dnslookup-X64 1.10.1
- ///dnslookup-X86 1.10.1
- ///sdclookup-X64 1.0.7
- ///sdclookup-X86 1.0.7
- ///sdcagnosticserver-X64 3.0.9
- ///sdcagnosticserver-X86 3.0.9
+ /// Looks up a localized string similar to dnslookup-X64 1.11.1
+ ///dnslookup-X86 1.11.1
+ ///sdclookup-X64 1.1.0
+ ///sdclookup-X86 1.1.0
+ ///sdcagnosticserver-X64 3.1.5
+ ///sdcagnosticserver-X86 3.1.5
///goodbyedpi-X64 0.2.2
///goodbyedpi-X86 0.2.2.
///
diff --git a/SecureDNSClient/NecessaryFiles/versions.txt b/SecureDNSClient/NecessaryFiles/versions.txt
index 905724b..718035d 100644
--- a/SecureDNSClient/NecessaryFiles/versions.txt
+++ b/SecureDNSClient/NecessaryFiles/versions.txt
@@ -1,8 +1,8 @@
-dnslookup-X64 1.10.1
-dnslookup-X86 1.10.1
-sdclookup-X64 1.0.7
-sdclookup-X86 1.0.7
-sdcagnosticserver-X64 3.0.9
-sdcagnosticserver-X86 3.0.9
+dnslookup-X64 1.11.1
+dnslookup-X86 1.11.1
+sdclookup-X64 1.1.0
+sdclookup-X86 1.1.0
+sdcagnosticserver-X64 3.1.5
+sdcagnosticserver-X86 3.1.5
goodbyedpi-X64 0.2.2
goodbyedpi-X86 0.2.2
\ No newline at end of file
diff --git a/SecureDNSClient/Properties/PublishProfiles/X64.pubxml.user b/SecureDNSClient/Properties/PublishProfiles/X64.pubxml.user
index 2cdb138..c7dbeda 100644
--- a/SecureDNSClient/Properties/PublishProfiles/X64.pubxml.user
+++ b/SecureDNSClient/Properties/PublishProfiles/X64.pubxml.user
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
- True|2024-06-18T14:03:47.5423574Z;True|2024-06-08T12:19:22.3678059+03:30;True|2024-06-08T12:05:21.0478025+03:30;True|2024-06-01T20:54:02.3052546+03:30;True|2024-05-29T19:02:03.2430404+03:30;True|2024-05-18T15:45:55.4737673+03:30;True|2024-05-07T18:48:37.4919123+03:30;True|2024-05-07T18:02:08.6228530+03:30;False|2024-05-07T17:58:43.8735378+03:30;True|2024-04-17T14:20:46.7032525+03:30;True|2024-04-17T14:04:18.6345687+03:30;True|2024-02-23T16:05:24.9041929+03:30;True|2024-02-23T15:20:56.4557717+03:30;True|2024-02-22T20:08:08.0989458+03:30;True|2024-02-22T16:31:48.0568234+03:30;True|2024-02-15T15:01:11.7945869+03:30;True|2024-02-12T17:32:08.6922696+03:30;True|2024-02-12T16:52:42.1175645+03:30;True|2024-01-03T17:59:55.8247301+03:30;True|2024-01-03T17:38:11.0565327+03:30;True|2023-12-27T19:19:10.0764479+03:30;True|2023-12-26T17:52:39.0778581+03:30;True|2023-12-21T17:39:18.1668560+03:30;True|2023-12-02T23:46:22.9764507+03:30;True|2023-12-01T16:10:22.0450351+03:30;True|2023-11-30T18:27:33.5105981+03:30;True|2023-11-29T20:52:13.9715083+03:30;True|2023-11-29T20:31:24.8321883+03:30;True|2023-11-29T20:24:03.3041428+03:30;True|2023-11-29T19:09:49.0082579+03:30;True|2023-11-22T22:14:45.2976999+03:30;True|2023-11-22T21:24:32.7155059+03:30;True|2023-11-22T16:50:27.1561977+03:30;True|2023-11-22T00:18:55.9656118+03:30;True|2023-11-22T00:11:18.6908206+03:30;True|2023-11-22T00:02:41.9967538+03:30;True|2023-11-21T21:50:50.9843782+03:30;True|2023-11-01T16:06:35.7413598+03:30;True|2023-11-01T16:05:02.3136263+03:30;True|2023-11-01T15:51:48.4023491+03:30;True|2023-11-01T15:48:07.2523716+03:30;True|2023-11-01T15:45:29.5023576+03:30;False|2023-11-01T15:40:43.6142343+03:30;True|2023-11-01T15:37:44.6443333+03:30;True|2023-11-01T14:41:26.4006518+03:30;True|2023-11-01T14:37:56.7733353+03:30;True|2023-10-27T16:11:05.8915005+03:30;True|2023-10-27T15:57:40.1422525+03:30;True|2023-10-27T15:55:03.7833094+03:30;True|2023-10-27T15:46:13.6160521+03:30;True|2023-10-27T15:39:08.3974587+03:30;True|2023-10-27T15:35:26.7725493+03:30;True|2023-10-27T15:30:06.7514937+03:30;True|2023-10-16T20:11:07.8575287+03:30;True|2023-09-09T20:56:00.3507414+03:30;True|2023-09-09T19:27:09.7027307+03:30;True|2023-09-09T19:16:47.0865578+03:30;True|2023-09-06T17:44:41.6405987+03:30;True|2023-09-06T17:22:07.3334171+03:30;False|2023-09-06T17:18:40.3448050+03:30;True|2023-08-27T21:27:13.6015442+03:30;True|2023-08-07T11:05:28.9426536+03:30;True|2023-08-01T18:24:40.5252762+03:30;True|2023-08-01T18:15:41.4620135+03:30;True|2023-08-01T17:45:45.3880616+03:30;True|2023-07-31T01:12:04.5448192+03:30;True|2023-07-30T23:04:46.0894144+03:30;True|2023-07-30T23:01:33.6095925+03:30;True|2023-07-30T20:43:56.3111067+03:30;True|2023-07-30T20:12:58.0148728+03:30;True|2023-07-30T20:12:04.4089924+03:30;True|2023-07-30T20:08:02.5981217+03:30;True|2023-07-30T19:59:26.1393550+03:30;True|2023-07-30T19:49:10.0641504+03:30;True|2023-07-30T19:37:55.0060946+03:30;True|2023-07-30T18:59:45.2211753+03:30;True|2023-07-30T18:22:27.2089781+03:30;True|2023-07-30T17:59:16.4344534+03:30;True|2023-07-30T17:18:36.0414670+03:30;True|2023-07-30T16:53:16.0490028+03:30;True|2023-07-30T16:17:30.2774165+03:30;True|2023-07-30T01:41:58.4359505+03:30;True|2023-07-30T00:47:45.1815278+03:30;True|2023-07-30T00:39:19.1433492+03:30;True|2023-07-30T00:36:00.2507530+03:30;True|2023-07-30T00:29:16.5405756+03:30;True|2023-07-29T23:58:07.8090602+03:30;True|2023-07-29T22:47:20.3162431+03:30;True|2023-07-29T21:55:03.7928616+03:30;True|2023-07-17T21:32:20.6598533+03:30;True|2023-07-17T20:50:48.4709956+03:30;True|2023-07-17T20:41:55.9459002+03:30;True|2023-07-17T20:18:13.0811919+03:30;True|2023-07-04T19:14:27.5923252+03:30;True|2023-07-03T16:04:51.8596933+03:30;True|2023-06-28T19:50:29.7354161+03:30;True|2023-06-28T19:45:12.9586472+03:30;True|2023-06-28T19:36:22.0289215+03:30;True|2023-06-28T19:16:14.5797027+03:30;True|2023-06-17T15:31:05.5599274+03:30;
+ True|2024-10-14T13:25:59.9279855Z;True|2024-10-13T23:44:07.0670892+03:30;True|2024-10-11T17:48:54.6558211+03:30;True|2024-10-11T17:24:10.2661025+03:30;True|2024-06-18T17:33:47.5423574+03:30;True|2024-06-08T12:19:22.3678059+03:30;True|2024-06-08T12:05:21.0478025+03:30;True|2024-06-01T20:54:02.3052546+03:30;True|2024-05-29T19:02:03.2430404+03:30;True|2024-05-18T15:45:55.4737673+03:30;True|2024-05-07T18:48:37.4919123+03:30;True|2024-05-07T18:02:08.6228530+03:30;False|2024-05-07T17:58:43.8735378+03:30;True|2024-04-17T14:20:46.7032525+03:30;True|2024-04-17T14:04:18.6345687+03:30;True|2024-02-23T16:05:24.9041929+03:30;True|2024-02-23T15:20:56.4557717+03:30;True|2024-02-22T20:08:08.0989458+03:30;True|2024-02-22T16:31:48.0568234+03:30;True|2024-02-15T15:01:11.7945869+03:30;True|2024-02-12T17:32:08.6922696+03:30;True|2024-02-12T16:52:42.1175645+03:30;True|2024-01-03T17:59:55.8247301+03:30;True|2024-01-03T17:38:11.0565327+03:30;True|2023-12-27T19:19:10.0764479+03:30;True|2023-12-26T17:52:39.0778581+03:30;True|2023-12-21T17:39:18.1668560+03:30;True|2023-12-02T23:46:22.9764507+03:30;True|2023-12-01T16:10:22.0450351+03:30;True|2023-11-30T18:27:33.5105981+03:30;True|2023-11-29T20:52:13.9715083+03:30;True|2023-11-29T20:31:24.8321883+03:30;True|2023-11-29T20:24:03.3041428+03:30;True|2023-11-29T19:09:49.0082579+03:30;True|2023-11-22T22:14:45.2976999+03:30;True|2023-11-22T21:24:32.7155059+03:30;True|2023-11-22T16:50:27.1561977+03:30;True|2023-11-22T00:18:55.9656118+03:30;True|2023-11-22T00:11:18.6908206+03:30;True|2023-11-22T00:02:41.9967538+03:30;True|2023-11-21T21:50:50.9843782+03:30;True|2023-11-01T16:06:35.7413598+03:30;True|2023-11-01T16:05:02.3136263+03:30;True|2023-11-01T15:51:48.4023491+03:30;True|2023-11-01T15:48:07.2523716+03:30;True|2023-11-01T15:45:29.5023576+03:30;False|2023-11-01T15:40:43.6142343+03:30;True|2023-11-01T15:37:44.6443333+03:30;True|2023-11-01T14:41:26.4006518+03:30;True|2023-11-01T14:37:56.7733353+03:30;True|2023-10-27T16:11:05.8915005+03:30;True|2023-10-27T15:57:40.1422525+03:30;True|2023-10-27T15:55:03.7833094+03:30;True|2023-10-27T15:46:13.6160521+03:30;True|2023-10-27T15:39:08.3974587+03:30;True|2023-10-27T15:35:26.7725493+03:30;True|2023-10-27T15:30:06.7514937+03:30;True|2023-10-16T20:11:07.8575287+03:30;True|2023-09-09T20:56:00.3507414+03:30;True|2023-09-09T19:27:09.7027307+03:30;True|2023-09-09T19:16:47.0865578+03:30;True|2023-09-06T17:44:41.6405987+03:30;True|2023-09-06T17:22:07.3334171+03:30;False|2023-09-06T17:18:40.3448050+03:30;True|2023-08-27T21:27:13.6015442+03:30;True|2023-08-07T11:05:28.9426536+03:30;True|2023-08-01T18:24:40.5252762+03:30;True|2023-08-01T18:15:41.4620135+03:30;True|2023-08-01T17:45:45.3880616+03:30;True|2023-07-31T01:12:04.5448192+03:30;True|2023-07-30T23:04:46.0894144+03:30;True|2023-07-30T23:01:33.6095925+03:30;True|2023-07-30T20:43:56.3111067+03:30;True|2023-07-30T20:12:58.0148728+03:30;True|2023-07-30T20:12:04.4089924+03:30;True|2023-07-30T20:08:02.5981217+03:30;True|2023-07-30T19:59:26.1393550+03:30;True|2023-07-30T19:49:10.0641504+03:30;True|2023-07-30T19:37:55.0060946+03:30;True|2023-07-30T18:59:45.2211753+03:30;True|2023-07-30T18:22:27.2089781+03:30;True|2023-07-30T17:59:16.4344534+03:30;True|2023-07-30T17:18:36.0414670+03:30;True|2023-07-30T16:53:16.0490028+03:30;True|2023-07-30T16:17:30.2774165+03:30;True|2023-07-30T01:41:58.4359505+03:30;True|2023-07-30T00:47:45.1815278+03:30;True|2023-07-30T00:39:19.1433492+03:30;True|2023-07-30T00:36:00.2507530+03:30;True|2023-07-30T00:29:16.5405756+03:30;True|2023-07-29T23:58:07.8090602+03:30;True|2023-07-29T22:47:20.3162431+03:30;True|2023-07-29T21:55:03.7928616+03:30;True|2023-07-17T21:32:20.6598533+03:30;True|2023-07-17T20:50:48.4709956+03:30;True|2023-07-17T20:41:55.9459002+03:30;True|2023-07-17T20:18:13.0811919+03:30;True|2023-07-04T19:14:27.5923252+03:30;True|2023-07-03T16:04:51.8596933+03:30;True|2023-06-28T19:50:29.7354161+03:30;
\ No newline at end of file
diff --git a/SecureDNSClient/Properties/PublishProfiles/X86.pubxml.user b/SecureDNSClient/Properties/PublishProfiles/X86.pubxml.user
index 1df5497..d2ef809 100644
--- a/SecureDNSClient/Properties/PublishProfiles/X86.pubxml.user
+++ b/SecureDNSClient/Properties/PublishProfiles/X86.pubxml.user
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
- True|2024-06-18T14:06:31.6798534Z;True|2024-06-08T12:16:40.4672370+03:30;True|2024-06-08T12:12:56.8779574+03:30;True|2024-05-18T15:44:10.5119534+03:30;True|2024-05-07T18:51:43.3024460+03:30;True|2024-05-07T18:07:53.1962229+03:30;True|2024-04-17T14:34:40.5636609+03:30;True|2024-04-17T14:00:32.2567196+03:30;True|2024-02-23T16:07:43.8234731+03:30;True|2024-02-23T15:18:52.8088472+03:30;True|2024-02-22T20:10:01.9287231+03:30;True|2024-02-22T16:29:50.8019303+03:30;True|2024-02-15T15:03:45.1545283+03:30;True|2024-02-12T17:29:20.9540037+03:30;True|2024-02-12T16:54:49.4338383+03:30;True|2024-01-03T18:01:50.6292829+03:30;True|2024-01-03T17:35:56.7652361+03:30;True|2023-12-27T19:21:42.6787357+03:30;True|2023-12-26T17:50:50.1424956+03:30;True|2023-11-29T20:53:53.2203898+03:30;True|2023-11-29T20:29:54.0393169+03:30;True|2023-11-29T20:25:50.4128937+03:30;True|2023-11-29T19:07:50.8935153+03:30;True|2023-11-22T22:13:06.1659873+03:30;True|2023-11-22T21:26:24.8076263+03:30;True|2023-11-22T16:48:41.3816643+03:30;True|2023-11-22T00:08:40.5073685+03:30;True|2023-11-22T00:04:40.3317729+03:30;True|2023-11-21T23:03:12.7313062+03:30;True|2023-11-21T22:48:45.8064906+03:30;True|2023-11-21T21:53:04.8464901+03:30;
+ True|2024-10-14T13:29:05.6116337Z;True|2024-10-13T23:47:51.9689025+03:30;True|2024-10-11T17:45:57.8532781+03:30;True|2024-06-18T17:36:31.6798534+03:30;True|2024-06-08T12:16:40.4672370+03:30;True|2024-06-08T12:12:56.8779574+03:30;True|2024-05-18T15:44:10.5119534+03:30;True|2024-05-07T18:51:43.3024460+03:30;True|2024-05-07T18:07:53.1962229+03:30;True|2024-04-17T14:34:40.5636609+03:30;True|2024-04-17T14:00:32.2567196+03:30;True|2024-02-23T16:07:43.8234731+03:30;True|2024-02-23T15:18:52.8088472+03:30;True|2024-02-22T20:10:01.9287231+03:30;True|2024-02-22T16:29:50.8019303+03:30;True|2024-02-15T15:03:45.1545283+03:30;True|2024-02-12T17:29:20.9540037+03:30;True|2024-02-12T16:54:49.4338383+03:30;True|2024-01-03T18:01:50.6292829+03:30;True|2024-01-03T17:35:56.7652361+03:30;True|2023-12-27T19:21:42.6787357+03:30;True|2023-12-26T17:50:50.1424956+03:30;True|2023-11-29T20:53:53.2203898+03:30;True|2023-11-29T20:29:54.0393169+03:30;True|2023-11-29T20:25:50.4128937+03:30;True|2023-11-29T19:07:50.8935153+03:30;True|2023-11-22T22:13:06.1659873+03:30;True|2023-11-22T21:26:24.8076263+03:30;True|2023-11-22T16:48:41.3816643+03:30;True|2023-11-22T00:08:40.5073685+03:30;True|2023-11-22T00:04:40.3317729+03:30;True|2023-11-21T23:03:12.7313062+03:30;True|2023-11-21T22:48:45.8064906+03:30;True|2023-11-21T21:53:04.8464901+03:30;
\ No newline at end of file
diff --git a/SecureDNSClient/SecureDNS/IpScanner.cs b/SecureDNSClient/SecureDNS/IpScanner.cs
index 31a8985..1dcd867 100644
--- a/SecureDNSClient/SecureDNS/IpScanner.cs
+++ b/SecureDNSClient/SecureDNS/IpScanner.cs
@@ -14,13 +14,13 @@ public class IpScannerResult
public IpScannerResult() { }
}
+
public class IpScanner
{
private List WorkingIPs { get; set; } = new();
- private List IpRangeList { get; set; } = new();
- private List AllIPs { get; set; } = new();
+ private List CIDR_List { get; set; } = new();
+ private List AllIPs { get; set; } = new();
private bool StopScan { get; set; } = false;
- private static readonly MsmhAgnosticServer ProxyServer = new();
// Public
public bool IsRunning { get; private set; } = false;
@@ -36,7 +36,6 @@ public class IpScanner
///
public int Timeout { get; set; }
public bool RandomScan { get; set; } = true;
- public int ProxyServerPort { get; set; } = 8090;
///
/// Sender is IpScannerResult
@@ -52,12 +51,10 @@ public IpScanner() { }
///
/// Find Clean IPs
///
- /// e.g. 103.21.244.0 - 103.21.244.255\n198.41.128.0 - 198.41.143.255
- public void SetIpRange(string ipRange)
+ /// A List Of CIDR
+ public void SetIpRange(List cidrList)
{
- if (!string.IsNullOrEmpty(ipRange))
- ipRange += Environment.NewLine;
- IpRangeList = ipRange.SplitToLines();
+ CIDR_List = cidrList;
}
public List GetWorkingIPs
@@ -65,7 +62,7 @@ public List GetWorkingIPs
get => WorkingIPs;
}
- public int GetAllIpsCount
+ public int GetAllIPsCount
{
get => AllIPs.Count;
}
@@ -83,213 +80,152 @@ public void Start()
StopScan = false;
if (AllIPs.Any()) AllIPs.Clear();
- AgnosticSettings settings = new()
- {
- ListenerPort = ProxyServerPort,
- MaxRequests = 100000,
- DnsTimeoutSec = 10,
- ProxyTimeoutSec = 0,
- KillOnCpuUsage = 50,
- BlockPort80 = true,
- AllowInsecure = true
- };
-
- if (!ProxyServer.IsRunning) ProxyServer.Start(settings);
Random random = new();
Task.Run(async () =>
{
- for (int n = 0; n < IpRangeList.Count; n++)
- {
- string ipRange = IpRangeList[n].Trim();
-
- if (!string.IsNullOrEmpty(ipRange))
- {
- string[] split = ipRange.Split('-');
- string ipMin = split[0].Trim();
- string ipMax = split[1].Trim();
-
- string[] ipMins = ipMin.Split('.');
- int ipMin1 = 0, ipMin2 = 0, ipMin3 = 0, ipMin4 = 0;
-
- try
- {
- ipMin1 = int.Parse(ipMins[0]);
- ipMin2 = int.Parse(ipMins[1]);
- ipMin3 = int.Parse(ipMins[2]);
- ipMin4 = int.Parse(ipMins[3]);
- }
- catch (Exception) { }
-
- string[] ipMaxs = ipMax.Split('.');
- int ipMax1 = 0, ipMax2 = 0, ipMax3 = 0, ipMax4 = 0;
-
- try
- {
- ipMax1 = int.Parse(ipMaxs[0]);
- ipMax2 = int.Parse(ipMaxs[1]);
- ipMax3 = int.Parse(ipMaxs[2]);
- ipMax4 = int.Parse(ipMaxs[3]);
- }
- catch (Exception) { }
-
- for (int ipOut1 = ipMin1; ipOut1 <= ipMax1; ipOut1++)
- {
- for (int ipOut2 = ipMin2; ipOut2 <= ipMax2; ipOut2++)
- {
- for (int ipOut3 = ipMin3; ipOut3 <= ipMax3; ipOut3++)
- {
- for (int ipOut4 = ipMin4; ipOut4 <= ipMax4; ipOut4++)
- {
- if (StopScan)
- {
- IsRunning = false;
- if (ProxyServer.IsRunning)
- ProxyServer.Stop();
- return;
- }
-
- string ipOut = $"{ipOut1}.{ipOut2}.{ipOut3}.{ipOut4}";
-
- AllIPs.Add(ipOut);
- }
- }
- }
- }
- }
- }
+ IPRange ipRange = new(CIDR_List);
+ ipRange.StartGenerateIPs();
+ await Task.Delay(100);
- for (int n = 0; n < AllIPs.Count; n++)
+ int pauseDelayMs = 1;
+ int startIndex = 0;
+ while (true)
{
if (StopScan)
{
+ ipRange.Dispose();
IsRunning = false;
- if (ProxyServer.IsRunning)
- ProxyServer.Stop();
return;
}
- OnNumberOfCheckedIpChanged?.Invoke(n, EventArgs.Empty);
-
- int percent = 0;
- if (n > 0 && n < AllIPs.Count - 1)
- percent = (n * 100) / AllIPs.Count;
- if (n == AllIPs.Count - 1)
- percent = 100;
- OnPercentChanged?.Invoke(percent, EventArgs.Empty);
+ ipRange.Pause(true);
+ await Task.Delay(pauseDelayMs);
- string ipOut = AllIPs[n];
+ AllIPs = ipRange.IPs.GetRange(startIndex, ipRange.IPs.Count - startIndex);
+ startIndex = ipRange.IPs.Count;
- if (RandomScan)
+ for (int n = 0; n < AllIPs.Count; n++)
{
- int rn = random.Next(AllIPs.Count);
- ipOut = AllIPs[rn];
- }
-
- OnNewIpCheck?.Invoke(ipOut, EventArgs.Empty);
- OnFullReportChanged?.Invoke($"Checking: {ipOut} ({n} of {AllIPs.Count}) {percent}%", EventArgs.Empty);
-
- // Real Delay
- int realDelayOut = -1;
- try
- {
- // Real Delay
- string urlScheme = string.Empty;
- if (CheckWebsite.Contains("://"))
+ if (StopScan)
{
- string[] split = CheckWebsite.Split("://");
- urlScheme = $"{split[0].Trim().ToLower()}://";
+ ipRange.Dispose();
+ IsRunning = false;
+ return;
}
- NetworkTool.GetUrlDetails(CheckWebsite, CheckPort, out _, out string host, out _, out _, out int _, out string _, out bool _);
- string url = $"{urlScheme}{host}:{CheckPort}";
-
- Uri uri = new(url, UriKind.Absolute);
- // Create ProxyRules
- AgnosticProgram.ProxyRules rules = new();
- string rulesContent = $"{host}|{ipOut};";
- rulesContent += $"{ipOut}|+;";
- rulesContent += $"*|-;"; // Block Other Requests
- rules.Set(AgnosticProgram.ProxyRules.Mode.Text, rulesContent);
- ProxyServer.EnableProxyRules(rules);
+ OnNumberOfCheckedIpChanged?.Invoke(n, EventArgs.Empty);
- ProxyServer.KillAll();
- await Task.Delay(100);
+ int percent = 0;
+ if (n > 0 && n < AllIPs.Count - 1)
+ percent = (n * 100) / AllIPs.Count;
+ if (n == AllIPs.Count - 1)
+ percent = 100;
+ OnPercentChanged?.Invoke(percent, EventArgs.Empty);
- string proxyScheme = $"http://{IPAddress.Loopback}:{ProxyServerPort}";
+ string ipOut = AllIPs[n].ToString();
- using SocketsHttpHandler socketsHttpHandler = new();
- socketsHttpHandler.Proxy = new WebProxy(proxyScheme, true);
+ if (RandomScan)
+ {
+ int rn = random.Next(AllIPs.Count);
+ ipOut = AllIPs[rn].ToString();
+ }
- using HttpClient httpClientWithProxy = new(socketsHttpHandler);
- httpClientWithProxy.Timeout = TimeSpan.FromMilliseconds(Timeout);
+ OnNewIpCheck?.Invoke(ipOut, EventArgs.Empty);
+ OnFullReportChanged?.Invoke($"Checking: {ipOut} ({n} of {AllIPs.Count}) {percent}%", EventArgs.Empty);
- Stopwatch realDelay = new();
- realDelay.Start();
- await httpClientWithProxy.GetAsync(uri);
- realDelay.Stop();
+ // Real Delay
+ int realDelayOut = -1;
+ try
+ {
+ // Real Delay
+ string urlScheme = string.Empty;
+ if (CheckWebsite.Contains("://"))
+ {
+ string[] split = CheckWebsite.Split("://");
+ urlScheme = $"{split[0].Trim().ToLower()}://";
+ }
+ NetworkTool.GetUrlDetails(CheckWebsite, CheckPort, out _, out string host, out _, out _, out int _, out string _, out bool _);
+ string url = $"{urlScheme}{host}:{CheckPort}";
- realDelayOut = Convert.ToInt32(realDelay.ElapsedMilliseconds);
- realDelay.Reset();
- }
- catch (Exception)
- {
- realDelayOut = -1;
- }
+ Stopwatch realDelay = new();
+ realDelay.Start();
+ HttpStatusCode hsc = await NetworkTool.GetHttpStatusCodeAsync(url, ipOut, Timeout, false, false);
+ realDelay.Stop();
- Debug.WriteLine("Real Delay: " + realDelayOut);
+ Debug.WriteLine("HttpStatusCode: " + hsc);
- if (realDelayOut != -1)
- {
- // Ping Delay
- int pingDelayOut = -1;
- try
- {
- Stopwatch pingDelay = new();
- pingDelay.Start();
- bool canPing = await NetworkTool.CanPing(ipOut, Timeout);
- pingDelay.Stop();
+ if (hsc == HttpStatusCode.OK)
+ realDelayOut = Convert.ToInt32(realDelay.ElapsedMilliseconds);
- if (canPing) pingDelayOut = Convert.ToInt32(pingDelay.ElapsedMilliseconds);
- pingDelay.Reset();
+ realDelay.Reset();
}
catch (Exception)
{
- pingDelayOut = -1;
+ realDelayOut = -1;
}
- // Tcp delay
- int tcpDelayOut = -1;
- try
- {
- Stopwatch tcpDelay = new();
- tcpDelay.Start();
- bool canTcpConnect = await NetworkTool.CanTcpConnect(ipOut, CheckPort, Timeout);
- tcpDelay.Stop();
+ Debug.WriteLine("Real Delay: " + realDelayOut);
- if (canTcpConnect) tcpDelayOut = Convert.ToInt32(tcpDelay.ElapsedMilliseconds);
- tcpDelay.Reset();
- }
- catch (Exception)
+ if (realDelayOut != -1)
{
- tcpDelayOut = -1;
+ // Ping Delay
+ int pingDelayOut = -1;
+ try
+ {
+ Stopwatch pingDelay = new();
+ pingDelay.Start();
+ bool canPing = await NetworkTool.CanPing(ipOut, Timeout);
+ pingDelay.Stop();
+
+ if (canPing) pingDelayOut = Convert.ToInt32(pingDelay.ElapsedMilliseconds);
+ pingDelay.Reset();
+ }
+ catch (Exception)
+ {
+ pingDelayOut = -1;
+ }
+
+ // Tcp delay
+ int tcpDelayOut = -1;
+ try
+ {
+ Stopwatch tcpDelay = new();
+ tcpDelay.Start();
+ bool canTcpConnect = await NetworkTool.CanTcpConnect(ipOut, CheckPort, Timeout);
+ tcpDelay.Stop();
+
+ if (canTcpConnect) tcpDelayOut = Convert.ToInt32(tcpDelay.ElapsedMilliseconds);
+ tcpDelay.Reset();
+ }
+ catch (Exception)
+ {
+ tcpDelayOut = -1;
+ }
+
+ // Result
+ if (tcpDelayOut != -1 && pingDelayOut != -1)
+ {
+ IpScannerResult scannerResult = new()
+ {
+ IP = ipOut,
+ RealDelay = realDelayOut,
+ TcpDelay = tcpDelayOut,
+ PingDelay = pingDelayOut
+ };
+
+ OnWorkingIpReceived?.Invoke(scannerResult, EventArgs.Empty);
+ WorkingIPs.Add(scannerResult);
+ }
}
- // Result
- IpScannerResult scannerResult = new()
- {
- IP = ipOut,
- RealDelay = realDelayOut,
- TcpDelay = tcpDelayOut,
- PingDelay = pingDelayOut
- };
-
- OnWorkingIpReceived?.Invoke(scannerResult, EventArgs.Empty);
- WorkingIPs.Add(scannerResult);
}
+ AllIPs.Clear();
+ ipRange.Pause(false);
+ await Task.Delay(pauseDelayMs);
+ if (!ipRange.IsRunning) StopScan = true;
}
-
});
}
catch (Exception ex)
diff --git a/SecureDNSClient/SecureDNS/SecureDNS.cs b/SecureDNSClient/SecureDNS/SecureDNS.cs
index e7a9592..cc2335e 100644
--- a/SecureDNSClient/SecureDNS/SecureDNS.cs
+++ b/SecureDNSClient/SecureDNS/SecureDNS.cs
@@ -3,7 +3,6 @@
using CustomControls;
using System.Reflection;
using MsmhToolsClass;
-using MsmhToolsClass.MsmhAgnosticServer;
using System.Runtime.InteropServices;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
@@ -84,8 +83,6 @@ public static string UserDataDirPath
public static readonly string SettingsXmlDnsScanner = GetFullPath(UserDataDirPath, "DnsScannerSettings.xml");
public static readonly string SettingsXmlDnsScannerExport = GetFullPath(UserDataDirPath, "DnsScannerExportSettings.xml");
public static readonly string UserIdPath = GetFullPath(UserDataDirPath, "uid.txt");
- public static readonly string DnsRulesPath = GetFullPath(UserDataDirPath, "DnsRules.txt");
- public static readonly string ProxyRulesPath = GetFullPath(UserDataDirPath, "ProxyRules.txt");
public static readonly string BuiltInServersSecureUpdateUrl = "https://github.com/msasanmh/SecureDNSClient/raw/main/Subs/sdc-secure.txt";
public static readonly string BuiltInServersSecurePath = GetFullPath(UserDataDirPath, "BuiltInServers_Secure.txt");
public static readonly string BuiltInServersInsecureUpdateUrl = "https://github.com/msasanmh/SecureDNSClient/raw/main/Subs/sdc-insecure.txt";
@@ -100,6 +97,19 @@ public static string UserDataDirPath
public static readonly string CloseStatusPath = GetFullPath(UserDataDirPath, "CloseStatus.txt");
public static readonly string ErrorLogPath = GetFullPath(UserDataDirPath, "ErrorLog.txt");
+ // Rules & Assets
+ public static readonly string RulesPath = GetFullPath(UserDataDirPath, "Rules.txt");
+ public static readonly string DnsRulesPath = GetFullPath(UserDataDirPath, "DnsRules.txt");
+ public static readonly string ProxyRulesPath = GetFullPath(UserDataDirPath, "ProxyRules.txt");
+ public static readonly string Rules_Assets_DNS = GetFullPath(UserDataDirPath, "Rules_Assets_DNS.tmp");
+ public static readonly string Rules_Assets_Proxy = GetFullPath(UserDataDirPath, "Rules_Assets_Proxy.tmp");
+ public static readonly string AssetDirPath = GetFullPath(UserDataDirPath, "Assets");
+ public static readonly string Asset_Local_CIDRs = GetFullPath(AssetDirPath, "Local_CIDRs.txt");
+ public static readonly string Asset_Cloudflare_CIDRs = GetFullPath(AssetDirPath, "Cloudflare_CIDRs.txt");
+ public static readonly string Asset_IR_Domains = GetFullPath(AssetDirPath, "IR_Domains.txt");
+ public static readonly string Asset_IR_CIDRs = GetFullPath(AssetDirPath, "IR_CIDRs.txt");
+ public static readonly string Asset_IR_ADS_Domains = GetFullPath(AssetDirPath, "IR_ADS_Domains.txt");
+
// Old Proxy ProxyRules
public static readonly string BlackWhiteListPath = GetFullPath(UserDataDirPath, "BlackWhiteList.txt");
public static readonly string FakeDnsRulesPath = GetFullPath(UserDataDirPath, "FakeDnsRules.txt");
diff --git a/SecureDNSClient/SecureDNS/SetDnsOnNic.cs b/SecureDNSClient/SecureDNS/SetDnsOnNic.cs
index 5eff891..6e3ea19 100644
--- a/SecureDNSClient/SecureDNS/SetDnsOnNic.cs
+++ b/SecureDNSClient/SecureDNS/SetDnsOnNic.cs
@@ -369,36 +369,70 @@ public async Task UnsetDnsToDHCP(CustomComboBox ccb)
await UnsetDnsToDHCP(nicName);
}
- public async Task UnsetDnsToStatic(string dns1, string dns2, string nicName)
+ public async Task UnsetDnsToStatic(string ipv4_1, string ipv4_2, string ipv6_1, string ipv6_2, string nicName)
{
if (string.IsNullOrEmpty(nicName)) return;
- dns1 = dns1.Trim();
- dns2 = dns2.Trim();
- await Task.Run(async () => await NetworkTool.UnsetDnsIPv4(nicName, dns1, dns2));
- await Task.Run(async () => await NetworkTool.UnsetDnsIPv6(nicName));
+
+ ipv4_1 = ipv4_1.Trim();
+ ipv4_2 = ipv4_2.Trim();
+ ipv6_1 = ipv6_1.Trim();
+ ipv6_2 = ipv6_2.Trim();
+
+ if (NetworkTool.IsIP(ipv4_1, out IPAddress? ip41) && ip41 != null && NetworkTool.IsIPv4(ip41))
+ {
+ if (NetworkTool.IsIP(ipv4_2, out IPAddress? ip42) && ip42 != null && NetworkTool.IsIPv4(ip42))
+ {
+ await Task.Run(async () => await NetworkTool.UnsetDnsIPv4(nicName, ipv4_1, ipv4_2));
+ }
+ else
+ {
+ await Task.Run(async () => await NetworkTool.UnsetDnsIPv4(nicName, ipv4_1, null));
+ }
+ }
+ else
+ {
+ await Task.Run(async () => await NetworkTool.UnsetDnsIPv4(nicName));
+ }
+
+ if (NetworkTool.IsIP(ipv6_1, out IPAddress? ip61) && ip61 != null && NetworkTool.IsIPv6(ip61))
+ {
+ if (NetworkTool.IsIP(ipv6_2, out IPAddress? ip62) && ip62 != null && NetworkTool.IsIPv6(ip62))
+ {
+ await Task.Run(async () => await NetworkTool.UnsetDnsIPv6(nicName, ipv6_1, ipv6_2));
+ }
+ else
+ {
+ await Task.Run(async () => await NetworkTool.UnsetDnsIPv6(nicName, ipv6_1, null));
+ }
+ }
+ else
+ {
+ await Task.Run(async () => await NetworkTool.UnsetDnsIPv6(nicName));
+ }
+
SaveToFile();
}
- public async Task UnsetDnsToStatic(string dns1, string dns2, List nicNameList)
+ public async Task UnsetDnsToStatic(string ipv4_1, string ipv4_2, string ipv6_1, string ipv6_2, List nicNameList)
{
for (int n = 0; n < nicNameList.Count; n++)
{
string nicName = nicNameList[n];
- await UnsetDnsToStatic(dns1, dns2, nicName);
+ await UnsetDnsToStatic(ipv4_1, ipv4_2, ipv6_1, ipv6_2, nicName);
}
}
- public async Task UnsetDnsToStatic(string dns1, string dns2, NetworkInterface? nic)
+ public async Task UnsetDnsToStatic(string ipv4_1, string ipv4_2, string ipv6_1, string ipv6_2, NetworkInterface? nic)
{
if (nic == null) return;
- await UnsetDnsToStatic(dns1, dns2, nic.Name);
+ await UnsetDnsToStatic(ipv4_1, ipv4_2, ipv6_1, ipv6_2, nic.Name);
}
- public async Task UnsetDnsToStatic(string dns1, string dns2, CustomComboBox ccb)
+ public async Task UnsetDnsToStatic(string ipv4_1, string ipv4_2, string ipv6_1, string ipv6_2, CustomComboBox ccb)
{
string? nicName = ccb.SelectedItem as string;
if (string.IsNullOrEmpty(nicName)) return;
- await UnsetDnsToStatic(dns1, dns2, nicName);
+ await UnsetDnsToStatic(ipv4_1, ipv4_2, ipv6_1, ipv6_2, nicName);
}
public async Task UnsetSavedDnssToDHCP()
diff --git a/SecureDNSClient/SecureDNS/SettingsWindow.cs b/SecureDNSClient/SecureDNS/SettingsWindow.cs
index e2c105c..0f64d1c 100644
--- a/SecureDNSClient/SecureDNS/SettingsWindow.cs
+++ b/SecureDNSClient/SecureDNS/SettingsWindow.cs
@@ -50,9 +50,13 @@ public string GetCfCleanIpSetting()
try
{
+ bool isEnable = false;
+ this.InvokeIt(() => isEnable = CustomCheckBoxSettingProxyCfCleanIP.Checked);
+ if (!isEnable) return result;
+
this.InvokeIt(() => result = CustomTextBoxSettingProxyCfCleanIP.Text.Trim());
- bool isCfCleanIpv4Valid = NetworkTool.IsIPv4Valid(result, out IPAddress? _);
- if (!isCfCleanIpv4Valid) result = string.Empty;
+ bool isCfCleanIpValid = NetworkTool.IsIP(result, out IPAddress? _);
+ if (!isCfCleanIpValid) result = string.Empty;
}
catch (Exception ex)
{
@@ -162,7 +166,7 @@ public IPAddress GetBootstrapSetting(out int bootstrapPort)
int bootstrapPortD = SecureDNS.BootstrapDnsPort;
try
{
- bool isBootstrap = NetworkTool.IsIPv4Valid(CustomTextBoxSettingBootstrapDnsIP.Text, out IPAddress? bootstrapIP);
+ bool isBootstrap = NetworkTool.IsIP(CustomTextBoxSettingBootstrapDnsIP.Text, out IPAddress? bootstrapIP);
if (isBootstrap && bootstrapIP != null)
{
bootstrap = bootstrapIP;
diff --git a/SecureDNSClient/SecureDNSClient.csproj b/SecureDNSClient/SecureDNSClient.csproj
index 2ffe7e9..7d57045 100644
--- a/SecureDNSClient/SecureDNSClient.csproj
+++ b/SecureDNSClient/SecureDNSClient.csproj
@@ -9,7 +9,7 @@
app.manifest
MSasanMH
SDC - Secure DNS Client
- $(VersionPrefix)3.2.1
+ $(VersionPrefix)3.2.5
SecureDNSClient.png
SecureDNSClientMulti.ico
AnyCPU;x64;x86
diff --git a/SecureDNSClient/SecureDNSClient.csproj.user b/SecureDNSClient/SecureDNSClient.csproj.user
index 5931c12..33f0bed 100644
--- a/SecureDNSClient/SecureDNSClient.csproj.user
+++ b/SecureDNSClient/SecureDNSClient.csproj.user
@@ -4,6 +4,9 @@
<_LastSelectedProfileId>D:\PPWin\SecureDNSClient\SecureDNSClient\Properties\PublishProfiles\X86.pubxml
+
+ Form
+
Form
diff --git a/SecureDNSClientPortable/Properties/PublishProfiles/X64.pubxml.user b/SecureDNSClientPortable/Properties/PublishProfiles/X64.pubxml.user
index 7ea0bea..274b222 100644
--- a/SecureDNSClientPortable/Properties/PublishProfiles/X64.pubxml.user
+++ b/SecureDNSClientPortable/Properties/PublishProfiles/X64.pubxml.user
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
- True|2024-06-18T14:02:24.4885545Z;True|2024-06-08T12:04:08.7340814+03:30;True|2024-06-01T20:52:35.7230326+03:30;True|2024-05-29T18:58:47.9485812+03:30;True|2024-05-18T14:21:31.4607415+03:30;True|2024-05-07T18:00:41.2240494+03:30;True|2024-05-07T17:58:17.7233091+03:30;True|2024-04-17T13:54:41.0719553+03:30;True|2024-02-22T16:26:11.9448468+03:30;True|2024-02-15T15:05:45.4399056+03:30;True|2024-02-12T16:49:53.0124992+03:30;True|2024-01-03T17:32:41.3893740+03:30;True|2023-12-26T17:47:26.7634086+03:30;False|2023-12-26T17:45:40.3913495+03:30;False|2023-12-26T17:43:07.3061301+03:30;True|2023-11-30T18:28:55.4728727+03:30;True|2023-11-29T19:03:27.4627265+03:30;True|2023-11-22T22:11:07.0413847+03:30;True|2023-11-22T21:22:35.3456144+03:30;True|2023-11-22T16:45:19.8369807+03:30;True|2023-11-22T00:07:00.4862671+03:30;True|2023-11-22T00:00:31.5991578+03:30;True|2023-11-21T23:58:13.1455074+03:30;True|2023-11-21T21:39:01.8693651+03:30;True|2023-11-21T21:35:49.1628715+03:30;True|2023-11-21T21:33:59.5746539+03:30;True|2023-11-01T14:46:54.2492009+03:30;True|2023-11-01T14:34:35.0199729+03:30;True|2023-10-27T20:38:12.0854159+03:30;True|2023-10-27T16:48:54.0694203+03:30;True|2023-10-27T16:42:47.5918926+03:30;True|2023-10-27T16:40:09.9228514+03:30;True|2023-10-16T20:10:27.1536968+03:30;True|2023-09-09T20:55:20.5997263+03:30;True|2023-09-09T19:15:53.2907333+03:30;True|2023-09-06T17:18:07.5831910+03:30;True|2023-08-27T21:21:59.9308143+03:30;True|2023-08-07T11:04:58.2158763+03:30;True|2023-08-01T17:47:06.6654646+03:30;True|2023-07-29T21:56:36.3830251+03:30;True|2023-07-17T20:17:33.7464374+03:30;True|2023-07-03T16:04:13.0193508+03:30;True|2023-06-28T19:15:06.4877499+03:30;True|2023-06-17T15:30:29.1914633+03:30;True|2023-06-17T13:51:54.4241557+03:30;True|2023-06-04T18:48:08.0977577+03:30;True|2023-06-04T16:29:38.8482141+03:30;True|2023-06-02T20:17:38.0623106+03:30;True|2023-06-02T19:50:27.6325136+03:30;True|2023-06-02T19:25:16.8004627+03:30;True|2023-06-02T19:21:33.2641926+03:30;True|2023-06-02T16:14:48.5208600+03:30;True|2023-05-30T16:57:19.0001069+03:30;True|2023-05-29T19:17:44.2223328+03:30;True|2023-05-29T18:43:15.8911213+03:30;True|2023-05-27T16:25:27.9631407+03:30;True|2023-05-27T13:50:40.9938592+03:30;True|2023-05-25T23:22:04.4226759+03:30;True|2023-05-19T20:55:03.6988953+03:30;True|2023-05-04T20:13:44.0531282+03:30;True|2023-05-03T17:20:58.6158351+03:30;True|2023-04-07T18:22:18.1443242+03:30;True|2023-04-07T18:01:23.1687551+03:30;True|2023-04-07T17:56:25.8534493+03:30;True|2023-02-23T19:42:03.7111255+03:30;True|2023-02-21T22:26:35.4429594+03:30;True|2023-02-20T17:47:25.0792312+03:30;True|2023-02-16T01:42:37.6467629+03:30;True|2023-02-15T22:16:38.0474815+03:30;True|2023-02-15T21:50:25.4952184+03:30;True|2023-02-15T21:49:01.8562159+03:30;
+ True|2024-10-11T13:52:15.6311677Z;True|2024-06-18T17:32:24.4885545+03:30;True|2024-06-08T12:04:08.7340814+03:30;True|2024-06-01T20:52:35.7230326+03:30;True|2024-05-29T18:58:47.9485812+03:30;True|2024-05-18T14:21:31.4607415+03:30;True|2024-05-07T18:00:41.2240494+03:30;True|2024-05-07T17:58:17.7233091+03:30;True|2024-04-17T13:54:41.0719553+03:30;True|2024-02-22T16:26:11.9448468+03:30;True|2024-02-15T15:05:45.4399056+03:30;True|2024-02-12T16:49:53.0124992+03:30;True|2024-01-03T17:32:41.3893740+03:30;True|2023-12-26T17:47:26.7634086+03:30;False|2023-12-26T17:45:40.3913495+03:30;False|2023-12-26T17:43:07.3061301+03:30;True|2023-11-30T18:28:55.4728727+03:30;True|2023-11-29T19:03:27.4627265+03:30;True|2023-11-22T22:11:07.0413847+03:30;True|2023-11-22T21:22:35.3456144+03:30;True|2023-11-22T16:45:19.8369807+03:30;True|2023-11-22T00:07:00.4862671+03:30;True|2023-11-22T00:00:31.5991578+03:30;True|2023-11-21T23:58:13.1455074+03:30;True|2023-11-21T21:39:01.8693651+03:30;True|2023-11-21T21:35:49.1628715+03:30;True|2023-11-21T21:33:59.5746539+03:30;True|2023-11-01T14:46:54.2492009+03:30;True|2023-11-01T14:34:35.0199729+03:30;True|2023-10-27T20:38:12.0854159+03:30;True|2023-10-27T16:48:54.0694203+03:30;True|2023-10-27T16:42:47.5918926+03:30;True|2023-10-27T16:40:09.9228514+03:30;True|2023-10-16T20:10:27.1536968+03:30;True|2023-09-09T20:55:20.5997263+03:30;True|2023-09-09T19:15:53.2907333+03:30;True|2023-09-06T17:18:07.5831910+03:30;True|2023-08-27T21:21:59.9308143+03:30;True|2023-08-07T11:04:58.2158763+03:30;True|2023-08-01T17:47:06.6654646+03:30;True|2023-07-29T21:56:36.3830251+03:30;True|2023-07-17T20:17:33.7464374+03:30;True|2023-07-03T16:04:13.0193508+03:30;True|2023-06-28T19:15:06.4877499+03:30;True|2023-06-17T15:30:29.1914633+03:30;True|2023-06-17T13:51:54.4241557+03:30;True|2023-06-04T18:48:08.0977577+03:30;True|2023-06-04T16:29:38.8482141+03:30;True|2023-06-02T20:17:38.0623106+03:30;True|2023-06-02T19:50:27.6325136+03:30;True|2023-06-02T19:25:16.8004627+03:30;True|2023-06-02T19:21:33.2641926+03:30;True|2023-06-02T16:14:48.5208600+03:30;True|2023-05-30T16:57:19.0001069+03:30;True|2023-05-29T19:17:44.2223328+03:30;True|2023-05-29T18:43:15.8911213+03:30;True|2023-05-27T16:25:27.9631407+03:30;True|2023-05-27T13:50:40.9938592+03:30;True|2023-05-25T23:22:04.4226759+03:30;True|2023-05-19T20:55:03.6988953+03:30;True|2023-05-04T20:13:44.0531282+03:30;True|2023-05-03T17:20:58.6158351+03:30;True|2023-04-07T18:22:18.1443242+03:30;True|2023-04-07T18:01:23.1687551+03:30;True|2023-04-07T17:56:25.8534493+03:30;True|2023-02-23T19:42:03.7111255+03:30;True|2023-02-21T22:26:35.4429594+03:30;True|2023-02-20T17:47:25.0792312+03:30;True|2023-02-16T01:42:37.6467629+03:30;True|2023-02-15T22:16:38.0474815+03:30;True|2023-02-15T21:50:25.4952184+03:30;True|2023-02-15T21:49:01.8562159+03:30;
\ No newline at end of file
diff --git a/SecureDNSClientPortable/Properties/PublishProfiles/X86.pubxml.user b/SecureDNSClientPortable/Properties/PublishProfiles/X86.pubxml.user
index 1aa120f..8b45af0 100644
--- a/SecureDNSClientPortable/Properties/PublishProfiles/X86.pubxml.user
+++ b/SecureDNSClientPortable/Properties/PublishProfiles/X86.pubxml.user
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
- True|2024-06-18T14:02:09.1110930Z;True|2024-06-08T12:09:16.6276593+03:30;True|2024-05-07T18:04:03.6619745+03:30;True|2024-04-17T13:55:49.0068268+03:30;True|2024-02-22T16:27:33.0909163+03:30;True|2024-02-15T15:04:29.4891169+03:30;True|2024-02-12T16:50:34.2794622+03:30;True|2024-01-03T17:33:24.7347632+03:30;True|2023-12-26T17:48:30.4302241+03:30;True|2023-11-29T19:04:43.8350279+03:30;True|2023-11-22T22:11:23.9821126+03:30;True|2023-11-22T21:22:10.6632213+03:30;True|2023-11-22T16:46:45.9003148+03:30;True|2023-11-22T16:46:10.1111465+03:30;True|2023-11-22T00:06:44.2797471+03:30;True|2023-11-22T00:00:59.8087013+03:30;True|2023-11-21T23:59:17.8225650+03:30;True|2023-11-21T23:01:16.2118185+03:30;True|2023-11-21T22:46:47.5785340+03:30;True|2023-11-21T21:42:15.3939570+03:30;
+ True|2024-10-11T13:59:28.5204871Z;True|2024-06-18T17:32:09.1110930+03:30;True|2024-06-08T12:09:16.6276593+03:30;True|2024-05-07T18:04:03.6619745+03:30;True|2024-04-17T13:55:49.0068268+03:30;True|2024-02-22T16:27:33.0909163+03:30;True|2024-02-15T15:04:29.4891169+03:30;True|2024-02-12T16:50:34.2794622+03:30;True|2024-01-03T17:33:24.7347632+03:30;True|2023-12-26T17:48:30.4302241+03:30;True|2023-11-29T19:04:43.8350279+03:30;True|2023-11-22T22:11:23.9821126+03:30;True|2023-11-22T21:22:10.6632213+03:30;True|2023-11-22T16:46:45.9003148+03:30;True|2023-11-22T16:46:10.1111465+03:30;True|2023-11-22T00:06:44.2797471+03:30;True|2023-11-22T00:00:59.8087013+03:30;True|2023-11-21T23:59:17.8225650+03:30;True|2023-11-21T23:01:16.2118185+03:30;True|2023-11-21T22:46:47.5785340+03:30;True|2023-11-21T21:42:15.3939570+03:30;
\ No newline at end of file
diff --git a/SecureDNSClientPortable/SecureDNSClientPortable.csproj b/SecureDNSClientPortable/SecureDNSClientPortable.csproj
index 1dd1162..c9a7177 100644
--- a/SecureDNSClientPortable/SecureDNSClientPortable.csproj
+++ b/SecureDNSClientPortable/SecureDNSClientPortable.csproj
@@ -8,7 +8,7 @@
enable
SecureDNSClientMulti.ico
true
- $(VersionPrefix)3.2.1
+ $(VersionPrefix)3.2.5
MSasanMH
app.manifest
AnyCPU;x64;x86
diff --git a/SecureDNSClientPortable/SecureDNSClientPortable.csproj.user b/SecureDNSClientPortable/SecureDNSClientPortable.csproj.user
index 62bdc7b..2882a38 100644
--- a/SecureDNSClientPortable/SecureDNSClientPortable.csproj.user
+++ b/SecureDNSClientPortable/SecureDNSClientPortable.csproj.user
@@ -1,6 +1,6 @@
- <_LastSelectedProfileId>D:\PPWin\SecureDNSClient\SecureDNSClientPortable\Properties\PublishProfiles\X64.pubxml
+ <_LastSelectedProfileId>D:\PPWin\SecureDNSClient\SecureDNSClientPortable\Properties\PublishProfiles\X86.pubxml
\ No newline at end of file