Skip to content

Start-Sniffer: Error if LocalIP not provided and Persistent Route for 0.0.0.0 is set. #3

@amnich

Description

@amnich

If I don't provide the LocalIP for Start-Sniffer it returns an error

 Using Local IP: Default 
   Cannot convert value "Default " to type "System.Net.IPAddress". Error: "Wrong IP Address (Error edited - was in Polish)."
   At D:\PoSH\Skrypty\NetworkSniffer\Network-SnifferTools.psm1:762 char:5
   +     $Endpoint = New-Object System.Net.IPEndpoint([Net.IPAddress]"$Loc ...
   +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
       + FullyQualifiedErrorId : InvalidCastParseTargetInvocation

The reason is I have a persistent route with a 0.0.0.0 IP address so the value of LocalIP is 'Default' instead of my IP.

===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0    192.168.1.254    192.168.1.145    306
===========================================================================
Persistent Routes:
  Network Address          Netmask  Gateway Address  Metric
          0.0.0.0          0.0.0.0    192.168.1.254  Default
===========================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions