Code Monkey home page Code Monkey logo

powershell_ipv4networkscanner's Introduction

PowerShell | IPv4 network scanner

Powerful asynchronus IPv4 network scanner for PowerShell.

Description

This powerful asynchronus IPv4 network scanner for PowerShell allows you to scan every IPv4 range you want (172.16.1.47 to 172.16.2.5 would work). But there is also the possibility to scan an entire subnet based on an IPv4 address withing the subnet and a the subnetmask/CIDR.

The default result will contain the the IPv4 address, status (Up or Down) and the hostname. Other values can be displayed via parameter (Try Get-Help for more details).

Screenshot

To reach the best possible performance, this script uses a RunspacePool. As you can see in the following screenshot, the individual tasks are distributed across all cpu cores:

Screenshot

If you are looking for a module containing this script as function... you can find it here!

Maybe you're also interested in my asynchronus IPv4 Port Scanner.

Syntax

.\IPv4NetworkScan.ps1 [-StartIPv4Address] <IPAddress> [-EndIPv4Address] <IPAddress> [[-Tries] <Int32>] [[-Threads] <Int32>] [[-DisableDNSResolving]] [[-EnableMACResolving]] [[-ExtendedInformations]] [[-IncludeInactive]] [<CommonParameters>]

.\IPv4NetworkScan.ps1 [-IPv4Address] <IPAddress> [-Mask] <String> [[-Tries] <Int32>] [[-Threads] <Int32>] [[-DisableDNSResolving]] [[-EnableMACResolving]] [[-ExtendedInformations]] [[-IncludeInactive]] [<CommonParameters>]

.\IPv4NetworkScan.ps1 [-IPv4Address] <IPAddress> [-CIDR] <Int32> [[-Tries] <Int32>] [[-Threads] <Int32>] [[-DisableDNSResolving]] [[-EnableMACResolving]] [[-ExtendedInformations]] [[-IncludeInactive]] [<CommonParameters>]

Example 1

PS> .\IPv4NetworkScan.ps1 -StartIPv4Address 192.168.178.0 -EndIPv4Address 192.168.178.20

IPv4Address   Status Hostname
-----------   ------ --------
192.168.178.1 Up     fritz.box

Example 2

PS> .\IPv4NetworkScan.ps1 -IPv4Address 192.168.178.0 -Mask 255.255.255.0 -DisableDNSResolving

IPv4Address    Status
-----------    ------
192.168.178.1  Up
192.168.178.22 Up

Example 3

PS> .\IPv4NetworkScan.ps1 -IPv4Address 192.168.178.0 -CIDR 25 -EnableMACResolving

IPv4Address    Status Hostname           MAC               Vendor
-----------    ------ --------           ---               ------
192.168.178.1  Up     fritz.box          XX-XX-XX-XX-XX-XX AVM Audiovisuelles Marketing und Computersysteme GmbH
192.168.178.22 Up     XXXXX-PC.fritz.box XX-XX-XX-XX-XX-XX ASRock Incorporation

powershell_ipv4networkscanner's People

Contributors

borntoberoot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

powershell_ipv4networkscanner's Issues

Can this scan ports too?

Can you add the ability to scan multiple ports? Then this would be an all around best tool to use. thanks.

Create-OUIListFromWeb.ps1 optimization

The current implementation is too slow and academic.
I would suggest to directly save as CSV. It looks more powershellish.

# "base" or "hex" can be chosen for filtering
# ";" or "," can be chosen as CSV delimiter
$progressPreference = 'silentlyContinue'
$LatestOUIs = (Invoke-WebRequest -Uri "https://standards-oui.ieee.org/oui/oui.txt" -UseBasicParsing).Content -split '[\r\n]' | 
Select-String '\(base 16\)' | 
. { process {$_ -replace '\s+\(base 16\)\s+',','}}
$progressPreference = 'Continue'

@('OUI,Name') + $LatestOUIs | Out-File -FilePath "$PSScriptRoot\Resources\oui.csv" -Encoding utf8

Yet there is a problem with duplicate ouis. The scanner selects the first entry which is likely incorrect.
CSV will eliminate dup issues.

UPDATE

duplicates
it is likely the same company with different names

Count Name   Group
----- ----   -----
    3 080030 {@{uoi=080030; name=NETWORK RESEARCH CORPORATION}, @{uoi=080030; name=ROYAL MELBOURNE INST OF TECH}, @{uoi=080030; name=CERN}}
    2 0001C8 {@{uoi=0001C8; name=THOMAS CONRAD CORP.}, @{uoi=0001C8; name=CONRAD CORP.}}

2nd
in PS7 Invoke-WebRequest is slow

Wrong MAC address (thus wrong Vendor) in results

MAC addresses and Vendors are incorrectly assigned if IPs start with same substring (e.g. 192.168.0.1 and 192.168.0.101).
Replace line 494 with
if($Line.TrimStart().StartsWith($IPv4Address.IPAddressToString + " "))
and $MAC of 192.168.0.1 will not get assigned again by 192.168.0.101.

Or use Get-NetNeighbor cmdlet to resolve MAC from IP (presumably slower for this implementation).

Memory Leak - RunspacePool don't release resources

Memory Leak when scanning. RunspacePool don't release resources properly.

Exception calling "EndInvoke" with "1" argument(s): "Exception of type 'System.OutOfMemoryException' was thrown." At C:\tools\ScanNetworkAsync.ps1:311 char:9 + $Jop_Results += $Job.Pipe.EndInvoke($Job.Result) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : OutOfMemoryException

truncated IP results

When I run the script, some IP are truncated like that : " 172.16.100... "

IP should be shown as 172.16.100.100

This occurs when I scan this range : 172.16.20.1 - 172.16.254.0 OR 172.16.99.1 - 172.16.101.1
But didn't occurs with this range : 172.16.99.99 - 172.16.101.1

Cannot index into a null Array Error

I'm getting this error for Apple Airport Extreme Router.

Cannot index into a null array.
At
C:\Users\admin\Desktop\PowerShell_AsyncIPv4Scanner-master\PowerShell_AsyncIPv4Scanner-master\Scripts\New-IPv4Scan.ps1:399
char:17

  • ... $Vendor = (($MAC_VendorList | Where-Object {$_.Assignment ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : NullArray

EnableMACResolving

When using the "-EnableMACResolving" function, the above information was not detected. The IP and hostname were detected correctly, but nothing more.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.