Index: html/includes/print/arptable.inc.php =================================================================== --- html/includes/print/arptable.inc.php (revision 6082) +++ html/includes/print/arptable.inc.php (working copy) @@ -119,7 +119,7 @@ if ($arp_host['port_id'] == $entry['port_id']) { $arp_if = 'Self Port'; } $string .= ' ' . PHP_EOL; - $string .= ' ' . format_mac($entry['mac_address']) . '' . PHP_EOL; + $string .= ' ' . format_mac($entry['mac_address']) . '' . PHP_EOL; $string .= ' ' . $ip_address . '' . PHP_EOL; if ($list['device']) { Index: html/includes/print/fdbtable.inc.php =================================================================== --- html/includes/print/fdbtable.inc.php (revision 6082) +++ html/includes/print/fdbtable.inc.php (working copy) @@ -104,7 +104,7 @@ humanize_port($entry); $string .= ' ' . PHP_EOL; - $string .= ' ' . format_mac($entry['mac_address']) . '' . PHP_EOL; + $string .= ' ' . format_mac($entry['mac_address']) . '' . PHP_EOL; if ($list['device']) { $dev = device_by_id_cache($entry['device_id']); Index: html/includes/print/mac_addresses.inc.php =================================================================== --- html/includes/print/mac_addresses.inc.php (revision 6082) +++ html/includes/print/mac_addresses.inc.php (working copy) @@ -104,7 +104,7 @@ $port_error = generate_port_link($entry, 'Errors', 'port_errors'); } $string .= ' ' . generate_port_link($entry, short_ifname($entry['label'])) . ' ' . $port_error . '' . PHP_EOL; - $string .= ' ' . $entry['human_mac'] . '' . PHP_EOL; + $string .= ' ' . $entry['human_mac'] . '' . PHP_EOL; $string .= ' ' . $entry['ifAlias'] . '' . PHP_EOL; $string .= ' ' . PHP_EOL; } Index: html/netcmd.php =================================================================== --- html/netcmd.php (revision 6082) +++ html/netcmd.php (working copy) @@ -36,6 +36,7 @@ { $host = $_GET['query']; $ip = ''; + $mac = ''; if (Net_IPv4::validateIP($host)) { $ip = $host; @@ -46,6 +47,10 @@ $ip = $host; $ip_version = 6; } + elseif (preg_match('/^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$/', $host)) // FIXME better way? + { + $mac = $host; + } else { $ip = gethostbyname($host); @@ -60,7 +65,7 @@ } } } - if ($ip) + if ($ip || $mac) { switch ($_GET['cmd']) { @@ -84,6 +89,19 @@ $cmd = $config['nmap'] . " $ip"; } break; + case 'mac': + $url = 'http://api.macvendors.com/' . urlencode($mac); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + $response = curl_exec($ch); + if ($response) + { + $output = 'Vendor: ' . $response; + } else { + $output = 'Not Found'; + } + break; } if (!empty($cmd)) @@ -96,4 +114,4 @@ $output = trim($output); echo("
$output
"); -?> +// EOF