Update check-dns.ps1

This commit is contained in:
Markus Fleschutz 2022-12-23 19:02:04 +01:00
parent 9129205ce9
commit 62eb13ae0e

View File

@ -12,21 +12,20 @@
#>
try {
Write-Progress "Step 1/2 - Reading from Data/frequent-domains.csv..."
Write-Progress "(1/2) Loading Data/frequent-domains.csv..."
$Table = Import-CSV "$PSScriptRoot/../Data/frequent-domains.csv"
$NumRows = $Table.Length
Write-Progress "Step 2/2 - Resolving $NumRows domains..."
Write-Progress "(2/2) Resolving $NumRows domains..."
$StopWatch = [system.diagnostics.stopwatch]::startNew()
if ($IsLinux) {
foreach($Row in $Table){$nop=dig $Row.Domain +short}
} else {
foreach($Row in $Table){$nop=Resolve-DNSName $Row.Domain}
}
[float]$Elapsed = $StopWatch.Elapsed.TotalSeconds
$Average = [math]::round($NumRows / $Elapsed, 1)
$Average = [math]::round($NumRows / $Elapsed, 1)
if ($Average -gt 10.0) {
"✅ DNS resolves $Average domains per second"
} else {
@ -36,4 +35,4 @@ try {
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}
}