Skip to content

Commit

Permalink
Updated macwatch to use https://www.macvendorlookup.com instead of ob…
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jan 2, 2025
1 parent a029d37 commit cd43fa9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions bin/macwatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ function my_autoloader($class_name) {

// Get MAC vendor ONLY if it's not already in the database, to save time
$vendor = macwatch::get_vendor($db,$switch_obj->get_id(),$ifname,$mac);
if(!$vendor){
$vendorjson = file_get_contents("http://macvendors.co/api/".$mac."/json");
if(!strlen($vendor)){
$vendorjson = file_get_contents("https://www.macvendorlookup.com/api/v2/" . $mac);
if($vendorjson !== false){
$vendor = json_decode($vendorjson);
if(!isset($vendor->result) || !isset($vendor->result->company)){
$vendor_decode = json_decode($vendorjson,true);
if(!isset($vendor_decode[0]) || !isset($vendor_decode[0]['company'])){
$vendor = "";
} else {
$vendor = $vendor->result->company;
$vendor = $vendor_decode[0]['company'];
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion conf/app.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Stores application variables
*/

define("VERSION","3.3");
define("VERSION","3.3.1");
define("WEBSITE_URL","https://github.com/IGBIllinois/netinfo");
?>

1 change: 1 addition & 0 deletions sql/netinfo-update-3.3.1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE macwatch modify COLUMN vendor VARCHAR(75) NOT NULL DEFAULT '';
2 changes: 1 addition & 1 deletion sql/netinfo.sql
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CREATE TABLE `macwatch` (
`switch` VARCHAR(255) NOT NULL,
`port` VARCHAR(30) DEFAULT NULL,
`mac` VARCHAR(12) NOT NULL,
`vendor` VARCHAR(50) NOT NULL,
`vendor` VARCHAR(75) NOT NULL,
`vlans` VARCHAR(128) DEFAULT NULL,
`date` TIMESTAMP(3) NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
Expand Down

0 comments on commit cd43fa9

Please sign in to comment.