UI: Show loading icon while fetching file encryption telemetry
This commit is contained in:
parent
af9caee85f
commit
09d7630a47
|
@ -22,7 +22,6 @@ class ReportPageComponent extends AuthComponent {
|
||||||
attackReport: {},
|
attackReport: {},
|
||||||
zeroTrustReport: {},
|
zeroTrustReport: {},
|
||||||
ransomwareReport: {},
|
ransomwareReport: {},
|
||||||
ransomwareTelemetry: {},
|
|
||||||
allMonkeysAreDead: false,
|
allMonkeysAreDead: false,
|
||||||
runStarted: true,
|
runStarted: true,
|
||||||
selectedSection: ReportPageComponent.selectReport(this.sections),
|
selectedSection: ReportPageComponent.selectReport(this.sections),
|
||||||
|
@ -68,13 +67,6 @@ class ReportPageComponent extends AuthComponent {
|
||||||
ransomwareReport: res
|
ransomwareReport: res
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.authFetch('/api/telemetry?telem_category=file_encryption')
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(res => {
|
|
||||||
this.setState({
|
|
||||||
ransomwareTelemetry: res
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +159,6 @@ class ReportPageComponent extends AuthComponent {
|
||||||
return (
|
return (
|
||||||
<RansomwareReport
|
<RansomwareReport
|
||||||
report={this.state.ransomwareReport}
|
report={this.state.ransomwareReport}
|
||||||
telemetry={this.state.ransomwareTelemetry}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ class RansomwareReport extends React.Component {
|
||||||
<div>
|
<div>
|
||||||
<BreachSection/>
|
<BreachSection/>
|
||||||
<LateralMovement propagationStats={this.props.report.propagation_stats} />
|
<LateralMovement propagationStats={this.props.report.propagation_stats} />
|
||||||
<AttackSection telemetry={this.props.telemetry} />
|
<AttackSection />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import React, {ReactElement} from 'react';
|
import React, {ReactElement, ReactFragment, useEffect, useState} from 'react';
|
||||||
|
import IslandHttpClient from '../../IslandHttpClient';
|
||||||
import {FileEncryptionTable, TableRow} from './FileEncryptionTable';
|
import {FileEncryptionTable, TableRow} from './FileEncryptionTable';
|
||||||
import NumberedReportSection from './NumberedReportSection';
|
import NumberedReportSection from './NumberedReportSection';
|
||||||
|
import LoadingIcon from '../../ui-components/LoadingIcon';
|
||||||
|
|
||||||
const ATTACK_DESCRIPTION = 'After the attacker or malware has propagated through your network, \
|
const ATTACK_DESCRIPTION = 'After the attacker or malware has propagated through your network, \
|
||||||
your data is at risk on any machine the attacker can access. It can be \
|
your data is at risk on any machine the attacker can access. It can be \
|
||||||
|
@ -8,25 +10,38 @@ const ATTACK_DESCRIPTION = 'After the attacker or malware has propagated through
|
||||||
whatever way the attacker chooses.'
|
whatever way the attacker chooses.'
|
||||||
const HOSTNAME_REGEX = /^(.* - )?(\S+) :.*$/;
|
const HOSTNAME_REGEX = /^(.* - )?(\S+) :.*$/;
|
||||||
|
|
||||||
function AttackSection({telemetry}: {telemetry: object}): ReactElement {
|
function AttackSection(): ReactElement {
|
||||||
let tableData = processTelemetry(telemetry);
|
const [tableData, setTableData] = useState(null);
|
||||||
let body = (
|
|
||||||
<>
|
useEffect(() => {
|
||||||
<p>Infection Monkey has encrypted <strong>{tableData.length} files</strong> on your network:</p>
|
IslandHttpClient.get('/api/telemetry?telem_category=file_encryption')
|
||||||
<FileEncryptionTable tableData={tableData} />
|
.then(resp => setTableData(processTelemetry(resp.body)));
|
||||||
</>
|
}, []);
|
||||||
);
|
|
||||||
|
|
||||||
|
if (tableData == null) {
|
||||||
|
return <LoadingIcon />
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NumberedReportSection
|
<NumberedReportSection
|
||||||
index={3}
|
index={3}
|
||||||
title='Attack'
|
title='Attack'
|
||||||
description={ATTACK_DESCRIPTION}
|
description={ATTACK_DESCRIPTION}
|
||||||
body={body}
|
body={getBody(tableData)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getBody(tableData): ReactFragment {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<p>Infection Monkey has encrypted <strong>{tableData.length} files</strong> on your network:</p>
|
||||||
|
<FileEncryptionTable tableData={tableData} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function processTelemetry(telemetry): Array<TableRow> {
|
function processTelemetry(telemetry): Array<TableRow> {
|
||||||
// Sort ascending so that newer telemetry records overwrite older ones.
|
// Sort ascending so that newer telemetry records overwrite older ones.
|
||||||
sortTelemetry(telemetry);
|
sortTelemetry(telemetry);
|
||||||
|
|
Loading…
Reference in New Issue