Skip to content

Commit

Permalink
Update validator.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkingfeeling authored Apr 6, 2023
1 parent dec2a4d commit 873509e
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions validator.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
$domain = "domain.com"
$domain = "whiskergalaxy.com"
$start = 1
$end = 400
$outputFile = "valid_results.txt"
$jobs = @()

for ($i = $start; $i -le $end; $i++) {
$hostname = "us-{0:D3}.{1}" -f $i, $domain
$result = nslookup $hostname
if ($result -match "Name:") {
Add-Content -Path $outputFile -Value "$hostname: $result"
}
$hostname = "bne-{0:D3}.{1}" -f $i, $domain
Write-Progress -Activity "Testing domains" -Status "Testing $hostname" -PercentComplete (($i / $end) * 100)
$jobs += Start-Job -ScriptBlock {
param ($hostname)
$result = nslookup $hostname -timeout 500
if ($result -match "Name:") {
$domain = $result -replace '\n', ' ' -replace '\r', '' -replace '.*: (\S+)\..*', '$1'
return $domain
}
} -ArgumentList $hostname
}

$results = $jobs | Receive-Job -Wait -AutoRemoveJob | Sort-Object | Get-Unique
Add-Content -Path $outputFile -Value $results
Write-Progress -Activity "Testing domains" -Status "Completed" -PercentComplete 100

0 comments on commit 873509e

Please sign in to comment.