Risks
sereto.models.risks
¶
Risk
¶
Bases: SeretoBaseModel
Represents a risk with a name, count, and color.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the risk. |
cnt |
NonNegativeInt
|
How many findings share the same risk level. |
color |
str
|
The color associated with the risk. |
Source code in sereto/models/risks.py
8 9 10 11 12 13 14 15 16 17 18 19 |
|
Risks
¶
Bases: SeretoBaseModel
A class representing the full spectre of risk severity levels.
This class contains Risk objects representing different severity levels of risks. It provides methods to retrieve the names, counters, and colors of the risks, as well as a method to set the count of each risk.
Attributes:
Name | Type | Description |
---|---|---|
critical |
Risk
|
A Risk object representing the critical severity level. |
high |
Risk
|
A Risk object representing the high severity level. |
medium |
Risk
|
A Risk object representing the medium severity level. |
low |
Risk
|
A Risk object representing the low severity level. |
info |
Risk
|
A Risk object representing the info severity level. |
Source code in sereto/models/risks.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 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 72 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 |
|
colors()
¶
Return a tuple of the colors for each severity level.
The risk colors are sorted by severity, from the most severe ones to the least severe.
Returns:
Type | Description |
---|---|
tuple[str, ...]
|
A tuple containing the colors of the Risk objects. |
Source code in sereto/models/risks.py
69 70 71 72 73 74 75 76 77 |
|
counts()
¶
Return a tuple of the counters for each severity level.
The counters are sorted from the most severe risks to the least severe.
Returns:
Type | Description |
---|---|
tuple[int, ...]
|
A tuple of per risk counters for each severity level. |
Source code in sereto/models/risks.py
59 60 61 62 63 64 65 66 67 |
|
names()
¶
Return a tuple of the names for each severity.
The risk names are sorted from the most severe ones to the least severe.
Returns:
Type | Description |
---|---|
tuple[str, ...]
|
A tuple containing the names of all the Risk objects. |
Source code in sereto/models/risks.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
set_counts(critical, high, medium, low, info)
¶
Set the count of each Risk object in the Risks object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
critical
|
NonNegativeInt
|
An integer representing the count of the critical Risk object. |
required |
high
|
NonNegativeInt
|
An integer representing the count of the high Risk object. |
required |
medium
|
NonNegativeInt
|
An integer representing the count of the medium Risk object. |
required |
low
|
NonNegativeInt
|
An integer representing the count of the low Risk object. |
required |
info
|
NonNegativeInt
|
An integer representing the count of the info Risk object. |
required |
Returns:
Type | Description |
---|---|
Self
|
The Risks object with updated counts for each Risk object. |
Source code in sereto/models/risks.py
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 |
|