Skip to content

santisq/PSNetScanners

Repository files navigation

PowerShell Network Scanners

DESCRIPTION

Two PowerShell scripts designed to scan Network IP Ranges or hostname using Runspace for faster execution. And two standalone functions using async techniques for ICMP and TCP scanning.

Name Description
Network-IPScanner Sends ICMP echo requests using the Ping Class and the Dns Class for DNS resolution in parallel with Runspaces.
Network-TCPScanner Sends TCP connection requests using the TcpClient Class in parallel with Runspaces.
Test-ICMPConnectionAsync Standalone function, uses SendPingAsync(...) Method for the async echo requests and GetHostEntryAsync(...) Method for async DNS resolutions.
Network-TCPConnectionAsync                   Standalone function, uses ConnectAsync(...) Method to send the async TCP connection requests.

OUTPUT

Network-IPScanner

  • System.Management.Automation.PSCustomObject
Name        TypeNameOfValue
----        ---------------
Ping        System.Int32
Source      System.String
Address     System.Net.IPAddress
Destination System.String
Latency     System.String
Status      System.Net.NetworkInformation.IPStatus

Network-TCPScanner

  • System.Management.Automation.PSCustomObject
Name         TypeNameOfValue
----         ---------------
Source       System.String
Destination  System.String
Port         System.Int32
Success      System.Boolean

REQUIREMENTS

  • Requires .NET Framework 4.5+ if running Windows PowerShell / .NET Core 1.0+ if running PowerShell Core.

MEASUREMENTS

Below are the measurements scanning a 254 IP range with Test-ICMPConnection default script parameters:

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 4
Milliseconds      : 600
Ticks             : 46007194
TotalDays         : 5.32490671296296E-05
TotalHours        : 0.00127797761111111
TotalMinutes      : 0.0766786566666667
TotalSeconds      : 4.6007194
TotalMilliseconds : 4600.7194

SAMPLE OUTPUT

Network-IPScanner

Ping Source Address       Destination Latency   Status
---- ------ -------       ----------- -------   ------
   1 moon   192.168.1.1   _gateway    3 ms     Success
   1 moon   192.168.1.2   *           113 ms   Success
   1 moon   192.168.1.3   *           214 ms   Success
   1 moon   192.168.1.4   *           591 ms   Success
   1 moon   192.168.1.5   moon        0 ms     Success
   1 moon   192.168.1.6   *           *       TimedOut
   1 moon   192.168.1.7   *           *       TimedOut
   1 moon   192.168.1.8   *           *       TimedOut
   1 moon   192.168.1.9   *           *       TimedOut

Network-TCPScanner

Source          Destination  Port Success
------          ------------ ---- -------
myHostName      google.com     80    True
myHostName      google.com    443    True
myHostName      google.com   8080   False
myHostName      google.com    125   False
myHostName      cisco.com     443    True
myHostName      cisco.com      80    True
myHostName      cisco.com     125   False
myHostName      cisco.com    8080   False
myHostName      amazon.com    443    True
myHostName      amazon.com     80    True
myHostName      amazon.com    125   False
myHostName      amazon.com   8080   False

Releases

No releases published

Packages

No packages published