Skip to content

Commit

Permalink
Don't modify in place - seperate keys "message_string" and "message"
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyamalviya committed Jan 30, 2021
1 parent 21781d5 commit 1c50b94
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def get_message_and_status(cls, status):
:param status: Enum from common/attack_utils.py integer value
:return: Dict with message and status
"""
return {'message': cls.get_message_by_status(status), 'status': status}
return {'message_string': cls.get_message_by_status(status), 'status': status}

@classmethod
def get_message_by_status(cls, status):
Expand Down Expand Up @@ -112,14 +112,14 @@ def technique_title(cls):
def get_tech_base_data(cls):
"""
Gathers basic attack technique data into a dict.
:return: dict E.g. {'message': 'Brute force used', 'status': 2, 'title': 'T1110 Brute force'}
:return: dict E.g. {'message_string': 'Brute force used', 'status': 2, 'title': 'T1110 Brute force'}
"""
data = {}
status = cls.technique_status()
title = cls.technique_title()
data.update({'status': status,
'title': title,
'message': cls.get_message_by_status(status)})
'message_string': cls.get_message_by_status(status)})
data.update(cls.get_mitigation_by_status(status))
return data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,9 @@ class AttackReport extends React.Component {
}
}
}
// modify techniques' messages
// compiles techniques' message string from markdown to HTML
for (const tech_id in techniques){
if (typeof techniques[tech_id]['message'] === 'string') {
techniques[tech_id]['message'] = <div dangerouslySetInnerHTML={{__html: marked(techniques[tech_id]['message'])}} />;
}
techniques[tech_id]['message'] = <div dangerouslySetInnerHTML={{__html: marked(techniques[tech_id]['message_string'])}} />;
}

return techniques
Expand Down

0 comments on commit 1c50b94

Please sign in to comment.