class ServiceDelta(odm.Model):
    accepts = odm.Optional(odm.Keyword(), store=True)
    rejects = odm.Optional(odm.Keyword(), store=True)

    category = odm.Optional(odm.Keyword(), store=True, copyto="__text__")
    config = odm.Optional(odm.Mapping(odm.Any()), index=False)
    description = odm.Optional(odm.Text(), store=True, copyto="__text__")
    default_result_classification = odm.Optional(odm.ClassificationString())
    enabled = odm.Optional(odm.Boolean(), store=True)
    is_external = odm.Optional(odm.Boolean())
    licence_count = odm.Optional(odm.Integer())

    name = odm.Optional(odm.Keyword(), store=True, copyto="__text__")
    version = odm.Keyword(store=True)

    disable_cache = odm.Optional(odm.Boolean())

    stage = odm.Optional(odm.Keyword(), store=True, copyto="__text__")
    submission_params = odm.Optional(odm.List(
        odm.Compound(SubmissionParamsDelta)),
                                     index=False)
    timeout = odm.Optional(odm.Integer())

    docker_config: DockerConfigDelta = odm.Optional(
        odm.Compound(DockerConfigDelta))
    dependencies: DependencyConfigDelta = odm.Mapping(
        odm.Compound(DependencyConfigDelta), default={})

    update_channel = odm.Optional(
        odm.Enum(values=["stable", "rc", "beta", "dev"]))
    update_config: UpdateConfigDelta = odm.Optional(
        odm.Compound(UpdateConfigDelta))
Exemplo n.º 2
0
class Service(odm.Model):
    # Regexes applied to assemblyline style file type string
    accepts = odm.Keyword(store=True, default=DEFAULT_SERVICE_ACCEPTS)
    rejects = odm.Optional(
        odm.Keyword(store=True, default=DEFAULT_SERVICE_REJECTS))

    category = odm.Keyword(store=True,
                           default="Static Analysis",
                           copyto="__text__")
    config = odm.Mapping(odm.Any(), default={}, index=False, store=False)
    description = odm.Text(store=True, default="NA", copyto="__text__")
    default_result_classification = odm.ClassificationString(
        default=Classification.UNRESTRICTED)
    enabled = odm.Boolean(store=True, default=False)
    is_external = odm.Boolean(default=False)
    licence_count = odm.Integer(default=0)

    name = odm.Keyword(store=True, copyto="__text__")
    version = odm.Keyword(store=True)

    # Should the result cache be disabled for this service
    disable_cache = odm.Boolean(default=False)

    stage = odm.Keyword(store=True, default="CORE", copyto="__text__")
    submission_params: SubmissionParams = odm.List(
        odm.Compound(SubmissionParams), index=False, default=[])
    timeout = odm.Integer(default=60)

    docker_config: DockerConfig = odm.Compound(DockerConfig)
    dependencies = odm.Mapping(odm.Compound(DependencyConfig), default={})

    update_channel: str = odm.Enum(values=["stable", "rc", "beta", "dev"],
                                   default='stable')
    update_config: UpdateConfig = odm.Optional(odm.Compound(UpdateConfig))
Exemplo n.º 3
0
class Service(odm.Model):
    # Regexes applied to assemblyline style file type string
    accepts = odm.Keyword(
        store=True,
        default=DEFAULT_SERVICE_ACCEPTS,
        description="Regex to accept files as identified by Assemblyline")
    rejects = odm.Optional(
        odm.Keyword(store=True, default=DEFAULT_SERVICE_REJECTS),
        description="Regex to reject files as identified by Assemblyline")

    category = odm.Keyword(
        store=True,
        default="Static Analysis",
        copyto="__text__",
        description="Which category does this service belong to?")
    config = odm.Mapping(odm.Any(),
                         default={},
                         index=False,
                         store=False,
                         description="Service Configuration")
    description = odm.Text(store=True,
                           default="NA",
                           copyto="__text__",
                           description="Description of service")
    default_result_classification = odm.ClassificationString(
        default=Classification.UNRESTRICTED,
        description="Default classification assigned to service results")
    enabled: bool = odm.Boolean(
        store=True,
        default=False,
        description="Is the service enabled (by default)?")
    is_external: bool = odm.Boolean(
        default=False,
        description=
        "Does this service perform analysis outside of Assemblyline?")
    licence_count: int = odm.Integer(
        default=0,
        description="How many licences is the service allowed to use?")
    max_queue_length: int = odm.Integer(
        default=0,
        description=
        "If more than this many jobs are queued for this service drop those over this limit. 0 is unlimited."
    )

    uses_tags: bool = odm.Boolean(
        default=False,
        description=
        "Does this service use tags from other services for analysis?")
    uses_temp_submission_data: bool = odm.Boolean(
        default=False,
        description=
        "Does this service use temp data from other services for analysis?")
    uses_metadata: bool = odm.Boolean(
        default=False,
        description="Does this service use submission metadata for analysis?")

    name: str = odm.Keyword(store=True,
                            copyto="__text__",
                            description="Name of service")
    version = odm.Keyword(store=True, description="Version of service")

    privileged = odm.Boolean(
        default=False,
        description=
        "Should the service be able to talk to core infrastructure or just service-server for tasking?"
    )
    disable_cache = odm.Boolean(
        default=False,
        description="Should the result cache be disabled for this service?")

    stage = odm.Keyword(
        store=True,
        default="CORE",
        copyto="__text__",
        description="Which execution stage does this service run in?")
    submission_params: SubmissionParams = odm.List(
        odm.Compound(SubmissionParams),
        index=False,
        default=[],
        description="Submission parameters of service")
    timeout: int = odm.Integer(default=60,
                               description="Service task timeout, in seconds")

    docker_config: DockerConfig = odm.Compound(
        DockerConfig, description="Docker configuration for service")
    dependencies: dict[str, DependencyConfig] = odm.Mapping(
        odm.Compound(DependencyConfig),
        default={},
        description="Dependency configuration for service")

    update_channel: str = odm.Enum(
        values=["stable", "rc", "beta", "dev"],
        default='stable',
        description="What channel to watch for service updates?")
    update_config: UpdateConfig = odm.Optional(
        odm.Compound(UpdateConfig),
        description="Update configuration for fetching external resources")
Exemplo n.º 4
0
class ServiceDelta(odm.Model):
    accepts = odm.Optional(
        odm.Keyword(),
        store=True,
        description="Refer to:<br>[Service](../service/#service)")
    rejects = odm.Optional(
        odm.Keyword(),
        store=True,
        description="Refer to:<br>[Service](../service/#service)")

    category = odm.Optional(
        odm.Keyword(),
        store=True,
        copyto="__text__",
        description="Refer to:<br>[Service](../service/#service)")
    config = odm.Optional(
        odm.Mapping(odm.Any()),
        index=False,
        description="Refer to:<br>[Service](../service/#service)")
    description = odm.Optional(
        odm.Text(),
        store=True,
        copyto="__text__",
        description="Refer to:<br>[Service](../service/#service)")
    default_result_classification = odm.Optional(
        odm.ClassificationString(),
        description="Refer to:<br>[Service](../service/#service)")
    enabled = odm.Optional(
        odm.Boolean(),
        store=True,
        description="Refer to:<br>[Service](../service/#service)")
    is_external = odm.Optional(
        odm.Boolean(),
        description="Refer to:<br>[Service](../service/#service)")
    licence_count = odm.Optional(
        odm.Integer(),
        description="Refer to:<br>[Service](../service/#service)")
    max_queue_length = odm.Optional(
        odm.Integer(),
        description="Refer to:<br>[Service](../service/#service)")

    uses_tags: bool = odm.Optional(
        odm.Boolean(),
        description="Refer to:<br>[Service](../service/#service)")
    uses_temp_submission_data: bool = odm.Optional(
        odm.Boolean(),
        description="Refer to:<br>[Service](../service/#service)")
    uses_metadata: bool = odm.Optional(
        odm.Boolean(),
        description="Refer to:<br>[Service](../service/#service)")

    name = odm.Optional(
        odm.Keyword(),
        store=True,
        copyto="__text__",
        description="Refer to:<br>[Service](../service/#service)")
    version = odm.Keyword(
        store=True, description="Refer to:<br>[Service](../service/#service)")

    privileged = odm.Optional(
        odm.Boolean(),
        description="Refer to:<br>[Service](../service/#service)")
    disable_cache = odm.Optional(
        odm.Boolean(),
        description="Refer to:<br>[Service](../service/#service)")

    stage = odm.Optional(
        odm.Keyword(),
        store=True,
        copyto="__text__",
        description="Refer to:<br>[Service](../service/#service)")
    submission_params = odm.Optional(
        odm.List(odm.Compound(SubmissionParamsDelta)),
        index=False,
        description="Refer to:<br>[Service](../service/#service)")
    timeout = odm.Optional(
        odm.Integer(),
        description="Refer to:<br>[Service](../service/#service)")

    docker_config: DockerConfigDelta = odm.Optional(
        odm.Compound(DockerConfigDelta),
        description="Refer to:<br>[Service](../service/#service)")
    dependencies: DependencyConfigDelta = odm.Mapping(
        odm.Compound(DependencyConfigDelta),
        default={},
        description="Refer to:<br>[Service](../service/#service)")

    update_channel = odm.Optional(
        odm.Enum(values=["stable", "rc", "beta", "dev"]),
        description="Refer to:<br>[Service](../service/#service)")
    update_config: UpdateConfigDelta = odm.Optional(
        odm.Compound(UpdateConfigDelta),
        description="Refer to:<br>[Service](../service/#service)")