Skip to content

Create-OUIListFromWeb.ps1 optimization #9

@scriptingstudio

Description

@scriptingstudio

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

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