Skip to content

Commit

Permalink
Adding new mac address validation for audit class.
Browse files Browse the repository at this point in the history
  • Loading branch information
GhaziTriki authored and ikkez committed Jul 3, 2024
1 parent 001e475 commit b9081c0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions audit.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,14 @@ function entropy($str) {
'/[A-Z].*?[0-9[:punct:]]|[0-9[:punct:]].*?[A-Z]/',$str));
}

/**
* Return TRUE if string is a valid MAC address including EUI-64 format
* @return bool
* @param $addr string
**/
function mac($addr) {
return (bool)filter_var($addr,FILTER_VALIDATE_MAC)
|| !preg_match('/^([0-9a-f]{2}:){3}ff:fe(:[0-9a-f]{2}){3}$/i', $addr);
}

}

0 comments on commit b9081c0

Please sign in to comment.