Home > Code > OUI (MAC address) lookup script

OUI (MAC address) lookup script

Every networking device contains a MAC address, in general these MAC addresses should be unique for each networking device (not taking into account spoofing at this moment). Each of these MAC addresses contains a OUI (Organizationally_Unique_Identifier) and each OUI that is used should refer to the company making the networking device.

MAC and OUI

While there are various places where you can lookup OUIs I couldn’t find an easy command line tool for this. So, to enable easier lookups of these OUIs I wrote a small Perl script, the script is made to be used on a BackTrack 4 installation, however it should work on other systems as well.

The script uses the OUI file which comes with the aircrack-ng suite. On BackTrack 4 this file is located at /usr/local/etc/aircrack-ng/airodump-ng-oui.txt, this variable ($ouifile) can be adjusted in the beginning of the script.

The script:

To have easier access to the script, you can install the script to the bin directory by the following two commands (as root or sudo):

Some example outputs of the script:

To update the aircrack-ng OUI file you can run the command “airodump-ng-oui-update”

Any feedback on this script is much appreciated, the script can be used and adjusted by anyone, as long as a reference to this site (Thice.nl) is included.

I hereby would like to thank user Gitsnik of the BackTrack Forums for providing me feedback and some improvements to my code.

  1. July 3rd, 2010 at 22:20 | #1

    Hey, I have been surfin around looking at wireless stuff, as I am taking my OSWP in less than 1 hour from now, and saw this on twitter. I have made one of these before, that pulled the data from the ieee site for OUI, which took a long time. I found that if I saved the file locally (which airodump-ng-oui-update does now) then called “cat” from Perl it’s actually faster than what Perl uses to read the file. Simply slurp the lines into an array and call foreach on the array, you see it’s much faster as cat is coded in C with no top level interpreter. Rather than do “open FLE || die; while () { stuff.. }” try this:
    my @lines = cat /usr/local/etc/aircrack-ng/airodump-ng-oui.txt;
    foreach (@lines) { stuff… }

    :) Congrats on your OSWP!

  2. admin
    July 9th, 2010 at 16:24 | #2

    @trevelyn
    Thank you, I saw you made the OSWP exam as well, congrats to you too!

    While a cat might be faster I personally rather don’t use shell commands like that in this Perl script. And my script is quite fast already, there is no waiting for the answer, it comes up right away.

  3. The Dude
    August 22nd, 2010 at 01:27 | #3

    Hey, a perl script from a guy that said that perl is for old men?
    Anyway, nice, Thice :)

  4. Thice
    August 23rd, 2010 at 13:01 | #4

    @The Dude
    I never said Perl was for old men, Perl is for lazy men :P

  1. No trackbacks yet.