willdurand / nmap
此包已被弃用且不再维护。未建议替代包。
nmap 是 Nmap 的 PHP 封装,Nmap 是一种用于网络探索的免费安全扫描器。
0.5.0
2017-05-17 19:24 UTC
Requires
- php: >=5.3.0
- symfony/process: ~2.0|~3.0
Requires (Dev)
- phpunit/phpunit: ~3.7
README
nmap 是 Nmap 的 PHP 封装,Nmap 是一种用于网络探索的免费安全扫描器。
用法
use Nmap\Nmap;
$hosts = Nmap::create()->scan([ 'williamdurand.fr' ]); $ports = $hosts->getOpenPorts();
您可以指定要扫描的端口
$nmap = new Nmap(); $nmap->scan([ 'williamdurand.fr' ], [ 21, 22, 80 ]);
操作系统检测 和 服务信息 默认禁用,如果您想启用它们,请使用 enableOsDetection()
和/或 enableServiceInfo()
方法
$nmap ->enableOsDetection() ->scan([ 'williamdurand.fr' ]); $nmap ->enableServiceInfo() ->scan([ 'williamdurand.fr' ]); // Fluent interface! $nmap ->enableOsDetection() ->enableServiceInfo() ->scan([ 'williamdurand.fr' ]);
通过使用 enableVerbose()
方法开启 详细模式
$nmap ->enableVerbose() ->scan([ 'williamdurand.fr' ]);
由于某些原因,您可能想要禁用端口扫描,这就是为什么 nmap 提供了 disablePortScan()
方法
$nmap ->disablePortScan() ->scan([ 'williamdurand.fr' ]);
您也可以通过 disableReverseDNS()
禁用反向 DNS 解析
$nmap ->disableReverseDNS() ->scan([ 'williamdurand.fr' ]);
您可以使用 setTimeout()
定义进程超时时间(默认为 60 秒)
$nmap ->setTimeout(120) ->scan([ 'williamdurand.fr' ]);
安装
推荐通过 Composer 安装 nmap
{ "require": { "willdurand/nmap": "@stable" } }
或者
composer require willdurand/nmap
技巧:您应该浏览 willdurand/nmap
页面以选择要使用的稳定版本,避免使用 @stable
元数据约束。
许可协议
nmap 采用 MIT 许可协议发布。有关详细信息,请参阅捆绑的 LICENSE 文件。