Git Product home page Git Product logo

mac-address-tool's Introduction

MAC Address Lookup Tool

MAC Address Lookup Tool is a dockerized CLI tool written in Go. It can be used to lookup vendor information using a given MAC address. The tool makes request to https://macaddress.io/ using the provided arguments.

Obtaining an API key

Usage of this tool requires an API key. To obtain one, perform the following steps:

  1. Create an account at https://macaddress.io
  2. Once you are logged in, click your login name in the upper right hand corner of the webpage.
  3. Copy your API key

Installation

To install this tool, Docker must be installed on your local computer. Check here for steps on how to install docker.

Before completing the steps below make sure you have followed the instructions under Obtaining an API key

  1. (Optional) Store the following alias in your ~/bash_aliases file to avoid having to run the full docker run... command for each request: alias mlu='docker run --rm mac-address-tool -k=$mlkey'

Open a terminal to perform steps 2-4

  1. (Optional) To avoid having to constantly enter your API key for each request, it is convenient to set it as shell environment variable: export mlkey=<Your API key>

  2. Clone the repo and cd into the cloned directory

  3. Build the docker image: docker build -t mac-address-tool .

Note: If you close the terminal at any point, you will need to perform step 2 again to reset the variable.

Usage

The CLI tool accepts 3 arguments:

  1. -k=<Your API Key> (Required) Your personal API key.
  2. -a=<MAC address> (Required) MAC address or OUI. You can use any octet delimiters including ':', '.', or even no delimiter. At least 6 BASE16 chars should be provided.
  3. -f=<Output format> (Optional) Output format: There are 3 options for this argument
    • 'json' — Full MAC address information in JSON format.
    • 'xml' — Full MAC address information in XML format.
    • 'csv' — Full MAC address information in CSV format.
    • If argument is excluded, program will output vendor company name only, in text format.

If you performed steps 1 and 2 in the Installation section, you can query the MAC address database like so:

  • mlu -a=<MAC address> or mlu -a=<MAC address> -f=json

    • Example: mlu -a=44:38:39:ff:ef:57 or mlu -a=44:38:39:ff:ef:57 -f=json

If you did not perform steps 1 and 2 you will need to enter the full docker command and pass your API key as an argument:

  • docker run --rm mac-address-tool -k=<Your API key> -a=<MAC address> -f=<format>

    • Example: docker run --rm mac-address-tool -k=someAPIKey -a=44:38:39:ff:ef:57 -f=json

Check here for further explanation of arguments, errors codes, and output.

Security Note: There are inherent risk when choosing to store your API key in an environment variable, storing the variable in a temporary shell variable will mitigate the risk but will not eliminate it as the key can still be retrieved from shell logs

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.