herzcthu/laravel-nmap

nmap wrapper for laravel 5.2

v0.1.0 2016-05-21 16:36 UTC

This package is not auto-updated.

Last update: 2024-06-05 23:53:26 UTC


README

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 more for nmap help)

$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);

Other options

Other options supported are setTimeout($seconds) and setEnv($name, $value).

If you want to increase default process timeout, use setTimeout().

Example:

$nmap->setTimeout('300');

If you want to set environment variable when running process, use setEnv($name, $value);