blake-gardner / mac-address
该软件包已被放弃,不再维护。未建议替代软件包。
获取、验证和生成MAC地址。
2.2.0
2022-01-03 20:07 UTC
Requires
- php: >=5.3.2
Requires (Dev)
- squizlabs/php_codesniffer: dev-phpcs-fixer
This package is auto-updated.
Last update: 2024-08-29 03:52:46 UTC
README
这是一个在Unix、Linux和Mac OS X操作系统上操作MAC地址的PHP类。它主要编写用于无线安全审计的欺骗。
功能
- 验证您是否从命令行执行它
- 验证您是否以管理员身份运行脚本
- 生成新的随机MAC地址
- 验证MAC地址
- 获取当前系统的MAC地址
- 设置或“欺骗”任何您想要的MAC地址
用法
// require the class require_once './src/BlakeGardner/MacAddress.php'; // import the class use BlakeGardner\MacAddress; // get the mac address of the eth0 interface var_dump(MacAddress::getCurrentMacAddress('eth0')); // generate a random mac address var_dump(MacAddress::generateMacAddress()); // validate an MAC address var_dump(MacAddress::validateMacAddress('00-B0-D0-86-BB-F7')); // set a randomly generated MAC address on the eth0 interface var_dump(MacAddress::setFakeMacAddress('eth0')); // set a specific MAC address on the eth0 interface var_dump(MacAddress::setFakeMacAddress('eth0', '00:E4:01:2C:79:DA')); // get the mac address of the eth0 interface using the ifconfig path that we define var_dump(MacAddress::getCurrentMacAddress('eth0', '/usr/local/sbin/ifconfig')); echo "\n";
有关更多信息,请参阅example.php文件。您可以在命令行上以root身份运行示例。 php example.php
计划中的功能
- 列出系统上的所有接口
- 操作系统检测
- 在命令行上抑制错误