Simon PainterSomewhere to keep things

Bulk MAC address lookup

I had a list of MAC addresses and was trying to identify them by finding out as much as I could about them. This was so I could document what devices I had found on which switchports in a datacenter.

After looking them up in a router ARP table and doing a reverse DNS lookup on them I figured I’d try finding out the manufacturer to help me fill in the blanks where there was no hostname. I currently have to use Windows at work and we have a an authenticated corporate proxy.
This little powershell script takes a CSV file with a column header “MACaddress” and does a lookup against the API. It uses your default proxy and your default proxy credentials.

$proxy = [System.Net.WebRequest]::GetSystemWebProxy().GetProxy("")

$file = import-csv "ss.csv"
foreach ($line in $file) {
	$mac = ""
	$uri = ""
	$mac = $line.MACaddress
	$uri = ""+$mac

$manufacturer = Invoke-RestMethod -uri $uri -proxy $proxy -ProxyUseDefaultCredentials
	$output = $mac+","+$manufacturer
	echo $output

If you want to do the reverse DNS lookups that I did after you’ve extracted the IP from the ARP table then just use this little function in a script.

Function Get-DnsEntry($iphost)
 If($ipHost -match "^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$")
 ElseIf( $ipHost -match "^.*\.\.*")
 ELSE { Throw "Specify either an IP V4 address or a hostname" }
} #end Get-DnsEntry

Comments are currently closed.