Commit bd077b62 authored by Johan Bloemberg's avatar Johan Bloemberg

reference instead of duplicate

parent f43b6a9f
Pipeline #16264482 passed with stages
in 7 minutes and 3 seconds
......@@ -23,35 +23,10 @@ def compose_task(
urls_filter: dict = dict(),
endpoints_filter: dict = dict(),
) -> Task:
"""Compose taskset to scan specified endpoints.
"""Compose taskset to rebuild specified organizations/urls.
:param organizations_filter: dict: limit organizations to scan to these filters, see below
:param urls_filter: dict: limit urls to scan to these filters, see below
:param endpoints_filter: dict: limit endpoints to scan to these filters, see below
Depending on the type of scanner (endpoint, domain level, etc) a list of scanable
items will be generated and a taskset will be composed to allow scanning of these items.
By default all elegible items will be scanned. Which means a complete scan of everything possible
with this scanner.
By specifying filters the list of items to scan can be reduced. These filters are passed to
Django QuerySet filters on the respective models.
For example, to scan all urls/endpoints for one organization named 'example' run:
>>> task = compose_task(organizations={'name__iexact': 'example'})
>>> result = task.apply_async()
>>> print(result.get())
(`name__iexact` matches the name case-insensitive)
Multiple filters can be applied, to scan only port 80 for organizations added today run:
>>> task = compose_task(
... organizations={'date_added__day': datetime.datetime.today().day},
... endpoints={'port': 80}
... )
*This is an implementation of `compose_task`. For more documentation about this concept, arguments and concrete
examples of usage refer to `compose_task` in `types.py`.*
"""
......
......@@ -32,33 +32,8 @@ def compose_task(
) -> Task:
"""Compose taskset to scan specified endpoints.
:param organizations_filter: dict: limit organizations to scan to these filters, see below
:param urls_filter: dict: limit urls to scan to these filters, see below
:param endpoints_filter: dict: limit endpoints to scan to these filters, see below
Depending on the type of scanner (endpoint, domain level, etc) a list of scanable
items will be generated and a taskset will be composed to allow scanning of these items.
By default all elegible items will be scanned. Which means a complete scan of everything possible
with this scanner.
By specifying filters the list of items to scan can be reduced. These filters are passed to
Django QuerySet filters on the respective models.
For example, to scan all urls/endpoints for one organization named 'example' run:
>>> task = compose_task(organizations={'name__iexact': 'example'})
>>> result = task.apply_async()
>>> print(result.get())
(`name__iexact` matches the name case-insensitive)
Multiple filters can be applied, to scan only port 80 for organizations added today run:
>>> task = compose_task(
... organizations={'date_added__day': datetime.datetime.today().day},
... endpoints={'port': 80}
... )
*This is an implementation of `compose_task`. For more documentation about this concept, arguments and concrete
examples of usage refer to `compose_task` in `types.py`.*
"""
......
......@@ -27,33 +27,8 @@ def compose_task(
) -> Task:
"""Compose taskset to scan specified endpoints.
:param organizations_filter: dict: limit organizations to scan to these filters, see below
:param urls_filter: dict: limit urls to scan to these filters, see below
:param endpoints_filter: dict: limit endpoints to scan to these filters, see below
Depending on the type of scanner (endpoint, domain level, etc) a list of scanable
items will be generated and a taskset will be composed to allow scanning of these items.
By default all elegible items will be scanned. Which means a complete scan of everything possible
with this scanner.
By specifying filters the list of items to scan can be reduced. These filters are passed to
Django QuerySet filters on the respective models.
For example, to scan all urls/endpoints for one organization named 'example' run:
>>> task = compose_task(organizations={'name__iexact': 'example'})
>>> result = task.apply_async()
>>> print(result.get())
(`name__iexact` matches the name case-insensitive)
Multiple filters can be applied, to scan only port 80 for organizations added today run:
>>> task = compose_task(
... organizations={'date_added__day': datetime.datetime.today().day},
... endpoints={'port': 80}
... )
*This is an implementation of `compose_task`. For more documentation about this concept, arguments and concrete
examples of usage refer to `compose_task` in `types.py`.*
"""
......
......@@ -27,33 +27,8 @@ def compose_task(
) -> Task:
"""Compose taskset to scan specified endpoints.
:param organizations_filter: dict: limit organizations to scan to these filters, see below
:param urls_filter: dict: limit urls to scan to these filters, see below
:param endpoints_filter: dict: limit endpoints to scan to these filters, see below
Depending on the type of scanner (endpoint, domain level, etc) a list of scanable
items will be generated and a taskset will be composed to allow scanning of these items.
By default all elegible items will be scanned. Which means a complete scan of everything possible
with this scanner.
By specifying filters the list of items to scan can be reduced. These filters are passed to
Django QuerySet filters on the respective models.
For example, to scan all urls/endpoints for one organization named 'example' run:
>>> task = compose_task(organizations={'name__iexact': 'example'})
>>> result = task.apply_async()
>>> print(result.get())
(`name__iexact` matches the name case-insensitive)
Multiple filters can be applied, to scan only port 80 for organizations added today run:
>>> task = compose_task(
... organizations={'date_added__day': datetime.datetime.today().day},
... endpoints={'port': 80}
... )
*This is an implementation of `compose_task`. For more documentation about this concept, arguments and concrete
examples of usage refer to `compose_task` in `types.py`.*
"""
......
......@@ -51,33 +51,8 @@ def compose_task(
) -> Task:
"""Compose taskset to scan specified endpoints.
:param organizations_filter: dict: limit organizations to scan to these filters, see below
:param urls_filter: dict: limit urls to scan to these filters, see below
:param endpoints_filter: dict: limit endpoints to scan to these filters, see below
Depending on the type of scanner (endpoint, domain level, etc) a list of scanable
items will be generated and a taskset will be composed to allow scanning of these items.
By default all elegible items will be scanned. Which means a complete scan of everything possible
with this scanner.
By specifying filters the list of items to scan can be reduced. These filters are passed to
Django QuerySet filters on the respective models.
For example, to scan all urls/endpoints for one organization named 'example' run:
>>> task = compose_task(organizations={'name__iexact': 'example'})
>>> result = task.apply_async()
>>> print(result.get())
(`name__iexact` matches the name case-insensitive)
Multiple filters can be applied, to scan only port 80 for organizations added today run:
>>> task = compose_task(
... organizations={'date_added__day': datetime.datetime.today().day},
... endpoints={'port': 80}
... )
*This is an implementation of `compose_task`. For more documentation about this concept, arguments and concrete
examples of usage refer to `compose_task` in `types.py`.*
"""
......
......@@ -14,6 +14,9 @@ def compose_task(
:param urls_filter: dict: limit urls to these filters, see below
:param endpoints_filter: dict: limit endpoints to these filters, see below
*This is an abstract of the `compose_task` function which is used throughout this codebase, search for
`compose_task` to find implementations which can be used as example.*
Composition of a task is building a task from primitives (task, group, chain) and other composed tasks in order
to create a 'collection' of work that as a whole can be scheduled for execution in the task processing system.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment