Skip to content

Instantly share code, notes, and snippets.

@spy86
Created October 25, 2019 17:43
Show Gist options
  • Select an option

  • Save spy86/471e2ba8bbfc6c3467c3a1f8d0458465 to your computer and use it in GitHub Desktop.

Select an option

Save spy86/471e2ba8bbfc6c3467c3a1f8d0458465 to your computer and use it in GitHub Desktop.
Simple script in powershell (WHOIS)
param(
$domain
) #end param
# Begin Functions
Function funWhoIs()
{
"Obtaining WhoIs $domain ..."
$strQuery="http://reports.internic.net/cgi/whois?whois_nic=$domain&type=domain"
$text = (new-object System.Net.WebClient).DownloadString($StrQuery)
$startIndex = $text.IndexOf('Domain Name:')
$endIndex = $text.IndexOf('Expiration Date:')
if(($startIndex -ge 0) -and ($endIndex -ge 0))
{
$partialText = $text.Substring($startIndex, $endIndex - $startIndex)
""
$partialText
}
else
{
""
"No answer found."
}
exit
} #End Functions
funWhoIs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment