Search-IP.psm1

#region [Search-IP] Get IP/domain information
function Search-IP {
    <#
        .SYNOPSIS
        Retrieves geolocation and proxy information by specifying a IPv4/IPv6 address or a domain name.
        If you don't supply a query the current IP address will be used.
         
        .DESCRIPTION
        Query utilizes http://ip-api.com free for non-commercial IP Geolocation API.
         
        .EXAMPLE
        Search-IP google.com
 
        status : success
        continent : North America
        country : United States
        countryCode : US
        region : GA
        regionName : Georgia
        city : Atlanta
        zip :
        lat : 33.749
        lon : -84.38798
        timezone : America/New_York
        isp : Google LLC
        org : Google Public DNS (atl)
        as : AS15169 Google LLC
        asname : GOOGLE
        mobile : False
        proxy : False
        hosting : True
        query : 2607:f8b0:4002:c08::66
 
        Description
        =============
        Retrieves IP geolocation and proxy information by domain name "google.com".
        .EXAMPLE
        Search-IP 8.8.8.8
 
        status : success
        continent : North America
        country : United States
        countryCode : US
        region : VA
        regionName : Virginia
        city : Ashburn
        zip : 20149
        lat : 39.03
        lon : -77.5
        timezone : America/New_York
        isp : Google LLC
        org : Google Public DNS
        as : AS15169 Google LLC
        asname : GOOGLE
        mobile : False
        proxy : False
        hosting : True
        query : 8.8.8.8
 
        Description
        =============
        Retrieves IP geolocation and proxy information by IPv4 "8.8.8.8".
 
        .EXAMPLE
        Search-IP 2607:f8b0:4000:818::200e
 
        status : success
        continent : North America
        country : United States
        countryCode : US
        region : CA
        regionName : California
        city : Mountain View
        zip : 94043
        lat : 37.422
        lon : -122.084
        timezone : America/Los_Angeles
        isp : Google LLC
        org : Google LLC
        as : AS15169 Google LLC
        asname : GOOGLE
        mobile : False
        proxy : False
        hosting : True
        query : 2607:f8b0:4000:818::200e
 
        Description
        =============
        Retrieves IP geolocation and proxy information by IPv6 "2607:f8b0:4000:818::200e".
    #>

    [cmdletbinding()]
    param(
        [parameter(ValueFromPipeline = $true)]
        [string]$item
    )
    PROCESS
    {
        Invoke-RestMethod "http://ip-api.com/json/?fields=22278143&${item}"
    }
}
#endregion