This commit is contained in:
EonaCat 2023-03-02 16:05:30 +01:00
parent d3aef63feb
commit 27bdfceb5a
5 changed files with 50 additions and 52 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net7.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
@ -28,5 +28,8 @@
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Update="Servers.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -21,6 +21,7 @@ namespace EonaCat.DnsTester.Helpers
{
client.DontFragment = true;
client.EnableBroadcast = false;
client.Client.SendTimeout = DnsSendTimeout;
client.Client.ReceiveTimeout = DnsReceiveTimeout;
byte[] responseBytes = null;
if (FakeResponse)
@ -42,6 +43,7 @@ namespace EonaCat.DnsTester.Helpers
// For testing purposes
public static bool FakeResponse { get; set; }
public static int DnsSendTimeout { get; set; } = 5;
public static int DnsReceiveTimeout { get; set; } = 5;

View File

@ -39,11 +39,23 @@ namespace EonaCat.DnsTester.Helpers
string url = searchEngine.Value + letters;
try
{
using (var client = new WebClient())
{
string responseString = client.DownloadString(url);
string responseString = null;
try
{
responseString = client.DownloadString(url);
}
catch (Exception ex)
{
searchEngineUrls.Remove(searchEngine.Key);
SetStatus($"{searchEngine.Key}: {ex.Message}");
}
if (responseString == null)
{
continue;
}
// find all .xxx.com addresses
MatchCollection hostNames = Regex.Matches(responseString, @"[.](\w+[.]com)");
@ -74,17 +86,8 @@ namespace EonaCat.DnsTester.Helpers
}
}
await Task.Delay(100);
}
catch (Exception ex)
{
searchEngineUrls.Remove(searchEngine.Key);
SetStatus($"{searchEngine.Key}: {ex.Message}");
}
finally
{
letters = GetRandomLetters();
}
await Task.Delay(100);
}
var urlText = "url" + (urls.Count > 1 ? "'s" : string.Empty);

View File

@ -55,12 +55,6 @@ namespace EonaCat.DnsTester
urls = await UrlHelper.RetrieveUrls(numThreads, numUrlsPerThread);
AddUrlToView(urls);
if (IsRunning)
{
return;
}
IsRunning = true;
await Process(_recordType, urls.ToArray(), _dnsServer1, _dnsServer2);
IsRunning = false;
@ -198,15 +192,11 @@ namespace EonaCat.DnsTester
DnsHelper.OnLog += DnsHelper_OnLog;
for (int i = 0; i < urlsTotal; i++)
{
await Task.Run(async () =>
{
var currentUrl = urls[i];
await ExecuteDns1(recordType, dnsAddress1, currentUrl, dnsId1, i);
if (!chkDns2.Checked) return;
await ExecuteDns2(recordType, dnsAddress2, currentUrl, dnsId2, i);
});
await Task.Delay(100);
}
}

BIN
Screenshots/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB