Net_Nmap
[ class tree: Net_Nmap ] [ index: Net_Nmap ] [ all elements ]

Class: Net_Nmap

Source Location: /Net_Nmap-1.0.5/Net/Nmap.php

Class Overview


Simple wrapper interface for the Nmap utility.


Author(s):

Copyright:

  • 2008 Luca Corbo

Methods


Inherited Variables

Inherited Methods


Class Details

[line 45]
Simple wrapper interface for the Nmap utility.


[ Top ]


Method Detail

__construct (Constructor)   [line 108]

Net_Nmap __construct( [array $options = array()])

Creates a new Nmap object

Available options are:

  • string nmap_binary: The location of the Nmap binary. If not specified, defaults to '/usr/bin/nmap'.
  • string output_file: Path to store the Nmap XML output file. If not specified, a temporary file is created.

  • Access: public

Parameters:

array   $options   —  optional. An array of options used to create the Nmap object. All options must be optional and are represented as key-value pairs.

[ Top ]

createCommandLine   [line 128]

string createCommandLine( array $targets)

Prepare the command to execute
  • Access: protected

Parameters:

array   $targets   —  contains hostnames, IP addresses, networks to scan

[ Top ]

enableOptions   [line 255]

void enableOptions( array $nmap_options)

Enable Nmap options Available nmap options are:

  • boolean os_detection: Enable the OS detection (-O).
  • boolean service_info: Probe open ports to determine service/version info (-sV)
  • string port_ranges : Port ranges, only scan specified ports (-p <port ranges>) Ex: 22; 1-65535; U:53,111,137,T:21-25,80,139,8080
  • boolean all_options : Enables OS detection and Version detection, Script scanning and Traceroute (-A)


Parameters:

array   $nmap_options   —  Nmap options to enable

[ Top ]

getFailedToResolveHosts   [line 221]

Array getFailedToResolveHosts( )

Get all the hostnames/IPs failed to resolve during scanning operation
  • Return: Returns array
  • Access: public

[ Top ]

getNmapStats   [line 231]

Net_Nmap_Stats getNmapStats( )

Get Nmap Statistics
  • Return: Return an Nmap Stats Object
  • Access: public

[ Top ]

parseXMLOutput   [line 194]

ArrayIterator parseXMLOutput( [string $output_file = null])

Get all the discovered hosts
  • Return: Returns Hosts Object on success.
  • Throws: Net_Nmap_Exception If a parsing error occurred.
  • Access: public

Parameters:

string   $output_file   —  Absolute path of the file to parse (optional)

[ Top ]

scan   [line 161]

true scan( array $targets, [bool $with_sudo = false])

Scan the specified target
  • Return: | PEAR_Error
  • Throws: Net_Nmap_Exception If Nmap binary does not exist or the command failed to execute.
  • Access: public

Parameters:

array   $targets   —  Array contains hostnames, IP addresses, networks to scan
bool   $with_sudo   —  Boolean to enable or not sudo scan

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:56:38 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.