Quick and dirty #Powershell forward and reverse #whois.

Just a real quick way to do whois lookups on domains, and IP addresses, in Powershell. Forward lookup uses Webservicex.net, and reverse uses Arin.net.

function whois($site) {
    #Syntax:  whois google.com
    $web = New-WebServiceProxy ‘http://www.webservicex.net/whois.asmx?WSDL’
    $web.GetWhoIs("$($site)")
}

function rwhois($ip){
    #syntax:  whois 8.8.8.8
    $baseURL = 'http://whois.arin.net/rest'
    $url = "$baseUrl/ip/$ip"
    $r = Invoke-RestMethod  $url
    $r.net
}

Cheers!