LaravelNmap
Nmap wrapper for laravel., (*1)
Not all nmap arguments supported. All arguments method can use method chaining.
But try to use correct combination according to nmap usage., (*2)
See below for supported arguments., (*3)
--help, (*4)
$help = new LaravelNmap();
$help->NmapHelp();
-v (Verbose), (*5)
$nmap = new LaravelNmap();
$nmap->verbose();
-O (Detect OS), (*6)
$nmap->detectOS();
-sV (Detect Services), (*7)
$nmap->getServices();
-sn (Disable port scan - same with -sP)
This method cannot be use with other scan type. See nmap help for more information., (*8)
$nmap->disablePortScan();
-p [ports] (select port scan - see more for nmap help), (*9)
$nmap->scanPorts('22,80,443');
*** target *** (This method is mandatory for all scan type), (*10)
$nmap->setTarget('192.168.43.0/24');
Output
There are 3 types of output.
- Nmap raw output for stdout.
- SimpleXML object
- Array, (*11)
$nmap->getRawOutput();
$nmap->getXmlObject();
$nmap->getArray();
Security
This package allow to use root permission if php user is in sudo group. Highly discourage if you don't know security risks regarding nmap., (*12)
Below code will enable sudo permission -, (*13)
$nmap = new LaravelNmap(true);
Other options
Other options supported are setTimeout($seconds) and setEnv($name, $value)., (*14)
If you want to increase default process timeout, use setTimeout()., (*15)
Example:, (*16)
$nmap->setTimeout('300');
If you want to set environment variable when running process, use setEnv($name, $value);, (*17)