Python builtins.object() Examples

The following are 30 code examples of builtins.object(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module builtins , or try the search function .
Example #1
Source File: nexpose_vulnerabilityexception.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def CreateFromXML(xml_data):
        details = VulnerabilityException()
        details.id = int(get_attribute(xml_data, 'exception-id', details.id))
        details.vulnerability_id = get_attribute(xml_data, 'vuln-id', details.vulnerability_id)
        details.vulnerability_key = get_attribute(xml_data, 'vuln-key', details.vulnerability_key)
        details.expiration_date = get_attribute(xml_data, 'expiration-date', details.expiration_date)  # TODO: date object
        details.submitter = get_attribute(xml_data, 'submitter', details.submitter)
        details.submitter_comment = get_content_of(xml_data, 'submitter-comment', details.submitter_comment)
        details.reviewer = get_attribute(xml_data, 'reviewer', details.reviewer)
        details.reviewer_comment = get_content_of(xml_data, 'reviewer-comment', details.reviewer_comment)
        details.status = get_attribute(xml_data, 'status', details.status)
        details.reason = get_attribute(xml_data, 'reason', details.reason)
        details.scope = get_attribute(xml_data, 'scope', details.scope)
        details.asset_id = int(fix_null(get_attribute(xml_data, 'device-id', details.asset_id)))
        details.asset_port = int(fix_null(get_attribute(xml_data, 'port-no', details.asset_port)))
        return details 
Example #2
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestSiloListing(self):
        """
        This function will return a single SiloListingResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("SiloListingRequest")  # TODO 
Example #3
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestVulnerabilityExceptionRecall(self, exception_id):
        """
        Recalls the specified vulnerability exception.
        This function will return a single VulnerabilityExceptionDeleteResponse XML object (API 1.2).
        """
        return self.ExecuteAdvancedOnVulnerabilityException("VulnerabilityExceptionRecallRequest", exception_id) 
Example #4
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def GetAssetGroupConfiguration(self, assetgroup_or_id):
        """
        Return the detailed configuration of an asset group.
        This function will return a dl_nexpose.AssetGroupConfiguration object using a AssetGroupConfigRequest.
        """
        if isinstance(assetgroup_or_id, AssetGroupSummary):
            assetgroup_or_id = assetgroup_or_id.id
        response = self.VerifySuccess(self.RequestAssetGroupConfig(assetgroup_or_id))
        xml_data = get_element(response, 'AssetGroup')
        asset_group = AssetGroupConfiguration.CreateFromXML(xml_data)

        # fetch the description (with newline support) using the 2.0 API
        try:
            sub_url = APIURL_ASSETGROUPS.format(asset_group.id)
            json_dict = self.ExecutePagedGet_v20(sub_url)
            asset_group.description = json_dict.get['description']
            if asset_group.description is None:
                asset_group.description = asset_group.short_description
        except Exception as ex:  # noqa: F841
            pass

        return asset_group

    #
    # The following functions implement the Scan API:
    # ============================================== 
Example #5
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def GetScanSummary(self, scan_or_id):
        """
        Return the (up-to-date) scan summary (statistics) of a scan.
        This function will return a dl_nexpose.ScanSummary object using a ScanStatisticsRequest.
        Raises an exception on failure.
        """
        if isinstance(scan_or_id, ScanSummary):
            scan_or_id = scan_or_id.id
        response = self.VerifySuccess(self.RequestScanStatistics(scan_or_id))
        element = get_element(response, 'ScanSummary')
        return ScanSummary.CreateFromXML(element) 
Example #6
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def GetFilteredAssets(self, filter_or_criteria_or_criterion):
        """
        Generate dl_nexpose.FilteredAsset objects.
        The assests are filtered by a dl_nexpose.AssetFilter, -.Criteria or -.Criterion object.
        Exceptions are raised as-is.
        """
        if not isinstance(filter_or_criteria_or_criterion, AssetFilter):
            filter_or_criteria_or_criterion = AssetFilter(filter_or_criteria_or_criterion)
        result = self.ExecuteGetRecords('data/asset/filterAssets', filter_or_criteria_or_criterion)
        return map(FilteredAsset.CreateFromJSON, result)

    #
    # The following functions implement the Asset Group Management API:
    # ================================================================= 
Example #7
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestVulnerabilityExceptionUpdateComment(self):
        """
        This function will return a single VulnerabilityExceptionUpdateCommentResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("VulnerabilityExceptionUpdateCommentRequest")  # TODO 
Example #8
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestVulnerabilityExceptionDelete(self, exception_id):
        """
        Delete the specified vulnerability exception.
        This function will return a single VulnerabilityExceptionDeleteResponse XML object (API 1.2).
        """
        return self.ExecuteAdvancedOnVulnerabilityException("VulnerabilityExceptionDeleteRequest", exception_id) 
Example #9
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestVulnerabilityExceptionReject(self, exception_id, comment):
        """
        This function will return a single VulnerabilityExceptionRejectResponse XML object (API 1.2).
        """
        xml_comment = create_element("comment")
        xml_comment.text = comment
        return self.ExecuteAdvancedWithElement("VulnerabilityExceptionRejectRequest", {'exception-id': exception_id}, xml_comment) 
Example #10
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestVulnerabilityExceptionApprove(self, exception_id, comment):
        """
        This function will return a single VulnerabilityExceptionApproveResponse XML object (API 1.2).
        """
        xml_comment = create_element("comment")
        xml_comment.text = comment
        return self.ExecuteAdvancedWithElement("VulnerabilityExceptionApproveRequest", {'exception-id': exception_id}, xml_comment) 
Example #11
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def GetSiteConfiguration(self, site_or_id):
        """"
        Get the configuration of the specified site.
        This function will return a single dl_nexpose.SiteConfiguration object using a SiteConfigRequest.
        Raises an exception on failure.
        """
        if isinstance(site_or_id, SiteBase):
            site_or_id = site_or_id.id
        response = self.VerifySuccess(self.RequestSiteConfig(site_or_id))
        element = get_element(response, 'Site')
        return SiteConfiguration.CreateFromXML(element) 
Example #12
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestRoleDetails(self, role_name, role_scope):
        """
        Return all details of a specified role (by name and scope).
        This function will return a single RoleDetailsResponse XML object (API 1.2).
        """
        return self.ExecuteAdvancedOnRole("RoleDetailsRequest", role_name, role_scope) 
Example #13
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestRoleListing(self):
        """
        Return all roles.
        This function will return a single RoleListingResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("RoleListingRequest") 
Example #14
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestRoleCreate(self, role_details):
        """
        Create a new role.
        Both name and fullname must be unique.
        This function will return a single RoleCreateResponse XML object (API 1.2).
        """
        return self.ExecuteAdvancedAfterCallingAsXML("RoleCreateRequest", role_details, exclude_id=True) 
Example #15
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestSiloDelete(self):
        """
        This function will return a single SiloDeleteResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("SiloDeleteRequest")  # TODO

    #
    # The following functions implement the Role Management API:
    # ========================================================= 
Example #16
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestSiloUpdate(self):
        """
        This function will return a single SiloUpdateResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("SiloUpdateRequest")  # TODO 
Example #17
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestEnginePoolCreate(self):
        """
        This function will return a single EnginePoolCreateResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("EnginePoolCreateRequest")  # TODO 
Example #18
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestSiloCreate(self):
        """
        This function will return a single SiloCreateResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("SiloCreateRequest")  # TODO 
Example #19
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestSiloProfileDelete(self):
        """
        This function will return a single SiloProfileDeleteResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("SiloProfileDeleteRequest")  # TODO

    #
    # The following functions implement the Silo Management API:
    # ========================================================= 
Example #20
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestSiloProfileConfig(self):
        """
        This function will return a single SiloProfileConfigResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("SiloProfileConfigRequest")  # TODO 
Example #21
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestSiloProfileUpdate(self):
        """
        This function will return a single SiloProfileUpdateResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("SiloProfileUpdateRequest")  # TODO 
Example #22
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestSiloProfileCreate(self):
        """
        This function will return a single SiloProfileCreateResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("SiloProfileCreateRequest")  # TODO 
Example #23
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestMultiTenantUserDelete(self):
        """
        This function will return a single MultiTenantUserDeleteResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("MultiTenantUserDeleteRequest")  # TODO

    #
    # The following functions implement the Silo Profile Management API:
    # ================================================================= 
Example #24
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestMultiTenantUserConfig(self):
        """
        This function will return a single MultiTenantUserConfigResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("MultiTenantUserConfigRequest")  # TODO 
Example #25
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestMultiTenantUserUpdate(self):
        """
        This function will return a single MultiTenantUserUpdateResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("MultiTenantUserUpdateRequest")  # TODO 
Example #26
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestMultiTenantUserListing(self):
        """
        This function will return a single MultiTenantUserListingResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("MultiTenantUserListingRequest")  # TODO 
Example #27
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestTicketDelete(self, ticket_id):
        """
        This function will return a single TicketDeleteResponse XML object (API 1.2).
        """
        return self.ExecuteAdvancedOnTicket("TicketDeleteRequest", ticket_id)

    #
    # The following functions implement the Multi-Tenant User Management API:
    # ====================================================================== 
Example #28
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestTicketDetails(self, ticket_id):
        """
        This function will return a single TicketDetailsResponse XML object (API 1.2).
        """
        return self.ExecuteAdvancedOnTicket("TicketDetailsRequest", ticket_id) 
Example #29
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestTicketListing(self):
        """
        This function will return a single TicketListingResponse XML object (API 1.2).
        """
        return self.ExecuteAdvanced("TicketListingRequest") 
Example #30
Source File: nexpose.py    From nexpose-client-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def RequestTicketCreate(self, xml_ticket_details):
        """
        This function will return a single TicketCreateResponse XML object (API 1.2).
        """
        return self.ExecuteAdvancedWithElement("TicketCreateRequest", {}, xml_ticket_details)