Important
The Nessus Package is currently a Technology Preview
Scanners¶
Methods described in this section relate to the scanners API.
These methods can be accessed at Nessus.scanners
.
- class ScannersAPI(api: APISession)[source]¶
- aws_targets(scanner_id: int) → List[Dict][source]¶
Retrieves the AWS targets from the scanner. Only applies to AWS scanners.
- Parameters:
scanner_id (int) – Id of the scanner to call
- Returns:
List of AWS target objects.
- Return type:
List
Example
>>> for target in nessus.scanners.aws_targets(1): ... print(target)
- control_scan(scanner_id: int, scan_uuid: str, action: Literal['stop', 'pause', 'resume']) → None[source]¶
Controls a scan currently running on a scanner.
- Parameters:
Example
>>> nessus.scanners.control_scan(scanner_id, scan_uuid, 'pause')
- delete(scanner_id: int) → None[source]¶
Delete and unlink the scanner.
- Parameters:
scanner_id (int) – Id of the scanner to delete
Example
>>> nessus.scanners.delete(1)
- delete_many(scanner_ids: List[int]) → None[source]¶
Delete and unlink many scanners.
Example
>>> nessus.scanners.delete_many([1, 2, 3])
- details(scanner_id: int) → Dict[source]¶
Retrieve the details for a scanner.
- Parameters:
scanner_id (int) – Id of the scanner to retrieve
Example
>>> nessus.scanners.details(1)
- link_state(scanner_id: int, linked: bool) → None[source]¶
Toggles the link state of the specified scanner.
- Parameters:
Example
>>> nessus.scanners.link_state(1, linked=True)
- list() → List[Dict][source]¶
Returns a list of scanners.
- Returns:
List of scanners connected to this scanner.
- Return type:
List
Example
>>> for scanner in nessus.scanners.list(): ... print(scanner)
- running_scans(scanner_id: int) → List[Dict][source]¶
Retrieves the list of running scans on the scanner.
- Parameters:
scanner_id (int) – Id of the scanner to call
- Returns:
If scans are running on the scanner, a list of scan objects will be returned. If no scans are currently running on the scanner, then a None object will be returned.
- Return type:
List
Example
>>> scans = nessus.scanners.active_scans(1) >>> if scans: ... for scan in scans: ... print(scan)
- scanner_key(scanner_id: int) → str[source]¶
Retrieves the scanner key for the requested scanner.
Example
>>> nessus.scanners.scanner_key(1)
- update(scanner_id: int, force_plugin_update: bool | None = None, force_ui_update: bool | None = None, finish_update: bool | None = None, registration_code: str | None = None, aws_update_interval: int | None = None) → None[source]¶
Update the scanner
- Parameters:
scanner_id (int) – Id of the scanner to update
force_plugin_update (bool, optional) – Should the scanner plugins be forcibly updated?
force_ui_update (bool, optional) – Should the scanner UI be forcibly updated?
finish_update (bool, optional) – Should the scanner service be restarted to run the latest software update? This is only valid if automatic updates on the scanner are disabled.
registration_code (str, optional) – Sets the registration code for the scanner.
aws_update_interval (int, optional) – Informs the scanner how often to check into the controlling Tenable Nessus service. This is only valid for AWS scanners.
Example
>>> nessus.scanners.update(1, ... force_plugin_update=True, ... force_ui_update=True ... )