repat/willdurand-nmap

nmap 是 Nmap 的 PHP 封装,Nmap 是一款用于网络探索的免费安全扫描器。已更新以支持 PHP 7.1

维护者

详细信息

github.com/repat/nmap

源代码

0.9 2020-05-04 15:34 UTC

This package is auto-updated.

Last update: 2024-09-05 01:24:44 UTC


README

nmapNmap 的 PHP 封装,Nmap 是一款用于网络探索的免费安全扫描器。

Build Status

更新版本支持 symfony/process: ~4.0 | ~5.0 和 PHP 7.1+

使用方法

$hosts = Nmap::create()->scan([ 'williamdurand.fr' ]);

$ports = $hosts->getOpenPorts();

您可以指定要扫描的端口

$nmap = new Nmap();

$nmap->scan([ 'williamdurand.fr' ], [ 21, 22, 80 ]);

默认情况下,OS 检测服务信息 是禁用的,如果您想启用它们,请使用 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' ]);

版本

0.9

安装

安装 nmap 的推荐方法是使用 Composer

{
    "require": {
        "repat/willdurand-nmap": "^0.8"
    }
}

或者

composer require repat/willdurand-nmap

许可证

nmap 在 MIT 许可下发布。有关详细信息,请参阅捆绑的 LICENSE 文件。