From 103b1348b71d7bd9a91cdbde6358bc41553e427f Mon Sep 17 00:00:00 2001 From: Shreya Date: Fri, 17 Jul 2020 00:31:46 +0530 Subject: [PATCH] Add hyperlink to configuration page in "disabled" status message in MITRE report --- .../services/attack/technique_reports/__init__.py | 3 ++- .../components/report-components/AttackReport.js | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py b/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py index 3930b07dd..64b6a13f7 100644 --- a/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py +++ b/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py @@ -10,7 +10,8 @@ from monkey_island.cc.services.attack.attack_config import AttackConfig logger = logging.getLogger(__name__) -disabled_msg = "This technique has been disabled. You can enable it from the configuration page." +disabled_msg = "This technique has been disabled. " +\ + "You can enable it from the [configuration page](../../configure)." class AttackTechnique(object, metaclass=abc.ABCMeta): diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/AttackReport.js b/monkey/monkey_island/cc/ui/src/components/report-components/AttackReport.js index f28e25601..97f3c1a18 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/AttackReport.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/AttackReport.js @@ -7,6 +7,7 @@ import {faRadiation} from '@fortawesome/free-solid-svg-icons/faRadiation'; import {faEye} from '@fortawesome/free-solid-svg-icons/faEye'; import {faEyeSlash} from '@fortawesome/free-solid-svg-icons/faEyeSlash'; import {faToggleOff} from '@fortawesome/free-solid-svg-icons/faToggleOff'; +import marked from 'marked'; import ReportHeader, {ReportTypes} from './common/ReportHeader'; import {ScanStatus} from '../attack/techniques/Helpers'; @@ -38,14 +39,14 @@ class AttackReport extends React.Component { }; if (typeof this.props.report.schema !== 'undefined' && typeof this.props.report.techniques !== 'undefined'){ this.state['schema'] = this.props.report['schema']; - this.state['techniques'] = AttackReport.addLinksToTechniques(this.props.report['schema'], this.props.report['techniques']); + this.state['techniques'] = AttackReport.modifyTechniqueData(this.props.report['schema'], this.props.report['techniques']); } } componentDidUpdate(prevProps) { if (this.props.report !== prevProps.report) { this.setState({schema: this.props.report['schema'], - techniques: AttackReport.addLinksToTechniques(this.props.report['schema'], this.props.report['techniques'])}) + techniques: AttackReport.modifyTechniqueData(this.props.report['schema'], this.props.report['techniques'])}) } } @@ -143,7 +144,8 @@ class AttackReport extends React.Component { return false; } - static addLinksToTechniques(schema, techniques){ + static modifyTechniqueData(schema, techniques){ + // add links to techniques schema = schema.properties; for(const type in schema){ if (! schema.hasOwnProperty(type)) {return false;} @@ -155,6 +157,11 @@ class AttackReport extends React.Component { } } } + // modify techniques' messages + for (const tech_id in techniques){ + techniques[tech_id]['message'] =
; + } + return techniques }