Building blocks¶
This page provides an overview of the building blocks for creating your custom templates. See Templating - Jinja2 for details on how the variables can be included in the templates.
This is so far valid for the report.tex.j2
and sow.tex.j2
templates.
Variables¶
c
: The VersionConfig object for the current version of the project.config
: The full Config object (most of the time, you should usec
instead).version
: The version of the project.project_path
: Path object to the project directory.
VersionConfig variables¶
The attributes of the c
object are also accessible directly. Primarily, the c
object is used for invoking methods.
id
: The ID of the project.name
: The name of the project.version_description
: The description of the version (e.g. "retest").targets
: List of targets.dates
: List of dates.people
: List of people.
Methods for the c
object¶
The following methods can be invoked from the c
object.
Example usage:
c.filter_targets(category=["dast", "sast"], name="^foo")]
c.filter_dates(type="pentest_ongoing", start="01-Jan-2024", end="31-Jan-2024")
c.filter_people(type="author", email="@foo.bar$")
sereto.models.config.VersionConfig.filter_targets(category=None, name=None, inverse=False)
¶
Filter targets based on specified criteria.
The regular expressions support the syntax of Python's re
module.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
category
|
str | Iterable[str] | None
|
The category of the target. Can be a single category, a list of categories, or None. |
None
|
name
|
str | None
|
Regular expression to match the name of the target. |
None
|
inverse
|
bool
|
If True, return the inverse of the usual results. |
False
|
Returns:
Type | Description |
---|---|
list[Target]
|
A list of targets matching the criteria. |
Source code in sereto/models/config.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
sereto.models.config.VersionConfig.filter_dates(type=None, start=None, end=None, inverse=False)
¶
Filter dates based on specified criteria.
The start and end dates are inclusive. For date ranges, a date is considered matching if it completely overlaps with the specified range.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type
|
str | DateType | Iterable[str] | Iterable[DateType] | None
|
The type of the date. Can be a single type, a list of types, or None. |
None
|
start
|
str | SeretoDate | None
|
Only dates on or after this date will be included. |
None
|
end
|
str | SeretoDate | None
|
Only dates on or before this date will be included. |
None
|
inverse
|
bool
|
If True, return the inverse of the usual results. |
False
|
Returns:
Type | Description |
---|---|
list[Date]
|
A list of dates matching the criteria. |
Source code in sereto/models/config.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
sereto.models.config.VersionConfig.filter_people(type=None, name=None, business_unit=None, email=None, role=None, inverse=False)
¶
Filter people based on specified criteria.
The regular expressions support the syntax of Python's re
module.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type
|
str | PersonType | Iterable[str] | Iterable[PersonType] | None
|
The type of the person. Can be a single type, a list of types, or None. |
None
|
name
|
str | None
|
Regular expression to match the name of the person. |
None
|
business_unit
|
str | None
|
Regular expression to match the business unit of the person. |
None
|
email
|
str | None
|
Regular expression to match the email of the person. |
None
|
role
|
str | None
|
Regular expression to match the role of the person. |
None
|
inverse
|
bool
|
If True, return the inverse of the usual results. |
False
|
Returns:
Type | Description |
---|---|
list[Person]
|
A list of people matching the criteria. |
Source code in sereto/models/config.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|