Skip to content

Instantly share code, notes, and snippets.

@obscuresec
Created February 2, 2015 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obscuresec/104edc53459715214226 to your computer and use it in GitHub Desktop.
Save obscuresec/104edc53459715214226 to your computer and use it in GitHub Desktop.
Resolve a Subnet (dirty)
Function Get-SubnetResolution {
$Subnet = '74.125.228' #change this
$Wait = 2 #Seconds to wait between resolution
$HostRangeLow = 1
$HostRangeHigh = 10
$Range = $HostRangeLow..$HostRangeHigh
#Instantiate once
$DnsObject = [Net.DNS]
Foreach ($TargetHost in $Range) {
$IPAddress = $Subnet + '.' + $TargetHost
$Resolved = $DnsObject::GetHostEntry("$IPAddress")
$ObjectProps = @{'Hostname' = $Resolved.HostName;
'IP Address' = $Resolved.AddressList}
$Results = New-Object -TypeName PSObject -Property $ObjectProps
Write-Output $Results
Start-Sleep -Seconds $Wait
}
}
Get-SubnetResolution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment