How to build a Template¶
We use Jinja2 to create Report Templates. Here are listed the main variables available when creating a Template.
General Variables¶
These are the variables loaded when creating a report
-
date - the date when the Report was created, as the name of the month and four digits for the year
-
title
-
enterprise
-
summary
-
conclusions
-
recommendations
-
scope
-
objectives
workspace.scope- a list containing the different scopes of the workspace.workspace- a dictionary with all workspace information.namedescriptionidduration.start_dateduration.end_dateusersupdate_datestats.total_vulnsstats.std_vulnsstats.web_vulnsstats.code_vulnsstats.hostsstats.servicesstats.credentialspublicreadonlyactivecreate_date_id
Date Format
start_date and end_date are displayed in timestamp format. If you want to change their format, you can use datetimeformat() function and pass the desired format as parameter. E.g.:
workspace.duration.start_date|datetimeformat('%m-%d-%Y')
workspace.duration.end_date|datetimeformat('%B %Y')
hosts_amount- an int containing the amount of hosts in the Workspacehosts- a dictionary with all the hosts in the Workspacetypedescriptiondefault_gatewayipownedtagsnameservicesversionsmachostnamesvulnsownercredentialsservice_summariesidosmetadata
services_amount- an int containing the amount of services in the Workspaceservices- a dictionary with all the services in the Workspacestatusprotocoldescriptionparenttagsvulnsmetadataownedsummaryportownerversionhost_ididcredentialstypeportsname
counter_severity- a dictionary with all the severities and the amount of vulns for each one vulnerability pie chartsvulns_amount- an int containing the amount of vulnerabilities in the Workspace except for vulns with severity unclassified, which are not includedvulns- a dictionary with all the vulnerabilities in the Workspace except for vulns with severity unclassified, which are not includedupdate_userparent_typeownedowneridimpactconfirmedseverityservicedatapolicyviolationsevidence_subdoctyperefsmetadatastatusissuetrackerdescriptionparenttagseaseofresolutionhostnamesdatahost_osdescnameobj_idtargetresolutionseverity_numbersmethodparamswebsitequerypathrequestresponse
Grouped reports will have an additional field:
- _vulns_grouped_amount - an int containing the total amount of vulnerabilities after grouping
Custom Fields in Executive Report¶
You can access your Custom Attributes on the docx templates like a dictionary and by the field name:
vuln.custom_fields["cvss"]
Jinja2 Context¶
For more technical information, here is the Jinja2 context, where you can find all the DataTypes and structures implemented with Jinja.
Template Examples¶
Here are some basic templates.