diff options
author | Colin Smith <colin@pfsense.org> | 2005-09-11 22:57:24 +0000 |
---|---|---|
committer | Colin Smith <colin@pfsense.org> | 2005-09-11 22:57:24 +0000 |
commit | 10de8a046aa8ac3a2b2fe1e26743861d635b50b4 (patch) | |
tree | 7b1fd47132ae87d339c7b558498a83b91bbf54ee | |
parent | a9cbef76993f933efb6564aa1b3f62b419261146 (diff) | |
download | pfsense-packages-10de8a046aa8ac3a2b2fe1e26743861d635b50b4.tar.gz pfsense-packages-10de8a046aa8ac3a2b2fe1e26743861d635b50b4.tar.bz2 pfsense-packages-10de8a046aa8ac3a2b2fe1e26743861d635b50b4.zip |
Pad MACs with leading zeros.
-rwxr-xr-x | packages/arpwatch_reports.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/arpwatch_reports.php b/packages/arpwatch_reports.php index b39fb9fb..1bdb5233 100755 --- a/packages/arpwatch_reports.php +++ b/packages/arpwatch_reports.php @@ -44,11 +44,15 @@ if(file_exists($logfile)) { $rawrep = file($logfile); foreach($rawrep as $line) { $todo = preg_split('/\s/', $line); + $rawmac = explode(":", trim($todo[0])); + foreach($rawmac as $set) $mac[] = str_pad($set, 2, "0", STR_PAD_LEFT); + $newmac = implode(":", $mac); $report[$todo[1]][] = array( - "mac" => trim($todo[0]), + "mac" => $newmac, "timestamp" => trim($todo[2]), "hostname" => trim($todo[3]) ? trim($todo[3]) : "Unknown" ); + unset($mac); } } $pgtitle = "arpwatch: Reports"; |