Tools to Work with Media Access Control (‘MAC’) Addresses
A media access control address (MAC address) of a device is a unique identifier assigned to a network interface controller (NIC) for communications at the data link layer of a network segment. MAC addresses are used as a network address for most IEEE 802 network technologies, including Ethernet and Wi-Fi. In this context, MAC addresses are used in the medium access control protocol sublayer. Tools are provided to work with these ‘MAC’ addresses.
The following functions are implemented:
as_raw_mac
: Convert a charactrer vector of MAC addresses to a ‘list’ of ‘raw’ vectors.canonicalize_mac
: Converts a character vector of MAC addresses into canonical formis_canonical_mac
: Test if MAC address strings are in canonical formmac_match_age
: Lookup ages of MAC addressesmac_match_registry
: Lookup registry metadata of MAC addressesmac_to_binary_string
: Convert MAC address character vector to a binary string representationrebuild_search_tries
: Rebuild in-memory search triesupdate_mac_age_db
: Update MAC Address Age Databaseupdate_registry_data
: Update registry dataThe following datasets are included:
mac_age_db
: MAC Age Databasemac_registry_data
: MAC Registry Datalibrary(MACtools)
library(tidyverse)
# current verison
packageVersion("MACtools")
## [1] '0.1.0'
c(
"2e:ab:a4:38:20:69", "70:26:5:19:23:25", "b8:e8:56:35:36:4",
"f4:f5:d8:df:67:44", "44:d9:e7:7a:9e:25", "f4:f5:d8:a7:94:66",
"a4:77:33:f2:50:30", "0:3e:e1:c3:9d:7a", "f0:23:b9:eb:42:4",
"c8:69:cd:28:5a:7d", "d4:85:64:74:49:de", "3c:7:54:52:fe:11"
) -> macs
mac_match_age(macs)
## # A tibble: 13 x 5
## orig date source prefix mask
## <chr> <date> <chr> <chr> <chr>
## 1 2e:ab:a4:38:20:69 NA <NA> <NA> <NA>
## 2 70:26:5:19:23:25 NA <NA> <NA> <NA>
## 3 b8:e8:56:35:36:4 2013-06-25 deepmac.org b8e856000000 24
## 4 f4:f5:d8:df:67:44 2015-09-25 deepmac.org f4f5d8000000 24
## 5 44:d9:e7:7a:9e:25 2014-12-17 deepmac.org 44d9e7000000 24
## 6 f4:f5:d8:a7:94:66 2015-09-25 deepmac.org f4f5d8000000 24
## 7 a4:77:33:f2:50:30 2013-10-19 deepmac.org a47733000000 24
## 8 0:3e:e1:c3:9d:7a NA <NA> <NA> <NA>
## 9 f0:23:b9:eb:42:4 2017-02-15 deepmac.org f023b9000000 24
## 10 f0:23:b9:eb:42:4 2017-02-19 wireshark.org f023b9000000 28
## 11 c8:69:cd:28:5a:7d 2015-07-24 deepmac.org c869cd000000 24
## 12 d4:85:64:74:49:de 2010-06-16 deepmac.org d48564000000 24
## 13 3c:7:54:52:fe:11 NA <NA> <NA> <NA>
mac_match_registry(macs)
## # A tibble: 12 x 5
## orig registry assignment organization_name organization_address
## <chr> <chr> <chr> <chr> <chr>
## 1 2e:ab:a4:38:20:69 <NA> <NA> <NA> <NA>
## 2 70:26:5:19:23:25 <NA> <NA> <NA> <NA>
## 3 b8:e8:56:35:36:4 MA-L b8e856 Apple, Inc. 1 Infinite Loop Cupertino CA US 95014
## 4 f4:f5:d8:df:67:44 MA-L f4f5d8 Google, Inc. 1600 Amphitheatre Parkway Mountain View CA US 94043
## 5 44:d9:e7:7a:9e:25 MA-L 44d9e7 Ubiquiti Networks Inc. 2580 Orchard Parkway San Jose CA US 95131
## 6 f4:f5:d8:a7:94:66 MA-L f4f5d8 Google, Inc. 1600 Amphitheatre Parkway Mountain View CA US 94043
## 7 a4:77:33:f2:50:30 MA-L a47733 Google, Inc. 1600 Ampitheatre Parkway Mountain View US 94043
## 8 0:3e:e1:c3:9d:7a <NA> <NA> <NA> <NA>
## 9 f0:23:b9:eb:42:4 MA-M f023b9e Domotz Ltd 334 Ladbroke Grove London GB W10 5AD
## 10 c8:69:cd:28:5a:7d MA-L c869cd Apple, Inc. 1 Infinite Loop Cupertino CA US 95014
## 11 d4:85:64:74:49:de MA-L d48564 Hewlett Packard 11445 Compaq Center Drive Houston US 77070
## 12 3c:7:54:52:fe:11 <NA> <NA> <NA> <NA>
is_canonical_mac(macs)
## [1] TRUE FALSE FALSE TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE FALSE
canonicalize_mac(macs)
## [1] "2e:ab:a4:38:20:69" "70:26:05:19:23:25" "b8:e8:56:35:36:04" "f4:f5:d8:df:67:44" "44:d9:e7:7a:9e:25"
## [6] "f4:f5:d8:a7:94:66" "a4:77:33:f2:50:30" "00:3e:e1:c3:9d:7a" "f0:23:b9:eb:42:04" "c8:69:cd:28:5a:7d"
## [11] "d4:85:64:74:49:de" "3c:07:54:52:fe:11"
as_raw_mac(canonicalize_mac(macs))
## [[1]]
## [1] 2e ab a4 38 20 69
##
## [[2]]
## [1] 70 26 05 19 23 25
##
## [[3]]
## [1] b8 e8 56 35 36 04
##
## [[4]]
## [1] f4 f5 d8 df 67 44
##
## [[5]]
## [1] 44 d9 e7 7a 9e 25
##
## [[6]]
## [1] f4 f5 d8 a7 94 66
##
## [[7]]
## [1] a4 77 33 f2 50 30
##
## [[8]]
## [1] 00 3e e1 c3 9d 7a
##
## [[9]]
## [1] f0 23 b9 eb 42 04
##
## [[10]]
## [1] c8 69 cd 28 5a 7d
##
## [[11]]
## [1] d4 85 64 74 49 de
##
## [[12]]
## [1] 3c 07 54 52 fe 11