Jinja and Runbooks/Procedures
The following is the raw Jinja code from our implementation of Runbook/Engagement into Report calling of Procedures and Engagement statistics.

Report Procedures

1
{%p for procedure in REPORT_INFO.REPORT_PROCEDURES %}
2
{{ procedure.name }}
3
4
Description:
5
{{p procedure.description }}
6
7
{%p if 'reportedBy' in procedure %}
8
Reporters:
9
{%p for reporter in procedure.reportedBy %}
10
{{ reporter.name }}
11
{%p endfor %}
12
{%p endif %}
13
14
{%p if 'outcomeRed' in procedure %}
15
Outcome red:
16
{{ procedure.outcomeRed }}
17
{%p endif %}
18
19
{%p if 'outcomeBlue' in procedure %}
20
Outcome blue:
21
{{ procedure.outcomeBlue }}
22
{%p endif %}
23
24
{%p if 'customFields' in procedure %}
25
{%p for field in procedure.customFields %}
26
{{ field.label }}
27
{{p field.text }}
28
{%p endfor %}
29
{%p endif %}
30
31
{%p if procedure.exhibits %}
32
Exhibits:
33
{%p for exhibit in procedure.exhibits %}
34
{%p if exhibit.caption %}
35
{{ exhibit.caption }}
36
{%p endif %}
37
{%p if exhibit.path %}
38
{{ exhibit.path }}
39
{%p endif %}
40
{%p endfor %}
41
{%p endif %}
42
43
{%p endfor %}
Copied!

Runbooks Appendix

Tested Tactics

1
{%p for key, tactic in REPORT_INFO.RUNBOOKS_APPENDIX.get('tactics').items()%}
2
3
{{ tactic.name }}
4
Short name: {{ tactic.shortName }}
5
6
{%p if 'description' in tactic and tactic.description %}
7
{{p tactic.description }}
8
{%p endif %}
9
10
Success/Failure/Coverage Criteria:
11
{%p if 'total_detections' in tactic and tactic.total_detections %}
12
Total detections: {{ tactic.total_detections }}
13
{%p endif %}
14
15
{%p if 'total_failures' in tactic and tactic.total_failures %}
16
Total failures: {{ tactic.total_failures }}
17
{%p endif %}
18
19
{%p if 'total_incomplete_attacks' in tactic and tactic.total_incomplete_attacks %}
20
Total incomplete attacks: {{ tactic.total_incomplete_attacks }}
21
{%p endif %}
22
23
{%p if 'total_incomplete_detects' in tactic and tactic.total_incomplete_detects %}
24
Total incomplete detections: {{ tactic.total_incomplete_detects }}
25
{%p endif %}
26
27
{%p if 'total_failed_detections' in tactic and tactic.total_failed_detections %}
28
Total failed detections: {{ tactic.total_failed_detections }}
29
{%p endif %}
30
31
{%p if 'total_successes' in tactic and tactic.total_successes %}
32
Total successes: {{ tactic.total_successes }}
33
{%p endif %}
34
35
{%p if 'total_tests' in tactic and tactic.total_tests %}
36
Total tests executed: {{ tactic.total_tests }}
37
{%p endif %}
38
39
{%p endfor %}
Copied!

Tested Techniques

1
{%p for key, technique in REPORT_INFO.RUNBOOKS_APPENDIX.get('techniques').items()%}
2
3
{{ technique.name }}
4
Short name: {{ technique.shortName }}
5
6
{%p if 'description' in technique and technique.description %}
7
{{p technique.description }}
8
{%p endif %}
9
10
Success/Failure/Coverage Criteria:
11
{%p if 'total_detections' in technique and technique.total_detections %}
12
Total detections: {{ technique.total_detections }}
13
{%p endif %}
14
15
{%p if 'total_failures' in technique and technique.total_failures %}
16
Total failures: {{ technique.total_failures }}
17
{%p endif %}
18
19
{%p if 'total_incomplete_attacks' in technique and technique.total_incomplete_attacks %}
20
Total incomplete attacks: {{ technique.total_incomplete_attacks }}
21
{%p endif %}
22
23
{%p if 'total_incomplete_detects' in technique and technique.total_incomplete_detects %}
24
Total incomplete detections: {{ technique.total_incomplete_detects }}
25
{%p endif %}
26
27
{%p if 'total_failed_detections' in technique and technique.total_failed_detections %}
28
Total failed detections: {{ technique.total_failed_detections }}
29
{%p endif %}
30
31
{%p if 'total_successes' in technique and technique.total_successes %}
32
Total successes: {{ technique.total_successes }}
33
{%p endif %}
34
35
{%p if 'total_tests' in technique and technique.total_tests %}
36
Total tests executed: {{ technique.total_tests }}
37
{%p endif %}
38
39
{%p endfor %}
Copied!

Runbooks Statistics

1
{%p for stat in REPORT_INFO.RUNBOOKS_STATISTICS %}
2
{%p if stat.label != '' %}
3
{{ stat.label }}: {{ stat.value }}
4
{%p endif %}
5
{%p endfor %}
Copied!
Last modified 4mo ago