How to resolve the algorithm MAC vendor lookup step by step in the UNIX Shell programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm MAC vendor lookup step by step in the UNIX Shell programming language

Table of Contents

Problem Statement

Every connected device around the world comes with a unique Media Access Control address, or a   MAC address. A common task a network administrator may come across is being able to identify a network device's manufacturer when given only a MAC address.

Interface with one (or numerous) APIs that exist on the internet and retrieve the device manufacturer based on a supplied MAC address. A MAC address that does not return a valid result should return the String "N/A".   An error related to the network connectivity or the API should return a null result. Many implementations on this page use http://api.macvendors.com/ which, as of 19th September 2021, is throttling requests. After only 2 calls, the following response is returned for all subsequent requests. If you are planning to use the same provider or going to run the examples on this page, consider building in a delay between two calls. {"errors":{"detail":"Too Many Requests","message":"Please slow down your requests or upgrade your plan at https://macvendors.com"}}

Let's start with the solution:

Step by Step solution about How to resolve the algorithm MAC vendor lookup step by step in the UNIX Shell programming language

Source code in the unix programming language

macList=(88:53:2E:67:07:BE D4:F4:6F:C9:EF:8D FC:FB:FB:01:FA:21
         4c:72:b9:56:fe:bc 00-14-22-01-23-45)

lookup() {
  curl -s "http://api.macvendors.com/$1" && echo
}

lookup "${macList[0${ZSH_VERSION:++1}]}"
for burger in "${macList[@]:1}"; do
  sleep 2
  lookup "$burger"
done


set -- 88:53:2E:67:07:BE D4:F4:6F:C9:EF:8D FC:FB:FB:01:FA:21 \
       4c:72:b9:56:fe:bc 00-14-22-01-23-45

lookup() {
  curl -s "http://api.macvendors.com/$1" && echo
}

lookup "$1"
shift
for burger; do
  sleep 2
  curl -s "http://api.macvendors.com/$burger" && echo
done


set macList=(88:53:2E:67:07:BE D4:F4:6F:C9:EF:8D FC:FB:FB:01:FA:21 \
             4c:72:b9:56:fe:bc 00-14-22-01-23-45)

alias lookup curl -s "http://api.macvendors.com/!":1 "&&" echo

lookup "$macList[1]"
foreach burger ($macList[2-]:q)
  sleep 2
  lookup "$burger"
end


  

You may also check:How to resolve the algorithm RPG attributes generator step by step in the Arturo programming language
You may also check:How to resolve the algorithm Loops/Downward for step by step in the zkl programming language
You may also check:How to resolve the algorithm Keyboard input/Obtain a Y or N response step by step in the VB-DOS programming language
You may also check:How to resolve the algorithm Integer comparison step by step in the Seed7 programming language
You may also check:How to resolve the algorithm Recaman's sequence step by step in the Forth programming language