Scanners

The following methods allow for interaction into the Tenable Security Center Scanner API. These items are typically seen under the Scanners section of Tenable Security Center.

Methods available on sc.scanners:

class ScannerAPI(api: APISession)[source]
agent_scans(id, search, results=None)[source]

Retrieves the list of agent scans that meed the specified search criteria.

scanner: test-scans-query

Parameters:
  • id (int) – The numeric id of the scanner.

  • search (str) – The search string to send to the scanner.

  • results (list, optonal) – The list of results ids to test.

Returns:

The list of scans that match the search criteria.

Return type:

list

Examples

>>> scans = sc.scanners.agent_scans('*')
create(name, address, **kw)[source]

Creates a scanner.

scanner: create

Parameters:
  • address (str) – The address of the scanner

  • name (str) – The name of the scanner

  • agent_capable (bool, optional) – Is this scanner an agent capable scanner? If left unspecified the default is False.

  • description (str, optional) – The description of the scanner.

  • enabled (bool, optional) – Is this scanner enabled? If left unspecified, the default is True.

  • managed (bool, optional) – Is the plugin set for this scanner managed? If left unspecified then the default is False.

  • orgs (list, optional) – If the scanner is an agent capable scanner, then a list of organization ids is to be specified to attach the scanner for the purposes of agent scanning.

  • port (int, optional) – What is the port that the Nessus service is running on. If left unspecified, then the default is 8834.

  • proxy (bool, optional) – Is this scanner behind a proxy? If left unspecified then the default is False.

  • zone_ids (list, optional) – List of scan zones that this scanner is to be a member of.

Returns:

The newly created scanner.

Return type:

dict

Examples

>>> scanner = sc.scanners.create('Example Scanner', '192.168.0.1')
delete(id)[source]

Removes the specified scanner.

scanner: delete

Parameters:

id (int) – The numeric identifier for the scanner to remove.

Returns:

An empty response.

Return type:

str

Examples

>>> sc.scanners.delete(1)
details(id, fields=None)[source]

Returns the details for a specific scanner.

scanner: details

Parameters:
  • id (int) – The identifier for the scanner.

  • fields (list, optional) – A list of attributes to return.

Returns:

The scanner resource record.

Return type:

dict

Examples

>>> scanner = sc.scanners.details(1)
>>> pprint(scanner)
edit(id, **kw)[source]

Edits a scanner.

scanner: edit

Parameters:
  • id (int) – The numeric identifier for the scanner.

  • address (str, optional) – The address of the scanner

  • agent_capable (bool, optional) – Is this scanner an agent capable scanner? If left unspecified the default is False.

  • description (str, optional) – The description of the scanner.

  • enabled (bool, optional) – Is this scanner enabled? If left unspecified, the default is True.

  • managed (bool, optional) – Is the plugin set for this scanner managed? If left unspecified then the default is False.

  • name (str, optional) – The name of the scanner

  • orgs (list, optional) – If the scanner is an agent capable scanner, then a list of organization ids is to be specified to attach the scanner for the purposes of agent scanning.

  • port (int, optional) – What is the port that the Nessus service is running on. If left unspecified, then the default is 8834.

  • proxy (bool, optional) – Is this scanner behind a proxy? If left unspecified then the default is False.

  • zone_ids (list, optional) – List of scan zones that this scanner is to be a member of.

Returns:

The newly updated scanner.

Return type:

dict

Examples

>>> scanner = sc.scanners.edit(1, enabled=True)
list(fields=None)[source]

Retrieves the list of scanner definitions.

scanner: list

Parameters:

fields (list, optional) – A list of attributes to return for each scanner.

Returns:

A list of scanner resources.

Return type:

list

Examples

>>> for scanner in sc.scanners.list():
...     pprint(scanner)
update_status()[source]

Starts an on-demand scanner status update.

scanner: update-status

Returns:

The updated scanner status for all scanners.

Return type:

list

Examples

>>> status = sc.scanners.update_status()