From 3541a582bb3c7955f59e540afa12a50482719534 Mon Sep 17 00:00:00 2001 From: tarik Date: Mon, 31 Jul 2023 20:16:52 -0700 Subject: [PATCH] =?UTF-8?q?fixing=20the=20mac/vendor=20database=20download?= =?UTF-8?q?=20from=20wireshark,=20updated=20file=20=E2=80=A6=20(#15175)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fixing the mac/vendor database download from wireshark, updated file location and format * fixing the formatting issues --- includes/functions.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 7662c757f6..5148668a39 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -1182,7 +1182,8 @@ function mac_oui_to_database() if ($lock->get()) { echo 'Storing Mac OUI in the database' . PHP_EOL; try { - $mac_oui_url = 'https://gitlab.com/wireshark/wireshark/-/raw/master/manuf'; + $mac_oui_url = 'https://www.wireshark.org/download/automated/data/manuf'; + //$mac_oui_url = 'https://gitlab.com/wireshark/wireshark/-/raw/master/manuf'; //$mac_oui_url_mirror = 'https://raw.githubusercontent.com/wireshark/wireshark/master/manuf'; echo ' -> Downloading ...' . PHP_EOL; @@ -1197,12 +1198,12 @@ function mac_oui_to_database() $length = strlen($entry[0]); $prefix = strtolower(str_replace(':', '', $entry[0])); - $vendor = $entry[2]; + $vendor = $entry[1]; - if (is_array($entry) && count($entry) >= 3 && $length == 8) { + if (is_array($entry) && count($entry) >= 2 && $length == 8) { // We have a standard OUI xx:xx:xx $oui = $prefix; - } elseif (is_array($entry) && count($entry) >= 3 && $length == 20) { + } elseif (is_array($entry) && count($entry) >= 2 && $length == 20) { // We have a smaller range (xx:xx:xx:X or xx:xx:xx:xx:X) if (substr($prefix, -2) == '28') { $oui = substr($prefix, 0, 7); @@ -1230,6 +1231,10 @@ function mac_oui_to_database() return 1; } + } else { + echo 'Not able to acquire lock, skipping mac database update' . PHP_EOL; + + return 1; } return 0;