Skip to content

Commit

Permalink
v3.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
msasanmh committed Mar 6, 2025
1 parent 3f10751 commit 5d7507d
Show file tree
Hide file tree
Showing 210 changed files with 23,623 additions and 1,765 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[*.cs]

# IDE0042: Deconstruct variable declaration
csharp_style_deconstructed_variable_declaration = false
130 changes: 7 additions & 123 deletions ConsoleAppTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,8 @@ internal class Program
static async Task Main(string[] args)
{
MsmhAgnosticServer server1 = new();
MsmhAgnosticServer server2 = new();

server1.OnRequestReceived += Server_OnRequestReceived;
server2.OnRequestReceived += Server_OnRequestReceived;

string dohUrl = "https://dns.cloudflare.com/dns-query";
string dohHost = "dns.cloudflare.com";
string dohCleanIP = "104.16.132.229";
string cfClenIP = "172.66.192.140";

// Set DnsRules Content
string dnsRulesContent = $"{dohHost}|{dohCleanIP};";

// Set ProxyRules Content (Apply Fake DNS and White List Program)
string proxyRulesContent = $"{dohHost}|{dohCleanIP};";
proxyRulesContent += $"\n{dohCleanIP}|+;";
//proxyRulesContent += $"\n*|-;"; // Block Other Requests

List<string> dnsServers1 = new()
{
Expand All @@ -44,132 +29,31 @@ static async Task Main(string[] args)
//"https://45.90.29.204:443/dns-query",
//"udp://208.67.222.222:5353",
//"9.9.9.9:9953",
dohUrl
};

AgnosticSettings settings1 = new()
{
Working_Mode = AgnosticSettings.WorkingMode.DnsAndProxy,
ListenerPort = 8080,
DnsTimeoutSec = 10,
ProxyTimeoutSec = 60,
ProxyTimeoutSec = 1000,
MaxRequests = 1000000,
KillOnCpuUsage = 40,
DNSs = dnsServers1,
BootstrapIpAddress = IPAddress.Loopback,
BootstrapPort = 8080,
BootstrapIpAddress = IPAddress.Parse("8.8.8.8"),
BootstrapPort = 53,
AllowInsecure = false,
BlockPort80 = true,
CloudflareCleanIP = cfClenIP,
UpstreamProxyScheme = $"socks5://{IPAddress.Loopback}:8080",
//ApplyUpstreamOnlyToBlockedIps = true
BlockPort80 = false,
UpstreamProxyScheme = $"http://fodev.org:8118", // http://fodev.org:8118
ApplyUpstreamOnlyToBlockedIps = false
};

AgnosticProgram.Fragment fragment = new();
fragment.Set(AgnosticProgram.Fragment.Mode.Program, 50, AgnosticProgram.Fragment.ChunkMode.SNI, 5, 2, 1);
server1.EnableFragment(fragment);

AgnosticProgram.Rules dnsRules1 = new();
await dnsRules1.SetAsync(AgnosticProgram.Rules.Mode.Text, dnsRulesContent);
server1.EnableRules(dnsRules1);

AgnosticProgram.Rules proxyRules1 = new();
await proxyRules1.SetAsync(AgnosticProgram.Rules.Mode.Text, proxyRulesContent);
server1.EnableRules(proxyRules1);


List<string> dnsServers2 = new()
{
$"udp://{IPAddress.Loopback}:8080"
};

AgnosticSettings settings2 = new()
{
Working_Mode = AgnosticSettings.WorkingMode.Dns,
ListenerPort = 443,
DnsTimeoutSec = 10,
DNSs = dnsServers2,
MaxRequests = 1000000,
BootstrapIpAddress = IPAddress.Loopback,
BootstrapPort = 8080,
AllowInsecure = false,
//UpstreamProxyScheme = "socks5://192.168.1.120:10808",
//ApplyUpstreamOnlyToBlockedIps = true
};

AgnosticSettingsSSL settingsSSL = new(true)
{
EnableSSL = true,
//ChangeSni = true,
//DefaultSni = "speedtest.net",
};

await server2.EnableSSL(settingsSSL);

AgnosticProgram.DnsLimit dnsLimit = new();
dnsLimit.Set(true, false, AgnosticProgram.DnsLimit.LimitDoHPathsMode.Text, "msasanmhX");
server2.EnableDnsLimit(dnsLimit);
await server1.StartAsync(settings1);

server1.Start(settings1);
server2.Start(settings2);



DnsMessage dmQ1 = DnsMessage.CreateQuery(DnsEnums.DnsProtocol.UDP, "youtube.com", DnsEnums.RRType.A, DnsEnums.CLASS.IN);
DnsMessage.TryWrite(dmQ1, out byte[] dmQBytes1);
DnsMessage dmQ2 = DnsMessage.CreateQuery(DnsEnums.DnsProtocol.DoH, "mail.yahoo.com", DnsEnums.RRType.A, DnsEnums.CLASS.IN);
DnsMessage.TryWrite(dmQ2, out byte[] dmQBytes2);
string dns = "udp://127.0.0.1:8080";
string doh = "https://127.0.0.1:443/msasanmhX/dns-query";
//doh = "https://dns-cloudflare.com/dns-query";

IPAddress bootIP = IPAddress.Parse("8.8.8.8");
int bootPort = 53;



HttpRequest httpRequest = new()
{
URI = new Uri("https://google.com"),
ProxyScheme = "socks5://127.0.0.1:443",
TimeoutMS = 5000
};


int n = 0;


//tt1();
//tt1();
//tt1();
//tt2();
//tt2();
//tt2();


async void tt1()
{
while (true)
{
//await Task.Delay(50);
n++;
await DnsClient.QueryAsync(dmQBytes1, DnsEnums.DnsProtocol.UDP, dns, true, bootIP, bootPort, 1000, CancellationToken.None);
//HttpRequest.SendAsync(httpRequest);
//if (n == 5000) break;
}
}

async void tt2()
{
while (true)
{
//await Task.Delay(50);
n++;
await DnsClient.QueryAsync(dmQBytes2, DnsEnums.DnsProtocol.DoH, doh, true, bootIP, bootPort, 1000, CancellationToken.None);
//HttpRequest.SendAsync(httpRequest);
if (n == 5000) break;
}
}


Console.ReadLine();
Expand Down
3 changes: 3 additions & 0 deletions DNSveil/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
</configuration>
29 changes: 29 additions & 0 deletions DNSveil/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Application x:Class="DNSveil.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DNSveil"
xmlns:resources="clr-namespace:MsmhToolsWpfClass.Themes;assembly=MsmhToolsWpfClass"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MsmhToolsWpfClass;component/Themes/Generic.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MsmhToolsWpfClass;component/Styles.xaml"/>

<!-- Merge The Default Theme (Dark) -->
<ResourceDictionary Source="{x:Static resources:AppTheme.DarkThemeResourcesFile}"/>
</ResourceDictionary.MergedDictionaries>

<!--Built-In Bool To Visibility Converter-->
<BooleanToVisibilityConverter x:Key="BooleanToVisibility" />
<!--
e.g.
<ContentControl Content="{Binding}"
Visibility="{Binding IsPanelVisible, Converter={StaticResource BooleanToVisibility}}">
-->

</ResourceDictionary>


</Application.Resources>
</Application>
13 changes: 13 additions & 0 deletions DNSveil/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Windows;

namespace DNSveil
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{

}

}
10 changes: 10 additions & 0 deletions DNSveil/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
61 changes: 61 additions & 0 deletions DNSveil/DNSveil.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>DNSveilMulti.ico</ApplicationIcon>
<SignAssembly>False</SignAssembly>
<Title>DNSveil</Title>
<Authors>msasanmh</Authors>
<Description>A Secure DNS Client</Description>
<Copyright>MSasanMH</Copyright>
<PackageProjectUrl>https://github.com/msasanmh/DNSveil</PackageProjectUrl>
<PackageIcon>DNSveil.png</PackageIcon>
<RepositoryUrl>https://github.com/msasanmh/DNSveil</RepositoryUrl>
<PackageTags>DNSveil;DNS Client;Proxy Server</PackageTags>
<Version>$(VersionPrefix) 0.0.1</Version>
<PlatformTarget>x64</PlatformTarget>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Platforms>AnyCPU;x64;x86</Platforms>
<UseWindowsForms>False</UseWindowsForms>
</PropertyGroup>

<ItemGroup>
<None Remove="ManageServers\DNSveil.png" />
</ItemGroup>

<ItemGroup>
<Content Include="DNSveilMulti.ico" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MsmhToolsWpfClass\MsmhToolsWpfClass.csproj" />
</ItemGroup>

<ItemGroup>
<Resource Include="DNSveil.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Resource>
<Resource Include="ManageServers\DNSveil.png" />
</ItemGroup>

<ItemGroup>
<None Update="DNSveil.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Update="LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Update="SecureDNSClient.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

</Project>
35 changes: 35 additions & 0 deletions DNSveil/DNSveil.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
<ItemGroup>
<Compile Update="ManageServers\ManageServersWindow.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="PageTest.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="TestWindow.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="TestWindow2.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Update="MainWindow.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="ManageServers\ManageServersWindow.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="PageTest.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="TestWindow.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="TestWindow2.xaml">
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project>
Binary file added DNSveil/DNSveil.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added DNSveil/DNSveilMulti.ico
Binary file not shown.
Loading

0 comments on commit 5d7507d

Please sign in to comment.