libnmap.objects.service

Using libnmap.objects.service module

TODO

NmapService methods

class libnmap.objects.NmapService(portid, protocol='tcp', state=None, service=None, owner=None, service_extras=None)[source]

NmapService represents a nmap scanned service. Its id() is comprised of the protocol and the port.

Depending on the scanning options, some additional details might be available or not. Like banner or extra datas from NSE (nmap scripts).

banner

Accessor for the service’s banner. Only available if the nmap option -sV or similar was used.

Returns:string
changed(other)[source]

Checks if a NmapService is different from another.

Parameters:other – NmapService
Returns:boolean
cpelist

Accessor for list of CPE for this particular service

diff(other)[source]

Calls NmapDiff to check the difference between self and another NmapService object.

Will return a NmapDiff object.

This objects return python set() of keys describing the elements which have changed, were added, removed or kept unchanged.

Returns:NmapDiff object
get_dict()[source]

Return a python dict representation of the NmapService object.

This is used to diff() NmapService objects via NmapDiff.

Returns:dict
id

Accessor for the id() of the NmapService.

This is used for diff()ing NmapService object via NmapDiff.

Returns:tuple
open()[source]

Tells if the port was open or not

Returns:boolean
owner

Accessor for service owner if available

port

Accessor for port.

Returns:integer or -1
protocol

Accessor for protocol

Returns:string
reason

Accessor for service’s state reason (syn-ack, filtered,…)

Returns:string or empty if not applicable
reason_ip

Accessor for service’s state reason ip

Returns:string or empty if not applicable
reason_ttl

Accessor for service’s state reason ttl

Returns:string or empty if not applicable
scripts_results

Gives a python list of the nse scripts results.

The dict key is the name (id) of the nse script and the value is the output of the script.

Returns:dict
service

Accessor for service name.

Returns:string or empty
service_dict

Accessor for service dictionary.

Returns:dict or None
servicefp

Accessor for the service’s fingerprint if the nmap option -sV or -A is used

Returns:string if available
state

Accessor for service’s state (open, filtered, closed,…)

Returns:string
tunnel

Accessor for the service’s tunnel type if applicable and available from scan results

Returns:string if available