def list_all(self, **kwargs):
        """Returns a list of all servers.

        This query is limited to 50 pages of 10 items,
        totaling 500 servers.

        Default filter returns only servers in the 'active' state.

        Keyword Args:
            state (list or str): A list or comma-separated string containing \
            any of these: active, missing, deactivated
            platform (list or str): A list or comma-separated string \
            containing any of these: \
            windows, debian, ubuntu, centos, oracle, rhel, etc...
            cve (str): CVE ID.  Example: CVE-2015-1234
            kb (str): Search for presence of KB.  Example: kb="KB2485376"
            missing_kb (str): Search for absence of KB.  \
            Example: mising_kb="KB2485376"

        Returns:
            list: List of dictionary objects describing servers

        """

        endpoint = "/v1/servers"
        key = "servers"
        max_pages = 50
        request = HttpHelper(self.session)
        params = utility.sanitize_url_params(kwargs)
        response = request.get_paginated(endpoint, key,
                                         max_pages, params=params)
        return response
Beispiel #2
0
    def list_all(self, **kwargs):
        """Returns a list of all servers.

        This query is limited to 50 pages of 100 items,
        totaling 500 servers.

        Default filter returns only servers in the 'active' state.

        Keyword Args:
            state (list or str): A list or comma-separated string containing \
            any of these: active, missing, deactivated
            platform (list or str): A list or comma-separated string \
            containing any of these: \
            windows, debian, ubuntu, centos, oracle, rhel, etc...
            cve (str): CVE ID.  Example: CVE-2015-1234
            kb (str): Search for presence of KB.  Example: kb="KB2485376"
            missing_kb (str): Search for absence of KB.  \
            Example: mising_kb="KB2485376"

        Returns:
            list: List of dictionary objects describing servers

        """

        endpoint = "/v1/servers?per_page=100"
        key = "servers"
        max_pages = 300
        request = HttpHelper(self.session)
        params = utility.sanitize_url_params(kwargs)
        response = request.get_paginated(endpoint,
                                         key,
                                         max_pages,
                                         params=params)
        return response
Beispiel #3
0
    def list_all(self, **kwargs):
        """This method retrieves all local user accounts

        Keyword Args:
            os_type (list or str): A list of local user accounts \
            with the according os type.
            username (list or str): A list of local user accounts \
            with the according username.
            admin (boolean): A list of local user accounts \
            with the according admin.
            active (boolean): A list of local user accounts \
            with the according active settings.
            last_login_at (str): A list of local user accounts \
            last login at date in iso8601 format such as: 2017-01-01.
            never_logged_in (boolean): A list of local user accounts \
            with never logged in.
            password_required (boolean): A list of local user accounts \
            with the according password_required settings
            password_expired (boolean): A list of local user accounts \
            with the according password_expired settings
            comment:  A list of local user accounrs with the according comment
            group_id (list or str): A list of local user accounts \
            with the according group id
            server_id (list or str): A list of local user accounts \
            with the according server id
            server_name (list or str): A list of local user accounts \
            with the according server name
            server_label (list or str): A list of local user accounts \
            with the according server label
            group_name (list or str): A list of local user accounts \
            with the according group name
            locked (boolean): A list of local user accounts \
            with the according locked settings
            gid (list or str): A list of local user accounts \
            with the according gid
            sid (list or str): A list of local user accounts \
            with the according sid

        Returns:
            list: List of dictionary objects describing local user accounts

        """
        endpoint = "/v1/local_accounts"
        key = "accounts"
        max_pages = 50
        request = HttpHelper(self.session)
        params = utility.sanitize_url_params(kwargs)
        response = request.get_paginated(endpoint,
                                         key,
                                         max_pages,
                                         params=params)
        return response
    def list_connections(self, group_id, **kwargs):
        """This method retrieves all recently detected connections in the server\
           group specified by Group ID

        Args:
            server_id (str): Group ID

        Returns:
            list: List of all recently detected connections in the srever group

        """
        endpoint = "/v1/groups/%s/connections" % (group_id)
        params = utility.sanitize_url_params(kwargs)
        request = HttpHelper(self.session)
        response = request.get(endpoint, params=params)
        connections = response["connections"]
        return connections
    def list_all(self, pages, **kwargs):
        """Returns a list of all events.


        Default filter returns ALL events.  This is a very verbose \
        and time-consuming operation.

        Args:
            pages (int): Max number of pages (of ten items each) to retrieve

        Keyword Args:
            group_id (list or str): A list or comma-separated string \
            containing the group IDs to retrieve events for.
            server_id (list or str): A list or comma-separated string \
            containing the server IDs to retrieve events for.
            server_platform (str): (linux | windows)
            critical (bool): Returns only critical or \
            noncritical events.
            type (list or str): A list or comma-separated string containing \
            the event types to query for.  A complete list of event types is \
            available \
            `here: <https://support.cloudpassage.com/entries/23125117-Events\
            #event-types>`_
            since (str): ISO 8601 formatted string representing the starting \
            date and time for query
            until (str): ISO 8601 formatted string representing the ending \
            date and time for query

        Returns:
            list: List of dictionary objects describing servers

        """

        endpoint = "/v1/events"
        key = "events"
        max_pages = pages
        request = HttpHelper(self.session)
        params = utility.sanitize_url_params(kwargs)
        response = request.get_paginated(endpoint,
                                         key,
                                         max_pages,
                                         params=params)
        return response
    def list_all(self, **kwargs):
        """Returns a list of all issues.

        This query is limited to 20 pages of 100 items,
        totalling 2000 issues.

        Default filter returns only issues in the 'active' state.

        Keyword Args:
            agent_id (list or str): A list or comma-separated string \
            containing agent ids
            status (list or str): A list or comma-separated string \
            containing any of these: active, resolved
            since (str): Returns issues created since date in iso8601 format \
            such as: 2017-01-01
            until (str): Returns issues created until date in iso8601 format \
            such as 2017-01-01
            issue_type: (list or str): A list or comma-separated string \
            containing any of these: sva, csm, fim, lids, sam, fw, or agent
            group_id: (list or str): A list or comma-separated string \
            containing group ids
            critical: (list or str): A list or comma-separated string \
            containing any of these: true, false
            policy_id (list or str): A list or comma-separated string \
            containing policy ids
            os_type (list or str): A list or comma-separated string \
            containing any of these: Linux, Windows

         Returns:
            list: List of dictionary objects describing issues

        """

        session = self.session
        max_pages = 20
        key = "issues"
        endpoint = "/v1/issues"
        request = HttpHelper(session)
        params = utility.sanitize_url_params(kwargs)
        issues = request.get_paginated(endpoint, key,
                                       max_pages, params=params)
        return issues
    def list_all(self, **kwargs):
        """Return a list of all local user groups.

        This will only return a maximum of 50 pages, which amounts
        to 500 local user groups.

        Keyword Args:
            group_id (list or str): A list of local user groups \
            in the according server group
            server_id (list or str): A list of local user groups \
            in the according server
            os_type (list or str): A list of local user groups \
            in the according os type
            name (list or str): A list of local user groups \
            with the according name
            memebers (list or str): A list of local user groups \
            with the according members
            comment (str):  A list of local user groups \
            with the according comment
            member_name (list or str): A list of local user groups \
            with the according member names
            server_name (list or str): A list of local user groups \
            with the according server name
            server_label (list or str): A list of local user groups \
            with the according server label
            gid (list or str): A list of local user groups \
            with the according gid
            sid (list or str): A list of local user groups \
            with the according sid

        Returns:
            list: List of dictionary objects describing local user groups

        """
        endpoint = "/v1/local_groups"
        key = "local_groups"
        max_pages = 50
        request = HttpHelper(self.session)
        params = utility.sanitize_url_params(kwargs)
        response = request.get_paginated(endpoint, key,
                                         max_pages, params=params)
        return response
    def list_all(self, pages, **kwargs):
        """Returns a list of all events.


        Default filter returns ALL events.  This is a very verbose \
        and time-consuming operation.

        Args:
            pages (int): Max number of pages (of ten items each) to retrieve

        Keyword Args:
            group_id (list or str): A list or comma-separated string \
            containing the group IDs to retrieve events for.
            server_id (list or str): A list or comma-separated string \
            containing the server IDs to retrieve events for.
            server_platform (str): (linux | windows)
            critical (bool): Returns only critical or \
            noncritical events.
            type (list or str): A list or comma-separated string containing \
            the event types to query for.  A complete list of event types is \
            available \
            `here: <https://support.cloudpassage.com/entries/23125117-Events\
            #event-types>`_
            since (str): ISO 8601 formatted string representing the starting \
            date and time for query
            until (str): ISO 8601 formatted string representing the ending \
            date and time for query

        Returns:
            list: List of dictionary objects describing servers

        """

        endpoint = "/v1/events"
        key = "events"
        max_pages = pages
        request = HttpHelper(self.session)
        params = utility.sanitize_url_params(kwargs)
        response = request.get_paginated(endpoint, key, max_pages,
                                         params=params)
        return response