Пример #1
0
# pylint: disable=no-self-argument, no-member

from gvm.protocols.latest import InfoType as GvmInfoType
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='info',
    entities_name='info_list',
    with_details=True,
    info_type=GvmInfoType.DFN_CERT_ADV,
)


class ExportDFNCertAdvisoriesByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(
    entity_name='info',
    entities_name='info_list',
    with_details=True,
    info_type=GvmInfoType.DFN_CERT_ADV,
)
Пример #2
0
        gmp = get_gmp(info)

        resp = gmp.import_report(
            report,
            task_id=str(task_id),
            task_name=str(task_name),
            task_comment=str(task_comment),
            in_assets=in_assets,
        )
        return ImportReport(report_id=resp.get('id'))


# 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='report',
                                                 with_details=True)


class ExportReportsByIds(ExportByIdsClass):
    pass


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


class ExportReportsByFilter(ExportByFilterClass):
    pass
Пример #3
0
        Response
        {
            "data": {
                "deleteHostByFilter": {
                    "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='host')


class ExportHostsByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(entity_name='host')


class ExportHostsByFilter(ExportByFilterClass):
    pass


class ModifyHostInput(graphene.InputObjectType):
    """Input object for modifyHost.
Пример #4
0
        Response
        {
            "data": {
                "deleteFilterByFilter": {
                    "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='filter')


class ExportFiltersByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(entity_name='filter')


class ExportFiltersByFilter(ExportByFilterClass):
    pass


class ModifyFilterInput(graphene.InputObjectType):
    """Input object for modifyFilter.
Пример #5
0
        {
            "data": {
                "deleteOperatingSystemByFilter": {
                    "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='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
Пример #6
0
    policy_id = graphene.UUID(name='id')

    @require_authentication
    def mutate(root, info, policy_id):
        gmp = get_gmp(info)
        elem = gmp.clone_policy(str(policy_id))
        return ClonePolicy(policy_id=elem.get('id'))


# 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

Пример #7
0
            login=login,
            password=password,
            auth_algorithm=auth_algorithm,
            community=community,
            privacy_algorithm=privacy_algorithm,
            privacy_password=privacy_password,
            public_key=public_key,
        )
        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
Пример #8
0
        Response
        {
            "data": {
                "deleteTLSCertificateByFilter": {
                    "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='tls_certificate')


class ExportTLSCertificatesByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(
    entity_name='tls_certificate')


class ExportTLSCertificatesByFilter(ExportByFilterClass):
    pass


class ModifyTLSCertificateInput(graphene.InputObjectType):
Пример #9
0
            comment=comment,
            name=name,
            resource_id=resource_id,
            resource_type=resource_type,
            subject_id=subject_id,
            subject_type=subject_type,
        )

        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')
Пример #10
0
# 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
Пример #11
0
        Response
        {
            "data": {
                "deleteHostByFilter": {
                    "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='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):
Пример #12
0
        Response
        {
            "data": {
                "deleteOperatingSystemByFilter": {
                    "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='operating_system')


class ExportOperatingSystemsByIds(ExportByIdsClass):
    pass


ExportByFilterClass = create_export_by_filter_mutation(
    entity_name='operating_system'
)


class ExportOperatingSystemsByFilter(ExportByFilterClass):
    pass

Пример #13
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
Пример #14
0
    config_id = graphene.UUID(name='id')

    @staticmethod
    @require_authentication
    def mutate(_root, info, config_id):
        gmp = get_gmp(info)
        elem = gmp.clone_scan_config(str(config_id))
        return CloneScanConfig(config_id=elem.get('id'))


# 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