mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-12 16:06:49 +02:00
Update check-dns.ps1
This commit is contained in:
parent
9129205ce9
commit
62eb13ae0e
@ -12,21 +12,20 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
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"
|
$Table = Import-CSV "$PSScriptRoot/../Data/frequent-domains.csv"
|
||||||
$NumRows = $Table.Length
|
$NumRows = $Table.Length
|
||||||
|
|
||||||
Write-Progress "⏳ Step 2/2 - Resolving $NumRows domains..."
|
Write-Progress "⏳ (2/2) Resolving $NumRows domains..."
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
foreach($Row in $Table){$nop=dig $Row.Domain +short}
|
foreach($Row in $Table){$nop=dig $Row.Domain +short}
|
||||||
} else {
|
} else {
|
||||||
foreach($Row in $Table){$nop=Resolve-DNSName $Row.Domain}
|
foreach($Row in $Table){$nop=Resolve-DNSName $Row.Domain}
|
||||||
}
|
}
|
||||||
|
|
||||||
[float]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
[float]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
$Average = [math]::round($NumRows / $Elapsed, 1)
|
|
||||||
|
|
||||||
|
$Average = [math]::round($NumRows / $Elapsed, 1)
|
||||||
if ($Average -gt 10.0) {
|
if ($Average -gt 10.0) {
|
||||||
"✅ DNS resolves $Average domains per second"
|
"✅ DNS resolves $Average domains per second"
|
||||||
} else {
|
} else {
|
||||||
@ -36,4 +35,4 @@ try {
|
|||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user