MAC vendor lookup: Difference between revisions
Content added Content deleted
(→{{header|APL}}: Add implementation.) |
|||
Line 74: | Line 74: | ||
vendorLookup1 ← { (HttpCommand.Get 'http://api.macvendors.com/',⍕⍵).Data } |
vendorLookup1 ← { (HttpCommand.Get 'http://api.macvendors.com/',⍕⍵).Data } |
||
⍝ define a traditional function to look up all the MAC addresses |
⍝ define a traditional function to look up all the MAC addresses in a list with |
||
⍝ a delay between calls |
⍝ a delay between calls |
||
⍝ The header says that the function is named vendorLookup, it takes a single |
⍝ The header says that the function is named vendorLookup, it takes a single |
||
⍝ |
⍝ parameter which we call macList, and the value of the local variable |
||
⍝ |
⍝ vendors will become the function's return value |
||
∇ vendors ← vendorLookup macList |
∇ vendors ← vendorLookup macList |
||
⚫ | |||
⍝ look up the first vendor and put it into an array in our return var |
|||
⚫ | |||
⍝ Loop over the rest of the array (1↓ removes the first item) |
|||
:For burger :In 1↓macList |
:For burger :In 1↓macList |
||
⎕DL 2 |
⎕DL 2 ⍝ wait 2 seconds |
||
vendors ⍪← |
vendors ⍪← ⊆vendorLookup1 burger ⍝ then look up the next vendor and append to result |
||
:EndFor |
:EndFor |
||
⍝ end function definition</lang> |
|||
⚫ | |||
{{Out}} |
|||
<pre> macList ← '88:53:2E:67:07:BE' 'D4:F4:6F:C9:EF:8D' 'FC:FB:FB:01:FA:21' |
|||
macList ⍪← '4c:72:b9:56:fe:bc' '00-14-22-01-23-45' |
|||
vendorList ← vendorLookup macList |
|||
(⍴ vendorList)[1] 1⍴ vendorList |
|||
Intel Corporate |
|||
Apple, Inc. |
|||
Cisco Systems, Inc |
|||
PEGATRON CORPORATION |
|||
Dell Inc. |
|||
⚫ | |||
=={{header|AppleScript}}== |
=={{header|AppleScript}}== |