Policy Management

class nessus.Policy(uri, api)
add()
Raises:NotImplementedError

Todo

/policy/add

copy(policy_id)

Copy an existing policy to a new policy.

Parameters:policy_id – numeric ID of the policy

Permissions:

  • authenticated: Yes
  • administrator: No
delete(policy_id)

Delete an existing policy.

Parameters:policy_id – numeric ID of the policy

Permissions:

  • authenticated: Yes
  • administrator: No
download(policy_id)

Download the policy from the Nessus scanner to your local system.

Parameters:policy_id – numeric ID of the policy

Permissions:

  • authenticated: Yes
  • administrator: Yes
edit()
Raises:NotImplementedError

Todo

/policy/edit

list()

List of available policies, policy settings and the default values that would be used when creating a new Nessus scan.

The list of default values are the values that will be used during a scan if they are not supplied by the user in the policy (taken from nessusd.rules).

For example, you could save a policy with only one item in it (e.g., max_checks = 42) and the rest of the settings used for the scan would be what is returned in list(). Custom policies that are returned only include enabled plugins (i.e., disabled plugins will not be returned).

Permissions:

  • authenticated: Yes
  • administrator: No

Example:

>>> from nessus import API
>>> nessus = API('https://127.0.0.1:8834', username='user', password='pass')
>>> print nessus.policy.list()
[
  {
    "policyname": "Internal Network Scan",
    "policycontents": {
      "individualpluginselection": {
        "pluginitem": [
          {
            "status": "enabled",
            "pluginid": "34220",
            "pluginname": "Netstat Portscanner (WMI)",
            "family": "Port scanners"
          },
          (...)
upload()
Raises:NotImplementedError

Todo

/file/upload, /file/policy/import