コード例 #1
0
ファイル: mutations.py プロジェクト: timopollmeier/hyperion
from gvm.protocols.next import InfoType as GvmInfoType
from selene.schema.entities import (
    create_export_secinfos_by_ids_mutation,
    create_export_by_filter_mutation,
)


# Explicit classes needed, else we get error
# 'AssertionError: Found different types with the same name in the
#   schema: ExportByIds, ExportByIds.'

ExportByIdsClass = create_export_secinfos_by_ids_mutation(
    info_type=GvmInfoType.CVE,
)


class ExportCVEsByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(
    entity_name='info',
    entities_name='info_list',
    with_details=True,
    info_type=GvmInfoType.CVE,
)


class ExportCVEsByFilter(ExportByFilterClass):
    pass
コード例 #2
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from selene.schema.entities import (
    create_export_by_filter_mutation,
    create_export_by_ids_mutation,
)

# Explicit classes needed, else we get error
# 'AssertionError: Found different types with the same name in the
#   schema: ExportByIds, ExportByIds.'

ExportByIdsClass = create_export_by_ids_mutation(entity_name='result',
                                                 with_details=True)


class ExportResultsByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(entity_name='result',
                                                       with_details=True)


class ExportResultsByFilter(ExportByFilterClass):
    pass
コード例 #3
0
# Modify Roles
ModifyUserRolesClass = create_modify_user_mutation(
    field_to_modify=UserFieldToModifyType.ROLES)


class ModifyUserSetRoles(ModifyUserRolesClass):
    pass


# Modify Groups
ModifyUserGroupsClass = create_modify_user_mutation(
    field_to_modify=UserFieldToModifyType.GROUPS)


class ModifyUserSetGroups(ModifyUserGroupsClass):
    pass


ExportByIdsClass = create_export_by_ids_mutation(entity_name='user')


class ExportUsersByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(entity_name='user')


class ExportUsersByFilter(ExportByFilterClass):
    pass
コード例 #4
0
ファイル: mutations.py プロジェクト: timopollmeier/hyperion
# Explicit classes needed, else we get error
# 'AssertionError: Found different types with the same name in the
#   schema: ExportByIds, ExportByIds.'

ExportByIdsClass = create_export_by_ids_mutation(
    entity_name='asset', asset_type=GvmAssetType.OPERATING_SYSTEM
)


class ExportOperatingSystemsByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(
    entity_name='asset', asset_type=GvmAssetType.OPERATING_SYSTEM
)


class ExportOperatingSystemsByFilter(ExportByFilterClass):
    pass


class ModifyOperatingSystemInput(graphene.InputObjectType):
    """Input object for modifyOperatingSystem.

    Args:
        id (UUID): UUID of the operating system to modify.
        comment (str, optional): The comment on the asset.
    """
コード例 #5
0
ファイル: mutations.py プロジェクト: timopollmeier/hyperion

# Explicit classes needed, else we get error
# 'AssertionError: Found different types with the same name in the
#   schema: ExportByIds, ExportByIds.'

ExportByIdsClass = create_export_by_ids_mutation('policy',
                                                 with_details=True,
                                                 entities_name='policies')


class ExportPoliciesByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(
    'policy', with_details=True, entities_name='policies')


class ExportPoliciesByFilter(ExportByFilterClass):
    pass


class ImportPolicy(graphene.Mutation):
    """Import a policy

    Args:
        policy (str) : Policy XML as string to import. This XML must
            contain a <get_configs_response> root element.

    Example:
コード例 #6
0
ファイル: mutations.py プロジェクト: timopollmeier/hyperion
        )
        return ModifyCredential(ok=True)


# Explicit classes needed, else we get error
# 'AssertionError: Found different types with the same name in the
#   schema: ExportByIds, ExportByIds.'

ExportByIdsClass = create_export_by_ids_mutation(entity_name='credential')


class ExportCredentialsByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(entity_name='credential')


class ExportCredentialsByFilter(ExportByFilterClass):
    pass


# Explicit classes needed, else we get error
# 'AssertionError: Found different types with the same name in the
#   schema: DeleteByIds, DeleteByIds.'


DeleteByIdsClass = create_delete_by_ids_mutation(entity_name='credential')


class DeleteCredentialsByIds(DeleteByIdsClass):
コード例 #7
0
ファイル: mutations.py プロジェクト: bjoernricks/hyperion
        }
    """


# Explicit classes needed, else we get error
# 'AssertionError: Found different types with the same name in the
#   schema: ExportByIds, ExportByIds.'

ExportByIdsClass = create_export_by_ids_mutation(entity_name='tls_certificate')


class ExportTLSCertificatesByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(
    entity_name='tls_certificate')


class ExportTLSCertificatesByFilter(ExportByFilterClass):
    pass


class ModifyTLSCertificateInput(graphene.InputObjectType):
    """Input object for modifyTLSCertificate.

    Args:
        id (UUID): UUID of tls certificate to modify.
        comment (str, optional): The comment on the tls certificate.
    """

    tls_certificate_id = graphene.UUID(
コード例 #8
0
        return ModifyPermission(ok=True)


# Explicit classes needed, else we get error
# 'AssertionError: Found different types with the same name in the
#   schema: ExportByIds, ExportByIds.'

ExportByIdsClass = create_export_by_ids_mutation(entity_name='permission')


class ExportPermissionsByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(
    entity_name='permission', )


class ExportPermissionsByFilter(ExportByFilterClass):
    pass


DeleteByIdsClass = create_delete_by_ids_mutation(entity_name='permission')


class DeletePermissionsByIds(DeleteByIdsClass):
    """Deletes a list of permissions"""


DeleteByFilterClass = create_delete_by_filter_mutation(
    entity_name='permission', )
コード例 #9
0
ファイル: mutations.py プロジェクト: timopollmeier/hyperion
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# pylint: disable=no-self-argument, no-member

from selene.schema.entities import (
    create_export_by_ids_mutation,
    create_export_by_filter_mutation,
)


# Explicit classes needed, else we get error
# 'AssertionError: Found different types with the same name in the
#   schema: ExportByIds, ExportByIds.'

ExportByIdsClass = create_export_by_ids_mutation(
    entity_name='vulnerability', entities_name='vulnerabilities'
)


class ExportVulnerabilitiesByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(
    entity_name='vulnerability', entities_name='vulnerabilities'
)


class ExportVulnerabilitiesByFilter(ExportByFilterClass):
    pass
コード例 #10
0
ファイル: mutations.py プロジェクト: y0urself/hyperion
    """


# Explicit classes needed, else we get error
# 'AssertionError: Found different types with the same name in the
#   schema: ExportByIds, ExportByIds.'

ExportByIdsClass = create_export_by_ids_mutation(entity_name='asset',
                                                 asset_type=GvmAssetType.HOST)


class ExportHostsByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(
    entity_name='asset', asset_type=GvmAssetType.HOST)


class ExportHostsByFilter(ExportByFilterClass):
    pass


class ModifyHostInput(graphene.InputObjectType):
    """Input object for modifyHost.

    Args:
        id (UUID): UUID of host to modify.
        comment (str, optional): The comment on the host.
    """

    host_id = graphene.UUID(required=True,
コード例 #11
0
    """


# Explicit classes needed, else we get error
# 'AssertionError: Found different types with the same name in the
#   schema: ExportByIds, ExportByIds.'

ExportByIdsClass = create_export_by_ids_mutation(entity_name='operating_system')


class ExportOperatingSystemsByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(
    entity_name='operating_system'
)


class ExportOperatingSystemsByFilter(ExportByFilterClass):
    pass


class ModifyOperatingSystemInput(graphene.InputObjectType):
    """Input object for modifyOperatingSystem.

    Args:
        id (UUID): UUID of the operating system to modify.
        comment (str, optional): The comment on the asset.
    """
コード例 #12
0
            }
        }

        Response
        {
            "data": {
                "deleteScheduleByFilter": {
                    "ok": true
                }
            }
        }
    """


# Explicit classes needed, else we get error
# 'AssertionError: Found different types with the same name in the
#   schema: ExportByIds, ExportByIds.'

ExportByIdsClass = create_export_by_ids_mutation(entity_name='schedule')


class ExportSchedulesByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(entity_name='schedule')


class ExportSchedulesByFilter(ExportByFilterClass):
    pass
コード例 #13
0
ファイル: mutations.py プロジェクト: greenbone/hyperion
# Explicit classes needed, else we get error
# 'AssertionError: Found different types with the same name in the
#   schema: ExportByIds, ExportByIds.'

ExportByIdsClass = create_export_by_ids_mutation(
    entity_name='scan_config', with_details=True
)


class ExportScanConfigsByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(
    entity_name='scan_config', with_details=True
)


class ExportScanConfigsByFilter(ExportByFilterClass):
    pass


class ImportScanConfig(graphene.Mutation):
    """Import a scan config

    Args:
        config (str) : Scan Config XML as string to import. This XML must
            contain a <get_configs_response> root element.

    Example: