cultrix / nmap
PHP 对 Nmap 的封装,Nmap 是一款用于网络探索的免费安全扫描器。
Requires
- php: >=7.1
- symfony/process: >=4.1
Requires (Dev)
- phpunit/phpunit: ~3.7
This package is auto-updated.
Last update: 2024-09-30 01:36:22 UTC
README
A PHP wrapper for Nmap, a free security scanner for network exploration. Forked from the original script by William Durrand (https://github.com/willdurand/nmap); updated to work with the latest version of Symfony and will be expanded to take advantage of all Nmap features in time.
使用方法
use Nmap\Nmap;
$hosts = Nmap::create()->scan([ 'scanme.nmap.org' ]); $ports = $hosts->getOpenPorts();
You can specify the ports you want to scan
$nmap = new Nmap(); $nmap->scan([ 'scanme.nmap.org' ], [ 21, 22, 80 ]);
OS detection and Service Info are disabled by default, if you want to enable them, use the enableOsDetection()
and/or enableServiceInfo()
methods
$nmap ->enableOsDetection() ->scan([ 'scanme.nmap.org' ]); $nmap ->enableServiceInfo() ->scan([ 'scanme.nmap.org' ]); // Fluent interface! $nmap ->enableOsDetection() ->enableServiceInfo() ->scan([ 'scanme.nmap.org' ]);
Turn on the verbose mode by using the enableVerbose()
method
$nmap ->enableVerbose() ->scan([ 'scanme.nmap.org' ]);
For some reasons, you might want to disable port scan, that is why nmap provides a disablePortScan()
method
$nmap ->disablePortScan() ->scan([ 'scanme.nmap.org' ]);
You can also disable the reverse DNS resolution with disableReverseDNS()
$nmap ->disableReverseDNS() ->scan([ 'scanme.nmap.org' ]);
You can define the process timeout (default to 60 seconds) with setTimeout()
$nmap ->setTimeout(120) ->scan([ 'scanme.nmap.org' ]);
安装
The recommended way to install nmap is through Composer
{ "require": { "cultrix/nmap": "@master" } }
Or
composer require cultrix/nmap
许可证
nmap 发布于 MIT 许可证下。有关详细信息,请参阅附带 LICENSE 文件。