kapilsangoma / mac-address
由 blake-gardner/mac-address 分支而来。获取、验证和生成 MAC 地址。
v3.1
2022-01-03 07:32 UTC
Requires
- php: >=5.3.2
Requires (Dev)
- squizlabs/php_codesniffer: dev-phpcs-fixer
This package is auto-updated.
Last update: 2024-09-29 06:03:13 UTC
README
这是一个基于 Unix、Linux 和 Mac OS X 操作系统的 PHP 类,用于操作 MAC 地址。它主要编写用于无线安全审计中的欺骗。
功能
- 验证您是否在命令行中执行
- 验证您是否以管理员身份运行脚本
- 生成新的随机 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
计划中的功能
- 列出系统上的所有接口
- 操作系统检测
- 在命令行上抑制错误