\MacAddress

This class allows you to preform various operations with Media Access Control (MAC addresses) on UNIX type systems.

Summary

Methods
Properties
Constants
setFakeMacAddress()
generateMacAddress()
validateMacAddress()
getCurrentMacAddress()
No public properties found
No constants found
runCommand()
No protected properties found
N/A
No private methods found
$valid_mac
$mac_address_vals
N/A

Properties

$valid_mac

$valid_mac : string

Regular expression for matching and validating a MAC address

Type

string

$mac_address_vals

$mac_address_vals : array

An array of valid MAC address characters

Type

array

Methods

setFakeMacAddress()

setFakeMacAddress(string  $interface, string  $mac = null) : boolean

Change the MAC address of the network interface specified

Parameters

string $interface

Name of the interface e.g. eth0

string $mac

The new MAC address to be set to the interface

Returns

boolean —

Returns true on success else returns false

generateMacAddress()

generateMacAddress() : string

Returns

string —

generated MAC address

validateMacAddress()

validateMacAddress(string  $mac) : boolean

Make sure the provided MAC address is in the correct format

Parameters

string $mac

Returns

boolean —

true if valid; otherwise false

getCurrentMacAddress()

getCurrentMacAddress(string  $interface) : string|boolean

Get the system's current MAC address

Parameters

string $interface

The name of the interface e.g. eth0

Returns

string|boolean —

Systems current MAC address; otherwise false on error

runCommand()

runCommand(string  $command) : string

Run the specified command and return it's output

Parameters

string $command

Returns

string —

Output from command that was ran