Customizing Reports

Customizing how your Office reports are formatted

Customizing Report Formatting

The Word and PowerPoint reports are easily customized by editing template documents to change fonts, colors, and table styles. Some modifications will require editing code within ghostwriter/modules/

Customizing Templates

The templates live in ghostwriter/reporting/templates/reports. There are templates for the Word and PowerPoint report formats. Customize the formatting by opening the template files in Microsoft Office and editing the styles.

Customizing Word Styles

Ghostwriter uses Word's Header, Normal, Table, and Caption styles in the template.docx. There are also several custom styles:

  • CodeBlock: Used for formatting blocks of code, terminal output, and other text evidence.

  • Code (Inline): Used for code, one-liners, and other special text inline with other text, i.e. mid-sentence.

  • Ghostwriter Table: The default style used for all tables.

To make changes to Ghostwriter Table you do need to insert a new table to access the list of styles in the ribbon.

Open template.docx and edit the styles by right-clicking the style in the ribbon and choosing the Modify option. Make the desired changes and then save the style.

Save the template! If you do not save the template, the updated style will not be saved.

Customizing PowerPoint Styles

PowerPoint styles are controlled by the slide masters. Open the template.pptx, click the View tab, and then click Slide Master.

Adjust the slide masters as desired and then save the template.

Customizing the Code

In the current version of Ghostwriter, each Office document is built from scratch for more fine grained control. If you wish to rearrange the placement of text or change how text is displayed you will need to review and edit the generate_* functions:

  • generate_word_docx()

  • generate_excel_xlsx()

  • generate_powerpoint_pptx()

Major edits will require a careful review of the code and accompanying comments; however, simpler edits, like changing colors for finding severity, can be tweaked relatively easily.

Tweaking Finding Severity Colors

You may want to change the colors or hues of the severity ratings. Open ghostwriter/modules/ and look at the top of the Reportwriter() class.

Finding Severity Colors
# Color codes used for finding severity
# Blue
informational_color = '8eaadb'
informational_color_hex = [0x83, 0xaa, 0xdb]
# Green
low_color = 'a8d08d'
low_color_hex = [0xa8, 0xd0, 0x8d]
# Orange
medium_color = 'f4b083'
medium_color_hex = [0xf4, 0xb0, 0x83]
# Red
high_color = 'ff7e79'
high_color_hex = [0xff, 0x7e, 0x79]
# Purple
critical_color = '7030a0'
critical_color_hex = [0x70, 0x30, 0xa0]

The different report formats all require the colors to be represented in their hex form. You need to set both a string value and a list value.

The *_color variable must be a string value like 8eaabd (hex without any 0x prefixes).

The *_color_hex variable must be a string value like [0x83, 0xaa, 0xdb] (with the 0x prefixes).