Skip to content
Sithu Thwin edited this page May 22, 2016 · 4 revisions

LaravelNmap

Nmap wrapper for laravel.

Not all nmap arguments supported. All arguments method can use method chaining. But try to use correct combination according to nmap usage.

See below for supported arguments.

--help

$help = new LaravelNmap();
$help->NmapHelp();

-v (Verbose)

$nmap = new LaravelNmap();
$nmap->verbose();

-O (Detect OS)

$nmap->detectOS();

-sV (Detect Services)

$nmap->getServices();

-sn (Disable port scan - same with -sP)

This method cannot be use with other scan type. See nmap help for more information.

$nmap->disablePortScan();

-p [ports] (select port scan - see nmap help for more infomation)

$nmap->scanPorts('22,80,443');

*** target *** (This method is mandatory for all scan type)

$nmap->setTarget('192.168.43.0/24');

Output

There are 3 types of output.

  • Nmap raw output for stdout.
  • SimpleXML object
  • Array
$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. Below code will enable sudo permission -

$nmap = new LaravelNmap(true);
Clone this wiki locally