rapid7 / nexpose-client-python

DEPRECATED : Rapid7 Nexpose API client library written in Python
https://www.rapid7.com/
BSD 3-Clause "New" or "Revised" License
25 stars 20 forks source link

SaveSiteConfiguration doesn't save site specific blackouts #39

Open derpadoo opened 6 years ago

derpadoo commented 6 years ago

SaveSiteConfiguration doesn't save site blackouts.

Expected Behavior

Specific site blackouts should be saved.

Current Behavior

A site blackout is not included when saved.

Possible Solution

Similar to the tags not being populated. Likely need to update nexpose_site.py

Steps to Reproduce (for bugs)

Python code that reproduces the issue:

    # Load configuration for a site based on site ID
    config = session.GetSiteConfiguration(site_id)

    new_ip_list = []
    for ip in ip_list:
        new_ip_list.append(nexpose.Range(ip, ''))

    # Assign new IPs to the hosts attribute.
    config.hosts = new_ip_list

    try:
        session.SaveSiteConfiguration(config)
        print("[+] Successfully saved IPs to site: {0} (Site ID: {1})".format(config.name, config.id))
    except Exception as e:
        print("[-] Error saving IPs to site: {0} (Site ID: {1})".format(config.name, config.id))
        print("EXCEPTION: {0}".format(e))

Context

Need to save all details of a site when updating it.

Your Environment

derpadoo commented 6 years ago

Used the ruby gem to compare the info in a site before running the Python library and after.

site = Nexpose::Site.load(@nsc, 2)
pp site