A CLI tool to lookup the Organization (OUI) of MAC addresses, from file or stdin, and/or transform between different MAC address formats.
Project description
MAC Address Lookup and Transformation
This command line application allows you to lookup the Organizationally Unique Identifier (OUI) of MAC addresses, either from a file or from standard input (stdin). Additionally, it provides functionality to transform MAC addresses between different formats.
Introduction
The MAC Address Lookup and Transformation (macloot
) tool provides a convenient way to retrieve the Organizationally Unique Identifier (OUI) associated with a MAC address. It utilizes the IEEE OUI database to perform the lookup and offers options to process MAC addresses from a file or interactively through stdin.
Supported formats
The macloot
application is designed to effortlessly identify MAC addresses within any text input and parse them. Whether you have a large document, log files, or even user-provided input, the application intelligently scans the text to extract MAC addresses. This capability ensures that you can easily work with MAC addresses regardless of their context, simplifying the process of retrieving and manipulating these unique identifiers.
macloot
accurately matches the most commonly used MAC addresses:
11:22:33:AA:BB:CC
11-22-33-AA-BB-CC
aa:bb:cc:dd:ee:ff
aa-bb-cc-dd-ee-ff
aaaa.bbbb.cccc
AAAA.BBBB.CCCC
112233AABBCC
aabbccddeeff
Installation
Installing macloot
is a breeze. Simply use the following command to install it via pip
:
pip install macloot
No sudo
is required for installing the application as it will be installed in your home directory.
The application does not include the OUI database by default but retrieves it from a trusted source (https://standards-oui.ieee.org/oui/oui.csv). Upon first run, it prompts you to download the latest version for up-to-date MAC address lookups. You have full control over initiating the download, ensuring data source approval.
Basic Usage
To use the MAC Address Lookup and Transformation application, follow these steps:
- Run the script with a MAC address file as input:
macloot path/to/mac_addresses.txt
- Alternatively, provide MAC addresses through stdin:
macloot 00:11:22:33:44:55
- Why not pipe (
|
) the output ififconfig
into the application:
ifconfig | macloot
- Save the results from
arp -a
into a CSV filearp.csv
using;
as a delimiting character:
arp -a | macloot -o arp.csv -d ";"
The application will display the organization name associated with each MAC address found in the input.
Advanced Usage
The MAC Address Lookup and Transformation application offers additional features and options:
Format Transformation
To transform MAC addresses between formats, use the -O
or --octet-separator
argument followed by a hyphen -
, a colon :
or a dot .
as the format specifier. This allows for convenient and quick conversion of MAC address formats.
Cisco style (using -O .
)
To convert MAC addresses to Cisco's aaaa.bbbb.cccc
format, use the following command:
macloot 24:16:1b:2c:3d:4e -O .
Output:
2416.1b2c.3d4e Cisco Systems, Inc
Microsoft style (using -O -
)
To convert MAC addresses to Microsoft's AA-BB-CC-DD-EE-FF
format, use the following command:
macloot 1c1a.dfa1.b2c3 -O - -u
Output:
1C-1A-DF-A1-B2-C3 Microsoft Corporation
Linux style (using -O :
)
To convert MAC addresses to Linux's aa:bb:cc:dd:ee:ff
format, use the following command:
macloot 2c-c8-1b-a1-b2-c3 -O :
Output:
2c:c8:1b:a1:b2:c3 Routerboard.com
Character Casing
To modify the character casing of MAC addresses in the output, you can utilize the -l
or --lower-case
and -u
or --upper-case
arguments. Using -l
will convert the output MAC addresses to lowercase, while -u
will convert them to uppercase.
If neither of these arguments is provided, the original casing of the input MAC addresses will be preserved in the output.
Uppercase
In this example we convert a MAC address in Cisco format to the format Microsoft uses (with hyphens, in uppercase) by using the -u
argument:
macloot 1c1a.dfa1.b2c3 -O - -u
Output:
1C-1A-DF-A1-B2-C3 Microsoft Corporation
Lowercase
In this example we do the opposite, convert a MAC address in Microsoft format to the format Cisco uses (with dots, in lowercase) by using the -l
argument:
macloot 24:16:1B:2C:3D:4E -O . -l
Output:
2416.1b2c.3d4e Cisco Systems, Inc
Search
To search for OUIs based on company names, you can utilize the -s
or --search
argument. By providing the desired company name as the argument value, such as "Cisco," "Apple," or "Microsoft," you can retrieve the corresponding OUIs associated with those companies. This feature enables easy lookup and identification of OUIs based on the names of specific organizations.
macloot -s microsoft
Output:
70F8AE Microsoft Corporation
201642 Microsoft Corporation
C461C7 Microsoft Corporation
D8E2DF Microsoft Corporation
A085FC Microsoft Corporation
... (output truncated) ...
To make the output compatible with CSV format, you can use the -d ";"
option here as well.
Update OUI database
You can easily update the OUI database at any time by running the command:
macloot --update-db
This command initiates the process of fetching the latest version of the OUI database, ensuring that you have the most recent information for accurate MAC address lookups. By offering a simple command to update the database, the application enables you to stay current with the evolving OUI data without any hassle.
Contributing
Contributions are welcome! If you encounter any issues or have suggestions for improvements, please submit a GitHub issue or a pull request.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file macloot-1.0.0.tar.gz
.
File metadata
- Download URL: macloot-1.0.0.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 303812680908cb7afa6cc985b39307421fd55e7652066a4f1ce49c8a61f14f28 |
|
MD5 | f4cdd23d59f5b56e843dc5c2423cadf3 |
|
BLAKE2b-256 | f7ea1cec93868f534ad7aca0e4d5a7c6802c3f9ee1d745650d1a760add7ff970 |
File details
Details for the file macloot-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: macloot-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca7560a233af3ad7fdaff18bf9c72f7d884228f63a8e680c77eec671fc7ac958 |
|
MD5 | 0ddf5511d70dba808c8b50c43c7d5f5c |
|
BLAKE2b-256 | 16e24a26a2e7b331c9e64957024cc63bf85c972fd856fb06a532970e5d342dfb |