PSScriptTools icon indicating copy to clipboard operation
PSScriptTools copied to clipboard

[Bug]: Invoke-RestMethod error on Get-WhoIs

Open Douda opened this issue 1 year ago • 1 comments

Describe the problem

Get-WhoIs fails with a specific IP passed

Install-Module PSScriptTools

Get-WhoIs -IPAddress 8.8.8.8

Name IP      RegisteredOrganization NetBlocks  Updated
---- --      ---------------------- ---------  -------
GOGL 8.8.8.8 Google LLC             8.8.8.0/24 28/12/2023 23:24:56

# Testing specific IP

Get-WhoIs -IPAddress 154.62.105.215
Invoke-RestMethod: C:\Users\Douda\Documents\PowerShell\Modules\PSScriptTools\2.50.0\functions\Get-WhoIs.ps1:53
Line |
  53 |  …                    = (Invoke-RestMethod $r.net.orgRef.'#text').org.ci …
     |                                            ~~~~~~~~~~~~~~~~~~~~~
     | Cannot validate argument on parameter 'Uri'. The argument is null or empty. Provide an argument that is not null
     | or empty, and then try the command again.

Expectation

No response

Additional Information

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.3
PSEdition                      Core
GitCommitId                    7.4.3
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PowerShell version

Other

Platform

Windows 11 Pro or Enterprise

Additional Checks

  • [X] You are using the latest version of this module.
  • [ ] You have read this repository's README file.
  • [X] You have read full help and examples for the command you are having problems with.
  • [X] You are running PowerShell in an elevated session.
  • [X] You are running in a traditional PowerShell console or Windows Terminal > Windows Terminal

Douda avatar Jul 27 '24 20:07 Douda

Looks like I need a little error handling.

jdhitsolutions avatar Aug 02 '24 20:08 jdhitsolutions

this IP returns a customerRef Property, instead of an orgRef property. looks like end customers that have been swip'd a netblock from their ISP. so, if orgRef is empty, look for customerRef.

tksunw avatar Dec 04 '24 15:12 tksunw

This should be addressed in the next release.

jdhitsolutions avatar Mar 25 '25 14:03 jdhitsolutions

Update to v3.0.0 and see if this resolves the issue.

jdhitsolutions avatar Mar 26 '25 18:03 jdhitsolutions