Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/api/io/access_groups.rst

This file was deleted.

1 change: 0 additions & 1 deletion docs/api/io/access_groups_v2.rst

This file was deleted.

1 change: 1 addition & 0 deletions docs/api/io/pci/attestations.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodule:: tenable.io.pci.attestations
1 change: 1 addition & 0 deletions docs/api/io/pci/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodule:: tenable.io.pci
1 change: 1 addition & 0 deletions docs/api/io/pci/scans.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodule:: tenable.io.pci.scans
1 change: 0 additions & 1 deletion docs/api/io/target_groups.rst

This file was deleted.

4 changes: 4 additions & 0 deletions docs/api/nessus/plugin_rules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. important::
The Nessus Package is currently a Technology Preview

.. automodule:: tenable.nessus.plugin_rules
1 change: 1 addition & 0 deletions docs/api/sc/license.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodule:: tenable.sc.license
1 change: 1 addition & 0 deletions docs/api/sc/report_definition.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodule:: tenable.sc.report_definition
1 change: 1 addition & 0 deletions docs/api/sc/tickets.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodule:: tenable.sc.tickets
1 change: 0 additions & 1 deletion docs/api/tenableone/inventory/findings/schema.rst

This file was deleted.

1 change: 0 additions & 1 deletion tenable/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
.. image:: https://img.shields.io/readthedocs/pytenable
.. image:: https://img.shields.io/pypi/dm/pytenable
.. image:: https://img.shields.io/github/license/tenable/pyTenable.svg
.. image:: https://sonarcloud.io/api/project_badges/measure?project=tenable_pyTenable&metric=alert_status

pyTenable is intended to be a pythonic interface into the Tenable application
APIs. Further by providing a common interface and a common structure between
Expand Down
5 changes: 1 addition & 4 deletions tenable/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
:glob:

cs/index
pci/index
access_control
agent_config
agent_exclusions
Expand Down Expand Up @@ -436,10 +437,6 @@ def workbenches(self):

@property
def v3(self):
"""
The interface object for the
:doc:`Tenable Vulnerability Management v3 APIs <v3/index>`.
"""
warnings.warn(
'The V3 sub-pkg have been deprecated from the TVM '
'package. This method will be removed in a future '
Expand Down
3 changes: 2 additions & 1 deletion tenable/io/exports/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ def vulns(
cve_category:
Returns findings the match the specified CVE category. For more
information about categories, see the *Vulnerability Categories*
section in the _Tenable Vulnerability Management User Guide_.
section in the Tenable Vulnerability Management User Guide.
exploit_maturity:
Returns findings that match the specified exploit maturity. Tenable
assigns exploit maturity values to vulnerabilities based on the
Expand Down Expand Up @@ -1079,6 +1079,7 @@ def was(
"""
Initiate a WAS vulnerability export.
:devportal:`API Documentation <was-export-findings>`

Args:
first_found:
Findings first discovered after this timestamp will be returned.
Expand Down
7 changes: 7 additions & 0 deletions tenable/io/pci/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
.. autoclass:: PCIASVAPI
:members:

.. toctree::
:hidden:
:glob:

attestations
scans

"""

from typing import Any, Literal, Type
Expand Down
105 changes: 53 additions & 52 deletions tenable/nessus/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'''
"""
Nessus
======

Expand All @@ -20,6 +20,7 @@
groups
mail
permissions
plugin_rules
plugins
policies
proxy
Expand All @@ -31,8 +32,10 @@
software_update
tokens
users
'''
"""

from tenable.base.platform import APIPlatform

from .agent_groups import AgentGroupsAPI
from .agents import AgentsAPI
from .editor import EditorAPI
Expand All @@ -42,9 +45,9 @@
from .mail import MailAPI
from .permissions import PermissionsAPI
from .plugin_rules import PluginRulesAPI
from .plugins import PluginsAPI
from .policies import PoliciesAPI
from .proxy import ProxyAPI
from .plugins import PluginsAPI
from .scanners import ScannersAPI
from .scans import ScansAPI
from .server import ServerAPI
Expand All @@ -56,165 +59,163 @@


class Nessus(APIPlatform):
'''
"""
The Nessus object is the primary interaction point for users to
interface with Tenable Nessus via the pyTenable library. All of the API
endpoint classes that have been written will be grafted onto this class.
'''
"""

_env_base = 'NESSUS'
_ssl_verify = False
_conv_json = True

def _session_auth(self, username, password): # noqa: PLW0221,PLW0613
token = self.post('session', json={
'username': username,
'password': password
}).get('token')
self._session.headers.update({
'X-Cookie': f'token={token}'
})
token = self.post(
'session', json={'username': username, 'password': password}
).get('token')
self._session.headers.update({'X-Cookie': f'token={token}'})
self._auth_mech = 'user'

@property
def agent_groups(self):
'''
"""
The interface object for the
:doc:`Tenable Nessus Agent Groups APIs <agent_groups>`.
'''
"""
return AgentGroupsAPI(self)

@property
def agents(self):
'''
"""
The interface object for the :doc:`Tenable Nessus Agents APIs <agents>`.
'''
"""
return AgentsAPI(self)

@property
def editor(self):
'''
"""
The interface object for the :doc:`Tenable Nessus Editor APIs <editor>`.
'''
"""
return EditorAPI(self)

@property
def files(self):
'''
"""
The interface object for the :doc:`Tenable Nessus File APIs <files>`.
'''
"""
return FilesAPI(self)

@property
def folders(self):
'''
"""
The interface object for the :doc:`Tenable Nessus Folders APIs <folders>`.
'''
"""
return FoldersAPI(self)

@property
def groups(self):
'''
"""
The interface object for the :doc:`Tenable Nessus Groups APIs <groups>`.
'''
"""
return GroupsAPI(self)

@property
def mail(self):
'''
"""
The interface object for the :doc:`Tenable Nessus Mail APIs <mail>`.
'''
"""
return MailAPI(self)

@property
def permissions(self):
'''
"""
The interface object for the
:doc:`Tenable Nessus Permissions APIs <permissions>`.
'''
"""
return PermissionsAPI(self)

@property
def plugin_rules(self):
'''
"""
The interface object for the
:doc:`Tenable Nessus Plugin Rules APIs <plugin_rules>`.
'''
"""
return PluginRulesAPI(self)

@property
def plugins(self):
'''
"""
The interface object for the :doc:`Tenable Nessus Plugins APIs <plugins>`.
'''
"""
return PluginsAPI(self)

@property
def policies(self):
'''
"""
The interface object for the :doc:`Tenable Nessus Policies APIs <policies>`.
'''
"""
return PoliciesAPI(self)

@property
def proxy(self):
'''
"""
The interface object for the :doc:`Tenable Nessus Proxy APIs <proxy>`.
'''
"""
return ProxyAPI(self)

@property
def scanners(self):
'''
"""
The interface object for the :doc:`Tenable Nessus Scanners APIs <scanners>`.
'''
"""
return ScannersAPI(self)

@property
def scans(self):
'''
"""
The interface object for the :doc:`Tenable Nessus Scans APIs <scans>`.
'''
"""
return ScansAPI(self)

@property
def server(self):
'''
"""
The interface object for the :doc:`Tenable Nessus Server APIs <server>`.
'''
"""
return ServerAPI(self)

@property
def session(self):
'''
"""
The interface object for the :doc:`Tenable Nessus Session APIs <session>`.
'''
"""
return SessionAPI(self)

@property
def settings(self):
'''
"""
The interface object for the :doc:`Tenable Nessus Settings APIs <settings>`.
'''
"""
return SettingsAPI(self)

@property
def software_update(self):
'''
"""
The interface object for the
:doc:`Tenable Nessus Software Update APIs <software_update>`.
'''
"""
return SoftwareUpdateAPI(self)

@property
def tokens(self):
'''
"""
The interface object for the :doc:`Tenable Nessus Tokens APIs <tokens>`.
'''
"""
return TokensAPI(self)

@property
def users(self):
'''
"""
The interface object for the :doc:`Tenable Nessus Users APIs <users>`.
'''
"""
return UsersAPI(self)
22 changes: 11 additions & 11 deletions tenable/sc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
feeds
files
groups
hosts
license
organizations
plugins
Expand Down Expand Up @@ -68,8 +69,8 @@
from .feeds import FeedAPI
from .files import FileAPI
from .groups import GroupAPI
from .license import LicenseAPI
from .hosts import HostsAPI
from .license import LicenseAPI
from .organizations import OrganizationAPI
from .plugins import PluginAPI
from .policies import ScanPolicyAPI
Expand Down Expand Up @@ -230,8 +231,7 @@ def __init__(
stacklevel=2,
)
kwargs['url'] = (
f'{kwargs.get("scheme", "https")}://'
f'{host}:{kwargs.get("port", 443)}'
f'{kwargs.get("scheme", "https")}://{host}:{kwargs.get("port", 443)}'
)

kwargs['access_key'] = access_key
Expand Down Expand Up @@ -509,12 +509,12 @@ def hosts(self):

@property
def license(self):
'''
"""
The interface object for the
:doc:`Tenable Security Center License APIs <license>`.
'''
return LicenseAPI(self)
"""
return LicenseAPI(self)

@property
def organizations(self):
"""
Expand Down Expand Up @@ -626,15 +626,15 @@ def system(self):
:doc:`Tenable Security Center System APIs <system>`.
"""
return SystemAPI(self)

@property
def tickets(self):
'''
"""
The interface object for the
:doc:`Tenable Security Center Ticket APIs <system>`.
'''
"""
return TicketAPI(self)

@property
def users(self):
"""
Expand Down
Loading