Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand PPTX Content #372

Merged
merged 6 commits into from
Dec 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added functions to keep PPTX generation DRY
chrismaddalena committed Dec 14, 2023
commit a3b5fb26dee69dd09c991ffecd64254443ab0813
14 changes: 14 additions & 0 deletions ghostwriter/modules/reportwriter.py
Original file line number Diff line number Diff line change
@@ -1926,6 +1926,20 @@ def get_textframe(shape):
text_frame.auto_size = MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE
return text_frame

def write_bullet(text_frame, text, level):
"""Write a bullet to the provided text frame at the specified level."""
p = text_frame.add_paragraph()
p.text = text
p.level = level

def write_objective_list(text_frame, objectives):
"""Write a list of objectives to the provided text frame."""
for obj in objectives:
status = obj["status"]
if obj["complete"]:
status = "Achieved"
write_bullet(text_frame, f"{obj['objective']}{status}", 1)

# Calculate finding stats
for finding in self.report_json["findings"]:
findings_stats[finding["severity"]] = 0