Attack report bugfixes

This commit is contained in:
VakarisZ 2019-04-09 19:40:09 +03:00
parent 993736a973
commit 8ee7a06769
7 changed files with 30 additions and 17 deletions

View File

@ -10,4 +10,4 @@ class ScanStatus(Enum):
USED = 2
BITS_UPLOAD_STRING = "Bits job was used to upload monkey to a remote system."
BITS_UPLOAD_STRING = {"usage": "Bits job was used to upload monkey to a remote system."}

View File

@ -63,7 +63,7 @@ class ElasticGroovyExploiter(WebRCE):
def upload_monkey(self, url, commands=None):
result = super(ElasticGroovyExploiter, self).upload_monkey(url, commands)
if 'windows' in self.host.os['type'] and result:
VictimHostTelem("T1197", ScanStatus.USED.value, self.host, BITS_UPLOAD_STRING)
VictimHostTelem("T1197", ScanStatus.USED.value, self.host, BITS_UPLOAD_STRING).send()
return result
def get_results(self, response):

View File

@ -16,7 +16,7 @@ class AttackTelem(object):
Default ATT&CK telemetry constructor
:param technique: Technique ID. E.g. T111
:param status: int from ScanStatus Enum
:param data: Other data relevant to the attack technique
:param data: Dictionary of other relevant info. E.g. {'brute_force_blocked': True}
"""
self.technique = technique
self.result = status

View File

@ -13,4 +13,6 @@ MESSAGES = {
def get_report_data():
data = get_tech_base_data(TECHNIQUE, MESSAGES)
data.update()
return data

View File

@ -1,5 +1,6 @@
from monkey_island.cc.services.attack.technique_reports.technique_service import *
from cc.services.report import ReportService
from common.utils.attack_utils import ScanStatus
__author__ = "VakarisZ"
@ -12,8 +13,18 @@ MESSAGES = {
def get_report_data():
data = get_tech_base_data(TECHNIQUE, MESSAGES)
data.update({'scanned_machines': ReportService.get_scanned()})
data.update({'exploited_machines': ReportService.get_exploited()})
data = {}
scanned_machines = ReportService.get_scanned()
exploited_machines = ReportService.get_exploited()
data.update({'message': MESSAGES['unscanned'], 'status': ScanStatus.UNSCANNED.name})
for machine in scanned_machines:
if machine['services']:
data.update({'message': MESSAGES['scanned'], 'status': ScanStatus.SCANNED.name})
for machine in exploited_machines:
if machine['exploits']:
data.update({'message': MESSAGES['used'], 'status': ScanStatus.USED.name})
data.update({'technique': TECHNIQUE, 'title': technique_title(TECHNIQUE)})
data.update({'scanned_machines': scanned_machines})
data.update({'exploited_machines': exploited_machines})
return data

View File

@ -3,7 +3,7 @@ import '../../styles/Collapse.scss'
import {Link} from "react-router-dom";
let renderArray = function(val) {
return <span>{val.map(x => <span key={x.toString()}>{x} </span>)}</span>;
return <span>{val.map(x => <span key={x.toString()}> {x} </span>)}</span>;
};
@ -48,9 +48,9 @@ class T1210 extends React.Component {
return (
<div>
<div>{this.props.data.message}</div>
<div>Found services: </div>
{this.props.data.scanned_machines.length > 0 ? <div>Found services: </div> : ''}
{this.renderScannedMachines(this.props.data.scanned_machines)}
<div>Successful exploiters:</div>
{this.props.data.exploited_machines.length > 0 ? <div>Successful exploiters:</div> : ''}
{this.renderExploitedMachines(this.props.data.exploited_machines)}
<div className="attack-report footer-text">
To get more info about scanned and exploited machines view <Link to="/report">standard report.</Link>

View File

@ -128,18 +128,18 @@ class AttackReportPageComponent extends AuthComponent {
render() {
let content;
console.log(this.state.report);
if (this.state.report === false){
content = (<h1>Generating Report...</h1>);
} else if (Object.keys(this.state.report).length === 0) {
if (this.state.runStarted) {
content = (<h1>No techniques were scanned</h1>);
} else {
if (! this.state.runStarted)
{
content =
<p className="alert alert-warning">
<i className="glyphicon glyphicon-warning-sign" style={{'marginRight': '5px'}}/>
You have to run a monkey before generating a report!
</p>;
} else if (this.state.report === false){
content = (<h1>Generating Report...</h1>);
} else if (Object.keys(this.state.report).length === 0) {
if (this.state.runStarted) {
content = (<h1>No techniques were scanned</h1>);
}
} else {
content = this.generateReportContent();