palepurple/nmap
最新稳定版本:4.0.3
Composer 安装命令:
composer require palepurple/nmap
包简介
nmap is a PHP wrapper for Nmap, a free security scanner for network exploration. This is (mostly) a fork of willdurand/nmap with PHP 7 and vimeo/psalm static analysis improvements.
README 文档
README
This project is maintained fork of the original project: https://github.com/willdurand/nmap
Nmap
Nmap is a PHP wrapper for Nmap, a free security scanner for network exploration.
Starting a scan
$hosts = Nmap::create()->scan([ 'example.com' ]); $ports = $hosts[0]->getOpenPorts();
You can specify the ports you want to scan:
$nmap = new Nmap(); $nmap->scan([ 'example.com' ], [ 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([ 'example.com' ]); $nmap ->enableServiceInfo() ->scan([ 'example.com' ]); // Fluent interface! $nmap ->enableOsDetection() ->enableServiceInfo() ->scan([ 'example.com' ]);
Turn the verbose mode by using the enableVerbose() method:
$nmap ->enableVerbose() ->scan([ 'example.com' ]);
For some reasons, you might want to disable port scan, that is why nmap
provides a disablePortScan() method:
$nmap ->disablePortScan() ->scan([ 'example.com' ]);
You can also disable the reverse DNS resolution with disableReverseDNS():
$nmap ->disableReverseDNS() ->scan([ 'example.com' ]);
You can define the process timeout (default to 60 seconds) with setTimeout():
$nmap ->setTimeout(120) ->scan([ 'example.com' ]);
You can run specific scripts with setScripts() and get the result with getScripts():
$hosts = $nmap ->setTimeout(120) ->scan([ 'example.com' ], [ 443 ]); $hosts[0]->setScripts(['ssl-heartbleed']); $ports = $hosts[0]->getOpenPorts(); $ports[0]->getScripts();
Nmap XML output
Parse existing output:
Nmap::parseOutput($xmlFile);
or
$parser = new XmlOutputParser($xmlFile); $parser->parse();
Validation output file using the Nmap DTD. A custom DTD path can be passed to the validate function.
$parser = new XmlOutputParser($xmlFile); $parser->validate();
Installation
The recommended way to install nmap is through Composer:
For PHP 8.0 and above -
{
"require": {
"palepurple/nmap": "^3.0"
}
}
For older versions of PHP, try ^2.0; see also https://github.com/DavidGoodwin/nmap/releases/tag/2.0.1
License
nmap is released under the MIT License. See the bundled LICENSE file for details.
统计信息
- 总下载量: 3.11k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-04-03