herzcthu / LaravelNmap by herzcthu

nmap wrapper for laravel 5.2
290
9
2
Package Data
Maintainer Username: herzcthu
Maintainer Contact: sithu@thwin.net (Sithu Thwin)
Package Create Date: 2016-05-21
Package Last Update: 2020-08-25
Language: PHP
License: MIT
Last Refreshed: 2025-02-06 15:00:40
Package Statistics
Total Downloads: 290
Monthly Downloads: 1
Daily Downloads: 0
Total Stars: 9
Total Watchers: 2
Total Forks: 4
Total Open Issues: 2

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