PoshCode Archive  Artifact [a105cb1675]

Artifact a105cb1675cc42be2f42a343d72b449705bb9589c1f17ce0904b757459da1f3f:

  • File Get-WhoisAbuse.ps1 — part of check-in [be25e9a74b] at 2018-06-10 13:46:10 on branch trunk — A function to return the Abuse Email address from arin.net. (user: Josh Wortz size: 948)

# encoding: ascii
# api: powershell
# title: Get-WhoisAbuse
# description: A function to return the Abuse Email address from arin.net.
# version: 0.1
# type: function
# author: Josh Wortz
# license: CC0
# function: get-whoisabuse
# x-poshcode-id: 4807
# x-derived-from-id: 4808
# x-archived: 2015-03-23T12:35:36
# x-published: 2015-01-17T15:12:00
#
#
function get-whoisabuse ([string][ValidatePattern("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$")]$ipaddress)
{

[xml]$a = (Invoke-WebRequest -Uri "http://whois.arin.net/rest/ip/$ipaddress" -ContentType "text/xml").content

[xml]$pocs = (Invoke-WebRequest -Uri (($a.net.orgRef).'#text' + "/pocs") -ContentType "text/xml").content

[xml]$abuse = (Invoke-WebRequest -Uri (($pocs.pocs.pocLinkRef | where {$_.function -eq "AB"}).'#text') -ContentType "text/xml").content

[array]$result = $abuse.poc.emails.email

$result

}