cultrix / nmap
A PHP wrapper for Nmap, a free security scanner for network exploration.
Installs: 130
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 55
Open Issues: 0
pkg:composer/cultrix/nmap
Requires
- php: >=7.1
- symfony/process: >=4.1
Requires (Dev)
- phpunit/phpunit: ~3.7
This package is auto-updated.
Last update: 2025-12-29 03:40:18 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.
Usage
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' ]);
Installation
The recommended way to install nmap is through Composer:
{
"require": {
"cultrix/nmap": "@master"
}
}
Or:
composer require cultrix/nmap
License
nmap is released under the MIT License. See the bundled LICENSE file for details.