Skip to content
This repository was archived by the owner on May 14, 2021. It is now read-only.
This repository was archived by the owner on May 14, 2021. It is now read-only.

Creating a site causes a NexposeFailureException: java.lang.NullPointerException #50

Description

@santsys

I'm using v0.1.2 of the nexpose library in this instance (older deployment).

Background:
I am attempting to create a new site in Nexpose with host information.

In some Nexpose environments (both running 6.5.1) the error NexposeFailureException: java.lang.NullPointerException is generated, but in other environments, everything works fine. Does anyone have any idea of why the call would work in one environment but not in another?

Here is part of a stack trace.

File "test_nexpose.py", line 340, in createNexposeSite
    return session.SaveSiteConfiguration(site_cfg)

File "/usr/local/lib/python2.7/site-packages/nexpose/nexpose.py", line 1347, in SaveSiteConfiguration\n",
    return self._ExecuteSave(self.RequestSiteSave, site_configuration, 'SiteSaveResponse', 'site-id')  # TODO: if this turns out to be 'id' instead of 'site-id' than remove the parameter from the function,

File "/usr/local/lib/python2.7/site-packages/nexpose/nexpose.py", line 1176, in _ExecuteSave,
    response = self.VerifySuccess(save_function(object_to_save.AsXML(exclude_id=False))),

File "/usr/local/lib/python2.7/site-packages/nexpose/nexpose.py", line 1312, in VerifySuccess,
    raise NexposeFailureException(message)",

NexposeFailureException: java.lang.NullPointerException

Here is the basics of how i'm creating the site:

def createNexposeSite(session=None, hosts=list()):
    """
    Create a new site containing the specified hosts.
    This uses the default scan engine 'full-audit-without-web-spider'
    (Full audit without Web Spider).
    """
    if session is None:
        session = initNexposeSession()

    if session is None:
        LOG.error('Unable to open session. Exiting.')
        return None

    site_name = "TempSite-Nexpose-" + datetime.now().strftime("%Y%m%dT%H%M%z")
    site_desc = "Temp Site for hosts that should be scanned."
    site_cfg = nexpose.SiteConfiguration.Create()
    site_cfg.id = -1
    site_cfg.name = site_name
    site_cfg.description = site_desc

    if len(hosts) > 0:
        for h in hosts:
            s_host_range = Range(h, None)
            site_cfg.hosts.append(s_host_range)

    return session.SaveSiteConfiguration(site_cfg)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions