Python Client for Nessus 5.0 REST API.
Nessus is a proprietary comprehensive vulnerability scanner which is developed by Tenable Network Security. It is free of charge for personal use in a non-enterprise environment.
Documentation
Documentation is available online at http://python-nessus-client.readthedocs.org and in the docs directory.
Installation
Install using pip
pip install python-nessus-client
Examples
REST resources are translated to methods.
For example:
Resource |
Method |
|---|---|
/users/list |
object.users.list() |
/server/securesettings/&proxy%5Fport=8888 |
object.server.securesettings(proxy_port='8888') |
and so on…
To get users list https://nessus.example.com:8834/users/list we call list() method on Users class
>>> from nessus import API
>>> nessus = API('https://127.0.0.1:8834', username='user', password='pass')
>>> print nessus.users.list()
[
{
"admin": "TRUE",
"name": "test",
"lastlogin": 1416492416
}
]
To get server security settings list https://nessus.example.com:8834/server/securesettings/list we call securesettings() method on Server class
>>> from nessus import API
>>> nessus = API('https://127.0.0.1:8834', username='user', password='pass')
>>> print nessus.server.securesettings()
{
"proxysettings": {
"proxy_password": null,
"proxy_port": "8080",
"custom_host": null,
"proxy_username": null,
"user_agent": null,
"proxy": "10.0.0.1"
}
}
To set server security settings https://nessus.example.com:8834/server/securesettings we use the same securesettings() method on Server class but we pass as a argument settings to set up.
>>> from nessus import API
>>> nessus = API('https://127.0.0.1:8834', username='user', password='pass')
>>> nessus.server.securesettings(proxy_port='8081')
>>> print nessus.server.securesettings()
{
"proxysettings": {
"proxy_password": null,
"proxy_port": "8081",
"custom_host": null,
"proxy_username": null,
"user_agent": null,
"proxy": "10.0.0.1"
}
}
More examples can be found in the following subsections and in class documentation.
Authenticating a user
Login to Nessus server
>>> from nessus import API
>>> nessus = API('https://127.0.0.1:8834', username='user', password='pass')
Response is Python structure
We can acts like we work with dict.
Get configuration value
>>> print nessus.server.securesettings()['proxysettings']['proxy_port']
8080
Get name from second item in report list get list of hosts contained in a specified report
>>> second_host = nessus.report.list()[1]['name']
>>> print nessus.report.hosts(second_host)
{
"scanprogresscurrent": "0",
"scanprogresstotal": "100",
(...)
}
Make output more readable
# before
>>> print nessus.server.securesettings()
{u'proxysettings': {u'proxy_password': None, u'proxy_port': u'8080', (...)
# after
>>> import json
>>> data = nessus.server.securesettings()
>>> json.dumps(data, indent=2)
{
"proxysettings": {
"proxy_password": null,
"proxy_port": "8080",
"custom_host": null,
"proxy_username": null,
"user_agent": null,
"proxy": "10.0.0.1"
}
}
Check if report has audit trail
>>> nessus.report.has_audit_trail(name)
True
>>> if nessus.report.has_audit_trail(name):
>>> print 'Report {} has audit trail'.format(name)
Report 95c309f8-2578-fd3e-9e4d-a8aa6d6511e8b617b5a088c93309 has audit trail
Create new scan
# make list with hosts
>>> target = ['localhost', 'example.com']
>>> nessus.scan.new(target, 'test', '-37')
Metadata
Release files for python-nessus-client 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| python-nessus-client-0.1.1.zip | 28.1 kB | Without provenance | Details |
Release files / python-nessus-client-0.1.1.zip
| Download URL | python-nessus-client-0.1.1.zip |
|---|---|
| Size | 28.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8556818e31fd88bb4eab6c14513ce6ba865df19a2095e622b5c1769b0fac1f05
|
|
BLAKE2b-256 checksum How to use checksums |
e690eae0403348cbf4f9efc9998b0ed397fc05ea4bbe38ed3e81e2fac9181579
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for python-nessus-client 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.