Skip to content

Commit

Permalink
Added RichText objects for all fields with a WYSIWYG (Closes #241)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismaddalena committed Oct 14, 2022
1 parent 82c9dd5 commit 5011c97
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ghostwriter/modules/linting_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"codename": "KABLE-01",
"timezone": "America/Los_Angeles",
"note": "<p>This is an assessment for Kabletown but targets NBC assets. The goal is to answer specific questions prior to Kabletown absorbing NBC.</p>",
"note_rt": "",
"slack_channel": "#ghostwriter",
"complete": False,
"start_time": "09:00:00",
Expand All @@ -33,6 +34,7 @@
"email": "[email protected]",
"phone": "(212) 664-4444",
"note": '<p>A self-described "family man," Vietnam veteran, and head of Kabletown. He always seems happy on the surface (laughing incessantly), while directing thinly-veiled insults and threats to subordinates. Handle with care.</p>',
"note_rt": "",
},
{
"name": "John Francis Donaghy",
Expand All @@ -41,12 +43,16 @@
"email": "[email protected]",
"phone": "(212) 664-4444",
"note": '<p>Prefers to go by "Jack."</p>',
"note_rt": "",
},
],
"name": "Kabletown, Inc.",
"short_name": "KTOWN",
"codename": "Totally Not Comcast",
"note": "<p>Philadelphia-based cable company Kabletown, a fictionalized depiction of the acquisition of NBC Universal by Comcast.</p>",
"note_rt": "",
"address": "30 Rockefeller Plaza New York City, New York 10112",
"address_rt": "",
},
"team": [
{
Expand All @@ -58,6 +64,7 @@
"timezone": "America/Los_Angeles",
"phone": "(212) 664-4444",
"note": "<p>Benny will lead the assessment for the full duration.</p>",
"note_rt": "",
},
{
"role": "Assessment Oversight",
Expand All @@ -68,6 +75,7 @@
"timezone": "America/Los_Angeles",
"phone": "(212) 664-4444",
"note": "<p>Christopher will provide oversight and assistance (as needed).</p>",
"note_rt": "",
},
],
"objectives": [
Expand Down Expand Up @@ -213,6 +221,7 @@
}
],
"note": "<p>Domain for the first phishing campaign</p>",
"note_rt": "",
},
{
"activity": "Command and Control",
Expand All @@ -228,6 +237,7 @@
}
],
"note": "<p>Domain for long-haul C2 comms</p>",
"note_rt": "",
},
{
"activity": "Command and Control",
Expand All @@ -243,6 +253,7 @@
}
],
"note": "<p>Domain for the short-haul C2 comms (phishing)</p>",
"note_rt": "",
},
],
"servers": [
Expand All @@ -258,6 +269,7 @@
{"domain": "ghostwriter.wiki", "endpoint": "", "subdomain": "www"}
],
"note": "<p>Long-haul C2 server</p>",
"note_rt": "",
},
{
"name": "CC-02",
Expand All @@ -275,6 +287,7 @@
}
],
"note": "<p>Short-haul C2 server for phishing</p>",
"note_rt": "",
},
],
"cloud": [
Expand All @@ -286,6 +299,7 @@
"ip_address": "30.49.38.30",
"name": "SMTP01",
"note": "<p>SMTP server for phishing emails; running Gophish</p>",
"note_rt": "",
}
],
},
Expand Down
30 changes: 30 additions & 0 deletions ghostwriter/modules/reportwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,29 @@ def render_subdocument(section, finding):
)
finding["references_rt"] = render_subdocument(finding["references"], finding)

# Client Notes
context["client"]["note_rt"] = render_subdocument(context["client"]["note"], finding=None)
context["client"]["address_rt"] = render_subdocument(context["client"]["address"], finding=None)

# Project Notes
context["project"]["note_rt"] = render_subdocument(context["project"]["note"], finding=None)

# Assignments
for assignment in context["team"]:
if isinstance(assignment, dict):
if assignment["note"]:
assignment["note_rt"] = render_subdocument(
assignment["note"], finding=None
)

# Contacts
for contact in context["client"]["contacts"]:
if isinstance(contact, dict):
if contact["note"]:
contact["note_rt"] = render_subdocument(
contact["note"], finding=None
)

# Objectives
for objective in context["objectives"]:
if isinstance(objective, dict):
Expand Down Expand Up @@ -1730,6 +1753,13 @@ def render_subdocument(section, finding):
if card["description"]:
card["description_rt"] = render_subdocument(card["description"], finding=None)

# Infrastructure
for asset_type in context["infrastructure"]:
for asset in context["infrastructure"][asset_type]:
if isinstance(asset, dict):
if asset["note"]:
asset["note_rt"] = render_subdocument(asset["note"], finding=None)

return context

def process_text_xlsx(self, html, text_format, finding):
Expand Down

0 comments on commit 5011c97

Please sign in to comment.