Skip to main content

Python3 bindings and CLI tools for Nexpose API version 3

Project description

Python3 bindings and CLI tools for Nexpose API version 3.

cli programs

nsc-exporter

A Prometheus exporter for Nexpose scan console metrics.

It is a good idea to create a Nexpose user and role specifically for this, with permissions only to:

  • “View Site Asset Data”

  • “View Group Asset Data”.

A systemd service file is provided at etc/systemd/system/nexpose-exporter.service, and a sample env file at etc/defaults/nexpose-exporter.env. These will be relative to your virtualenv for a virtualenv install, relative to $HOME/.local for a pip install --user install, and (probably, depending on your OS) relative to /usr/local for a root pip install.

nsc-janitor

Maintenance service for Nexpose scan console. This will remove sites and reports older than 90 days.

It is a good idea to create a Nexpose user and role specifically for this, with permissions only to:

  • “Manage Sites”

  • “Manage Report Templates”.

  • “View Group Asset Data”

  • “Manage Report Access”

A systemd service file is provided at etc/systemd/system/nexpose-janitor.service, and a sample env file at etc/defaults/nexpose-janitor.env. These will be relative to your virtualenv for a virtualenv install, relative to $HOME/.local for a pip install --user install, and (probably, depending on your OS) relative to /usr/local for a root pip install.

nsc-remove-old-reports

nsc-remove-old-sites

library usage

Basic usage:

import nexpose.nexpose as nexpose

login = nexpose.login(
    base_url='https://localhost:3780',
    user='some_nexpose_user',
    password='secure_nexpose_password',
)

nexpose.engines(nlogin=login)

With CLI argument parsing:

import nexpose.nexpose as nexpose
import nexpose.args as nexposeargs

parser = nexposeargs.parser
parser.description = "My nexpose script"
parser.add_argument(
    "-f",
    "--foo",
    help="foo argument",
    action="store",
)

args = parser.parse_args()
config = nexpose.config(args)

nexpose.engines(nlogin=config)
print(f"my foo argument was {args.foo}")

alternatives

nexpose (https://pypi.org/project/nexpose/ ) is the official python binding for Nexpose API versions 1.1 and 1.2.

nexpose-rest (https://pypi.org/project/nexpose-rest/) is unofficial. It is (partially?) auto-generated and more comprehensive than nexpose-py.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nexpose-py-0.0.19.tar.gz (9.7 kB view details)

Uploaded Source

File details

Details for the file nexpose-py-0.0.19.tar.gz.

File metadata

  • Download URL: nexpose-py-0.0.19.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5

File hashes

Hashes for nexpose-py-0.0.19.tar.gz
Algorithm Hash digest
SHA256 0487e210e75fd0e9b2f77b8ff781217399bf0f0c9946b1edad661d8b98832ac7
MD5 789517159302ea99eb2e83a9408a6d94
BLAKE2b-256 fd45cd26f1f5221e9ad22e103b082a55b6ecc998651109d94c173ee7d8bd1edb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page