Looks up the OUI information in the cached OUI information (see load_cache). The normalize_mac() function explains the possible formats for MAC. Pass it the result of normalize_mac() and you should be fine. Looks up the OUI information on the IEEE website.
Looks up the OUI information from the specified URL or the URL set in the NET_MAC_VENDOR_OUI_SOURCE environment variable. This distribution comes with several versions of the complete OUI data file. This can take a long time over a slow network, though the file is about 60,000 lines.Īlso, the IEEE website has been flaky lately, so loading the cache is better. To avoid multiple calls on the network, use load_cache to preload the entire OUI space into an in-memory cache. Looks up the OUI information on the IEEE website, or uses a cached version of it. The input string can also be a blessed NetAddr::MAC object. We only need the first three bytes 00:0d:93:29:f6:c2 # usual form They can omit leading 0's (which might make things look odd). The input string can be a separated by colons or hyphens. Takes a MAC address and turns it into the form I need to send to the IEEE lookup, which is the first six bytes in hex separated by hyphens. This makes a direct request to the IEEE website for that OUI to return the information for that vendor. Different records may have different numbers of lines, although the first two should be consistent. The first element is the vendor name, and the remaining elements are the address lines. Given the MAC address, return an anonymous array with the vendor information. Return the Mojo::UserAgent object used to fetch resources. If the cache is fully loaded (perhaps using load_cache), it may not even use the network at all. This method does try to use a cache of OUI to cut down on the times it has to access the network. I can pass it a list of MAC addresses and run() processes each one of them. It takes the MAC addresses and prints the registered vendor information for each address. If I call this module as a script, this class method automatically runs. The module can read and decompress compressed versions (as long as the url reflects the compression type in the filename as the linuxnet.ca links do). These files are large (about 4MB), so you might want to cache a copy.Ī different source of information is linuxnet.ca that publishes sanitized and compressed versions of the list, such as: There are older copies of the OUI file in the GitHub repository.
Here are some of the old URLs, which also flip-flop schemes: If they do that again, you can set the NET_MAC_VENDOR_OUI_URL environment variable to get the new URL without updating the code. The IEEE moves the location of its OUI file. You can use this as a module as its individual functions, or call it as a script with a list of MAC addresses as arguments. With vendor information, you can often guess at what what you are looking at ( e.g. You can, for instance, scan a network, collect MAC addresses, and turn those addresses into vendors. This module allows you to take a MAC address and turn it into the OUI and vendor information.
Each interface has a Media Access Control (MAC) address of six bytes. The Institute of Electrical and Electronics Engineers (IEEE) assigns an Organizational Unique Identifier (OUI) to manufacturers of network interfaces. The module realizes it is a script, looks up the information for each MAC, and outputs it. You can also run this as a script with as many arguments as you like. My $array = Net::MAC::Vendor::lookup( $mac ) Version 1.268 SYNOPSIS use Net::MAC::Vendor Net::MAC::Vendor - Look up the vendor for a MAC VERSION